Microsoft SDK for Java

setFormat

The setFormat method of the DirectSoundBuffer Class contains the following signatures:

setFormat(byte[] format)
setFormat(WaveFormatEx format)

setFormat(byte[] format)

Sets the format of the primary sound buffer for the application. Whenever this application has the input focus, DirectSound will set the primary buffer to the specified format.

Syntax

public void setFormat(byte[] format);

Parameters

format Array variable that specifies the new format for the primary sound buffer.

Remarks

If this method is called on a primary buffer which is being accessed in write-primary cooperative level, the buffer must be stopped before setFormat is called. If this method is being called on a primary buffer for a non-write-primary level, DirectSound will implicitly stop the primary buffer, change the format, and restart the primary; the application does not need to do this explicitly.

A call to this method fails if the hardware does not directly support the requested pulse coded modulation (PCM) format. It will also fail if the calling application has the DSSCL_NORMAL cooperative level.

If a secondary sound buffer requires a format change, the application should create a new DirectSoundBuffer object using the new format.

DirectSound supports PCM formats; it does not currently support compressed formats.

See Also

getFormat

setFormat(WaveFormatEx format)

Sets the format of the primary sound buffer for the application. Whenever this application has the input focus, DirectSound will set the primary buffer to the specified format.

Syntax

public void setFormat(WaveFormatEx format);

Parameters

format A WaveFormatEx object that specifies the wave format to set.

Remarks

If this method is called on a primary buffer which is being accessed in write-primary cooperative level, the buffer must be stopped before setFormat is called. If this method is being called on a primary buffer for a non-write-primary level, DirectSound will implicitly stop the primary buffer, change the format, and restart the primary; the application does not need to do this explicitly.

A call to this method fails if the hardware does not directly support the requested pulse coded modulation (PCM) format. It will also fail if the calling application has the DSSCL_NORMAL cooperative level.

If a secondary sound buffer requires a format change, the application should create a new DirectSoundBuffer object using the new format.

DirectSound supports PCM formats; it does not currently support compressed formats.

See Also

getFormat

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