Microsoft SDK for Java

createSoundBuffer

The createSoundBuffer method of the DirectSound Class contains the following signatures:

createSoundBuffer(DSBufferDesc bufferDesc, byte[] format)
createSoundBuffer(DSBufferDesc bufferDesc, WaveFormatEx format)

createSoundBuffer(DSBufferDesc bufferDesc, byte[] format)

Creates a DirectSoundBuffer object to hold a sequence of audio samples.

Syntax

public DirectSoundBuffer createSoundBuffer(DSBufferDesc bufferDesc, byte[] format);

Return Value

Returns the DirectSoundBuffer object if successful; null otherwise.

Parameters

bufferDesc A DSBufferDesc object that contains the description of the sound buffer to be created.
format Array variable that specifies the wave format for the sound buffer.

Remarks

Before it can play any sound buffers, the application must specify a cooperative level for a DirectSound object by using the setCooperativeLevel method.

The bufferDesc parameter is an object that describes the type of buffer desired, including format, size, and capabilities. The application must specify the needed capabilities, or they will not be available. For example, if the application creates a DirectSoundBuffer object without specifying the DSBCAPS_CTRLFREQUENCY flag, any call to setFrequency will fail.

The DSBCAPS_STATIC flag can also be specified, in which case DirectSound stores the buffer in onboard memory, if available, in order to take advantage of hardware mixing. To force the buffer to use either hardware or software mixing, use the DSBCAPS_LOCHARDWARE or DSBCAPS_LOCSOFTWARE flags.

See Also

com.ms.directX.DSBufferDesc, duplicateSoundBuffer, setCooperativeLevel

createSoundBuffer(DSBufferDesc bufferDesc, WaveFormatEx format)

Creates a DirectSoundBuffer object to hold a sequence of audio samples.

Syntax

public DirectSoundBuffer createSoundBuffer(DSBufferDesc bufferDesc, WaveFormatEx format);

Return Value

Returns the DirectSoundBuffer object if successful; null otherwise.

Parameters

bufferDesc A DSBufferDesc object that contains the description of the sound buffer to be created.
format A WaveFormatEx object that specifies the wave format for the sound buffer.

Remarks

Before it can play any sound buffers, the application must specify a cooperative level for a DirectSound object by using the setCooperativeLevel method.

The bufferDesc parameter is an object that describes the type of buffer desired, including format, size, and capabilities. The application must specify the needed capabilities, or they will not be available. For example, if the application creates a DirectSoundBuffer object without specifying the DSBCAPS_CTRLFREQUENCY flag, any call to setFrequency will fail.

The DSBCAPS_STATIC flag can also be specified, in which case DirectSound stores the buffer in onboard memory, if available, in order to take advantage of hardware mixing. To force the buffer to use either hardware or software mixing, use the DSBCAPS_LOCHARDWARE or DSBCAPS_LOCSOFTWARE flags.

See Also

com.ms.directX.DSBufferDesc, duplicateSoundBuffer, setCooperativeLevel

© 1999 Microsoft Corporation. All rights reserved. Terms of use.