Some audio cards may be unable to report accurately the number of available or free hardware buffers. This can happen, for example, when the card can play more sounds at lower sampling rates than at higher rates. In general, a nonzero value in any of the members relating to number of free hardware buffers signifies that at least one hardware resource of the appropriate type is available.
The unlock transfer rate for software buffers is 0, because the data need not be transferred anywhere. Similarly, the play processing overhead for hardware buffers is 0 because the mixing is done by the sound device.
The
To obtain the
In addition to the methods inherited from
Method | Description |
---|---|
IDirectSoundCaptureBuffer8::Lock | The Lock method locks a portion of the buffer. Locking the buffer returns references into the buffer, allowing the application to read or write audio data into memory. |
IDirectSoundCaptureBuffer8::Start | The Start method begins capturing data into the buffer. If the buffer is already capturing, the method has no effect. |
IDirectSoundCaptureBuffer8::Stop | The Stop method stops the buffer so that it is no longer capturing data. If the buffer is not capturing, the method has no effect. |
IDirectSoundCaptureBuffer8::Unlock | The Unlock method unlocks the buffer. |
Method | Description |
---|---|
The GetFXStatus method retrieves the status of capture effects. | |
The GetObjectInPath method retrieves an interface to an effect object associated with the buffer. |
Method | Description |
---|---|
IDirectSoundCaptureBuffer8::Initialize | The Initialize method initializes a capture buffer object. Because the IDirectSoundCapture8::CreateCaptureBufferIDirectSoundCapture8::CreateCaptureBuffer |
Method | Description |
---|---|
IDirectSoundCaptureBuffer8::GetCaps | The GetCaps method retrieves the capabilities of the buffer. |
IDirectSoundCaptureBuffer8::GetCurrentPosition | Address of a variable that receives the offset from the start of the buffer, in bytes, of the capture cursor. The parameter can be |
IDirectSoundCaptureBuffer8::GetFormat | The GetFormat method retrieves the waveform format of the capture buffer. |
IDirectSoundCaptureBuffer8::GetStatus | The GetStatus method retrieves the status of the capture buffer. |
The LPDIRECTSOUNDCaptureBuffer8 type is defined as a reference to the
typedef struct*LPDIRECTSOUNDCaptureBuffer8;
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following error values:
Return code |
DSERR_CONTROLUNAVAIL |
DSERR_INVALIDPARAM |
DSERR_OBJECTNOTFOUND |
The value in dwIndex is the index of the object within the array of effects in the
Value | Description |
DSCFXR_LOCHARDWARE | Effect is instantiated in hardware. |
DSCFXR_LOCSOFTWARE | Effect is instantiated in software. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
The
To obtain the
In addition to the methods inherited from
Method | Description |
---|---|
IDirectSoundCaptureBuffer8::Lock | The Lock method locks a portion of the buffer. Locking the buffer returns references into the buffer, allowing the application to read or write audio data into memory. |
IDirectSoundCaptureBuffer8::Start | The Start method begins capturing data into the buffer. If the buffer is already capturing, the method has no effect. |
IDirectSoundCaptureBuffer8::Stop | The Stop method stops the buffer so that it is no longer capturing data. If the buffer is not capturing, the method has no effect. |
IDirectSoundCaptureBuffer8::Unlock | The Unlock method unlocks the buffer. |
Method | Description |
---|---|
The GetFXStatus method retrieves the status of capture effects. | |
The GetObjectInPath method retrieves an interface to an effect object associated with the buffer. |
Method | Description |
---|---|
IDirectSoundCaptureBuffer8::Initialize | The Initialize method initializes a capture buffer object. Because the IDirectSoundCapture8::CreateCaptureBufferIDirectSoundCapture8::CreateCaptureBuffer |
Method | Description |
---|---|
IDirectSoundCaptureBuffer8::GetCaps | The GetCaps method retrieves the capabilities of the buffer. |
IDirectSoundCaptureBuffer8::GetCurrentPosition | Address of a variable that receives the offset from the start of the buffer, in bytes, of the capture cursor. The parameter can be |
IDirectSoundCaptureBuffer8::GetFormat | The GetFormat method retrieves the waveform format of the capture buffer. |
IDirectSoundCaptureBuffer8::GetStatus | The GetStatus method retrieves the status of the capture buffer. |
The LPDIRECTSOUNDCaptureBuffer8 type is defined as a reference to the
typedef struct*LPDIRECTSOUNDCaptureBuffer8;
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following error values:
Return code |
DSERR_INVALIDPARAM |
DSERR_UNSUPPORTED |
DSERR_OUTOFMEMORY |
The capture cursor is ahead of the read cursor. The data after the read position up to and including the capture position is not necessarily valid data.
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following error values:
Return code |
DSERR_INVALIDPARAM |
DSERR_NODRIVER |
DSERR_OUTOFMEMORY |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
Value | Description |
The buffer is capturing audio data. | |
The buffer is looping. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
Value | Description |
DSCBLOCK_ENTIREBUFFER | Ignore dwBytes and lock the entire capture buffer. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following values:
Return code |
DSERR_INVALIDPARAM |
DSERR_INVALIDCALL |
This method accepts an offset and a byte count, and returns two read references and their associated sizes. If the locked portion does not extend to the end of the buffer and wrap to the beginning, the second reference, ppvAudioBytes2, receives
If the application passes
The application should read data from the references returned by this method and then immediately call Unlock. The sound buffer should not remain locked while it is running; if it does, the capture cursor will reach the locked bytes and audio problems may result.
Value | Description |
DSCBSTART_LOOPING | After the end of the buffer is reached, capture restarts at the beginning and continues until explicitly stopped. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following error values:
Return code |
DSERR_INVALIDPARAM |
DSERR_NODRIVER |
DSERR_OUTOFMEMORY |
If the buffer is already capturing, a call to this method using a different value in dwFlags might not change the value returned by GetStatus.
If the application is multithreaded, the thread that starts the buffer must continue to exist as long as the buffer is capturing. Buffers created on WDM drivers stop capturing when the thread is terminated.
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following error values:
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following values:
Return code |
DSERR_INVALIDPARAM |
DSERR_INVALIDCALL |
An application must pass both references, pvAudioPtr1 and pvAudioPtr2, returned by the IDirectSoundCaptureBuffer8::Lock method to ensure the correct pairing of IDirectSoundCaptureBuffer8::Lock and IDirectSoundCaptureBuffer8::Unlock. The second reference is needed even if zero bytes were written to the second reference.
The values in dwAudioBytes1 and dwAudioBytes2 must specify the number of bytes actually read from each part of the buffer, which might be less than the size of the lock. DirectSound uses these values to determine how much data to transfer from the device.
Make sure that the capture buffer does not remain locked for long periods of time.
An earlier version of this structure, DSCBUFFERDESC1, is maintained in Dsound.h for compatibility with DirectX 7 and earlier.
The
Capture effects require Microsoft Windows XP.
Value | Description |
---|---|
Effect specified by guidDSCFXInstance must be in hardware. | |
Effect specified by guidDSCFXInstance must be in software. |
On return, this member can contain one of the values shown in the following table.
Value | Description |
---|---|
Effect was created in hardware. | |
Effect was created in software. |
Value | Description |
---|---|
Acoustic echo cancellation. | |
Noise suppression. |
Value | Description |
---|---|
Microsoft acoustic echo cancellation. Available in software only. | |
Microsoft noise suppression. Available in software only. | |
System default acoustic echo cancellation. | |
System default noise suppression. |
The IDirectSoundFXChorus8 interface is used to set and retrieve effect parameters on a buffer that supports chorus.
This interface is obtained by calling GetObjectInPath on the buffer that supports the effect.
In addition to the methods inherited from
Method | Description |
---|---|
IDirectSoundFXChorus8::GetAllParameters | The GetAllParameters method retrieves the chorus parameters of a buffer. |
IDirectSoundFXChorus8::SetAllParameters | The SetAllParameters method sets the chorus parameters of a buffer. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
The IDirectSoundFXCompressor8 interface is used to set and retrieve effect parameters on a buffer that supports compression.
This interface is obtained by calling GetObjectInPath on the buffer that supports the effect.
In addition to the methods inherited from
Method | Description |
---|---|
IDirectSoundFXCompressor8::GetAllParameters | The GetAllParameters method retrieves the compression parameters of a buffer. |
IDirectSoundFXCompressor8::SetAllParameters | The SetAllParameters method sets the compression parameters of a buffer. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
The
Obtain this interface by using the DirectSoundCreate8 or DirectSoundFullDuplexCreate8 function, or by using CoCreateInstance or CoCreateInstanceEx to create an object of class CLSID_DirectSound8.
In addition to the methods inherited from
Method | Description |
---|---|
IDirectSound8::Compact | The Compact method has no effect. |
IDirectSound8::CreateSoundBuffer | The CreateSoundBuffer method creates a sound buffer object to manage audio samples. |
IDirectSound8::DuplicateSoundBuffer | The DuplicateSoundBuffer method creates a new secondary buffer that shares the original buffer's memory. |
IDirectSound8::GetCaps | The GetCaps method retrieves the capabilities of the hardware device that is represented by the device object. |
IDirectSound8::GetSpeakerConfig | The GetSpeakerConfig method retrieves the speaker configuration. |
IDirectSound8::Initialize | The Initialize method initializes a device object that was created by using the CoCreateInstance function. |
IDirectSound8::SetCooperativeLevel | The SetCooperativeLevel method sets the cooperative level of the application for this sound device. |
IDirectSound8::SetSpeakerConfig | The SetSpeakerConfig method specifies the speaker configuration of the device. |
The VerifyCertification method ascertains whether the device driver is certified for DirectX. |
The LPDIRECTSOUND8 type is defined as a reference to the
typedef struct*LPDIRECTSOUND8;
Only objects of class CLSID_DirectSound8 support this interface. All device objects created by DirectSoundCreate8 and DirectSoundFullDuplexCreate8 fall into this category. Objects of class CLSID_DirectSound, which include all those created by using the earlier DirectSoundCreate function, support only the earlier
The behavior of CLSID_DirectSound8 objects is somewhat different from that of CLSID_DirectSound objects. These differences are found in the
In calls to
New buffer creation flags are supported.
Buffers are not filled with silence on creation.
The
WAV formats in the
Value | Description |
DS_CERTIFIED | Driver is certified for DirectSound. |
DS_UNCERTIFIED | Driver is not certified for DirectSound. |
If the function succeeds, the return value is DS_OK.
If the function fails, the return value may be one of the error values shown in the following table.
Return code |
DSERR_INVALIDPARAM |
DSERR_UNSUPPORTED |
This method may attempt to retrieve certification information from the Internet.
On emulated devices, the method returns DSERR_UNSUPPORTED. Emulated devices are identified by the
The IDirectSoundCapture8 interface is used to create sound capture buffers.
The interface is obtained by using the DirectSoundCaptureCreate8 or DirectSoundFullDuplexCreate8 functions, or by using CoCreateInstance or CoCreateInstanceEx to create an object of class CLSID_DirectSoundCapture8.
IDirectSoundCapture8 is a define for
In addition to the methods inherited from
Method | Description |
---|---|
IDirectSoundCapture8::CreateCaptureBuffer | The CreateCaptureBuffer method creates a buffer for capturing waveform audio. |
IDirectSoundCapture8::GetCaps | The GetCaps method retrieves the capabilities of the capture device. |
IDirectSoundCapture8::Initialize | The Initialize method initializes a capture device object created by using CoCreateInstance. Calling this method is not required when the DirectSoundCaptureCreate8 or DirectSoundFullDuplexCreate8 function is used to create the object. |
The LPDIRECTSOUNDCAPTURE type is defined as a reference to the
typedef struct*LPDIRECTSOUNDCAPTURE;
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following error values.
Return code |
DSERR_INVALIDPARAM |
DSERR_BADFORMAT |
DSERR_GENERIC |
DSERR_NODRIVER |
DSERR_OUTOFMEMORY |
DSERR_UNINITIALIZED |
On Microsoft Windows98 and Windows2000, each capture device supports a single buffer.
The
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following error values:
Return code |
DSERR_INVALIDPARAM |
DSERR_UNSUPPORTED |
DSERR_NODRIVER |
DSERR_OUTOFMEMORY |
DSERR_UNINITIALIZED |
The IDirectSoundFXDistortion8 interface is used to set and retrieve effect parameters on a buffer that supports distortion.
This interface is obtained by calling GetObjectInPath on the buffer that supports the effect.
In addition to the methods inherited from
Method | Description |
---|---|
IDirectSoundFXDistortion8::GetAllParameters | The GetAllParameters method retrieves the distortion parameters of a buffer. |
IDirectSoundFXDistortion8::SetAllParameters | The SetAllParameters method sets the distortion parameters of a buffer. |
If the method succeeds, the return value is DS_OK or S_FALSE. See the Remarks for
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
The IDirectSoundFXEcho8 interface is used to set and retrieve effect parameters on a buffer that supports echo.
This interface is obtained by calling GetObjectInPath on the buffer that supports the effect.
In addition to the methods inherited from
Method | Description |
---|---|
IDirectSoundFXEcho8::GetAllParameters | The GetAllParameters method retrieves the echo parameters of a buffer. |
IDirectSoundFXEcho8::SetAllParameters | The SetAllParameters method sets the echo parameters of a buffer. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
The IDirectSoundFXFlanger8 interface is used to set and retrieve effect parameters on a buffer that supports flange.
This interface is obtained by calling GetObjectInPath on the buffer that supports the effect.
In addition to the methods inherited from
Method | Description |
---|---|
IDirectSoundFXFlanger8::GetAllParameters | The GetAllParameters method retrieves the flange parameters of a buffer. |
IDirectSoundFXFlanger8::SetAllParameters | The SetAllParameters method sets the flange parameters of a buffer. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
The IDirectSoundFullDuplex8 interface represents a full-duplex stream.
The interface is obtained by using the DirectSoundFullDuplexCreate8 function. This function initializes DirectSound capture and playback.
The interface can also be obtained by using CoCreateInstance or CoCreateInstanceEx to create an object of class CLSID_DirectSoundFullDuplex8.
IDirectSoundFullDuplex8 is a define for
In addition to the methods inherited from
Method | Description |
---|---|
IDirectSoundFullDuplex8::Initialize | The Initialize method initializes a full duplex object that was created by using CoCreateInstance. |
The LPDIRECTSOUNDFULLDUPLEX type is defined as a reference to
typedef structInfo*LPDIRECTSOUNDFULLDUPLEX;
Operating System: Requires Microsoft Windows XP or later.
Windows |
---|
Important Note for Windows Vista Existing applications that access Windows XP Acoustic Echo Cancellation (AEC) features via the DirectSound API will no longer obtain AEC when running on Windows Vista. These applications will still run, but their calls to AEC-specific DirectSound API calls will have no effect on the captured audio. To learn how to obtain AEC in Windows Vista, See the Windows Vista AEC topics in the Windows SDK. |
The IDirectSoundFXGargle8 interface is used to set and retrieve effect parameters on a buffer that supports amplitude modulation.
This interface is obtained by calling GetObjectInPath on the buffer that supports the effect.
In addition to the methods inherited from
Method | Description |
---|---|
IDirectSoundFXGargle8::GetAllParameters | The GetAllParameters method retrieves the amplitude modulation parameters of a buffer. |
IDirectSoundFXGargle8::SetAllParameters | The SetAllParameters method sets the amplitude modulation parameters of a buffer. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value can be DSERR_INVALIDPARAM.
If the method succeeds, the return value is DS_OK. If the method fails, the return value can be DSERR_INVALIDPARAM.
The dwMode member is ignored when this structure is passed to IDirectSoundCaptureFXAec8::SetAllParameters.
Windows |
---|
Important Note for Windows Vista Existing applications that access Windows XP Acoustic Echo Cancellation (AEC) features via the DirectSound API will no longer obtain AEC when running on Windows Vista. These applications will still run, but their calls to AEC-specific DirectSound API calls will have no effect on the captured audio. To learn how to obtain AEC in Windows Vista, See the Windows Vista AEC topics in the Windows SDK. |
Value | Description |
---|---|
The effect is passing capture and render data through without modifying it. | |
The effect is running in half duplex mode. Not presently supported. | |
The effect is running in full duplex mode. |
The KSPROPERTY_AEC_STATUS property is used to monitor the status of an AEC node (KSNODETYPE_ACOUSTIC_ECHO_CANCEL). This is an optional property of an AEC node.
The three least significant bits in the AEC status flags (see preceding table) represent the convergence history (CH) of the AEC algorithm. The CH status bits can be used by a Microsoft DirectSound application to determine whether the algorithm has converged and also whether it has remained in the converged state since the time that it started processing data. Depending on the audio hardware, the AEC algorithm might fail to converge, in which case the resulting capture buffer is likely to include the echo from the speakers.
When the filter containing the AEC node is created or the node is reset, the AEC algorithm initially sets the three CH status bits to zero. This setting represents the uninitialized state, AEC_STATUS_FD_HISTORY_UNINITIALIZED.
After the AEC algorithm converges, the CH status switches to the converged state, AEC_STATUS_FD_HISTORY_CONTINUOUSLY_CONVERGED. If the AEC algorithm ever loses convergence, the CH status switches to the diverged state, AEC_STATUS_FD_HISTORY_PREVIOUSLY_DIVERGED. Although the status is most likely to switch to the diverged state from the converged state, it might also switch directly from the uninitialized state to the diverged state. After the CH status has switched to the diverged state, it will remain in that state until the algorithm is reset or starvation is detected.
When the AEC system filter detects starvation at any of its four pins--capture in, capture out, render in, or render out--it resets its internal state, including the convergence history.
Note that bit 2 of the three CH status bits is not currently used.
As an alternative to using the CH status bits, the application can monitor the real-time convergence status by checking the AEC_STATUS_FD_CURRENTLY_CONVERGED flag bit. If this bit is set, the algorithm is currently converged. The algorithm can lose convergence temporarily when changes occur in the acoustic path. The real-time convergence flag is filtered to prevent such momentary losses from inappropriately switching the CH status bits to the DSCFX_AEC_STATUS_FD_HISTORY_PREVIOUSLY_DIVERGED state.
Some audio cards may be unable to report accurately the number of available or free hardware buffers. This can happen, for example, when the card can play more sounds at lower sampling rates than at higher rates. In general, a nonzero value in any of the members relating to number of free hardware buffers signifies that at least one hardware resource of the appropriate type is available.
The unlock transfer rate for software buffers is 0, because the data need not be transferred anywhere. Similarly, the play processing overhead for hardware buffers is 0 because the mixing is done by the sound device.
Value | Description |
---|---|
Effect specified by guidDSCFXInstance must be in hardware. | |
Effect specified by guidDSCFXInstance must be in software. |
On return, this member can contain one of the values shown in the following table.
Value | Description |
---|---|
Effect was created in hardware. | |
Effect was created in software. |
Value | Description |
Processing of 3D sound is disabled. The sound seems to originate from the center of the listener's head. | |
Sound parameters (position, velocity, and orientation) are relative to the listener's parameters. In this mode, the absolute parameters of the sound are updated automatically as the listener's parameters change, so that the relative parameters remain constant. | |
Normal processing. This is the default mode. |
If the function succeeds, it returns DS_OK. If it fails, the return value may be one of the following values.
Return Code |
---|
DSERR_ALLOCATED |
DSERR_INVALIDPARAM |
DSERR_NOAGGREGATION |
DSERR_OUTOFMEMORY |
On sound cards that do not support full duplex, this method will fail and return DSERR_ALLOCATED.
If the function succeeds, it returns DS_OK. If it fails, the return value may be DSERR_INVALIDPARAM.
If the function succeeds, it returns DS_OK. If it fails, the return value may be DSERR_INVALIDPARAM.
If the function succeeds, it returns DS_OK. If it fails, the return value may be one of the following values.
Return Code |
---|
DSERR_ALLOCATED |
DSERR_INVALIDPARAM |
DSERR_NOAGGREGATION |
DSERR_OUTOFMEMORY |
On sound cards that do not support full duplex, this method will fail and return DSERR_ALLOCATED.
The DirectSoundFullDuplexCreate function is documented under a different name. For complete documentation of this function, see DirectSoundFullDuplexCreate8.
If this function succeeds, it returns
Value | Description |
---|---|
DSDEVID_DefaultPlayback | System-wide default audio playback device. |
DSDEVID_DefaultCapture | System-wide default audio capture device. |
DSDEVID_DefaultVoicePlayback | Default voice playback device. |
DSDEVID_DefaultVoiceCapture | Default voice capture device. |
If the function succeeds, it returns DS_OK. If it fails, the return value may be DSERR_INVALIDPARAM.
If pGuidSrc points to a valid device identifier, the same value is returned in pGuidDest. If pGuidSrc is one of the listed constants, pGuidDest returns the address of the corresponding device
If the function succeeds, it returns DS_OK. If it fails, the return value may be DSERR_INVALIDPARAM.
If the function succeeds, it returns DS_OK. If it fails, the return value may be DSERR_INVALIDPARAM.
If the function succeeds, it returns DS_OK. If it fails, the return value may be one of the following.
Return Code |
---|
DSERR_ALLOCATED |
DSERR_INVALIDPARAM |
DSERR_NOAGGREGATION |
DSERR_NODRIVER |
DSERR_OUTOFMEMORY |
The application must call the IDirectSound8::SetCooperativeLevel method immediately after creating a device object.
The IDirectSoundCaptureFXAec8 interface is used to set and retrieve parameters on a capture buffer that supports acoustic echo cancellation. This interface requires Microsoft Windows XP or later operating systems.
IDirectSoundCaptureFXAec8 is a define for
This interface is obtained by calling GetObjectInPath on the buffer that supports the effect.
In addition to the methods inherited from
Method | Description |
---|---|
IDirectSoundCaptureFXAec8::GetAllParameters | The IDirectSoundCaptureFXAec8::GetAllParameters method retrieves the acoustic echo cancellation parameters of a buffer. |
IDirectSoundCaptureFXAec8::GetStatus | The IDirectSoundCaptureFXAec8::GetStatus method retrieves the status of the effect. |
IDirectSoundCaptureFXAec8::Reset | The IDirectSoundCaptureFXAec8::Reset method resets the effect to its initial state. |
IDirectSoundCaptureFXAec8::SetAllParameters | The IDirectSoundCaptureFXAec8::SetAllParameters method sets the acoustic echo cancellation parameters of a buffer. |
The LPDIRECTSOUNDCAPTUREFXAEC8 type is defined as a reference to the IDirectSoundCaptureFXAec8 interface:
typedef struct IDirectSoundCaptureFXAec8 *LPDIRECTSOUNDCAPTUREFXAEC8;Info
Operating System: Requires Microsoft WindowsXP or later.
Windows |
---|
Important Note for Windows Vista Existing applications that access Windows XP Acoustic Echo Cancellation (AEC) features via the DirectSound API will no longer obtain AEC when running on Windows Vista. These applications will still run, but their calls to AEC-specific DirectSound API calls will have no effect on the captured audio. To learn how to obtain AEC in Windows Vista, See the Windows Vista AEC topics in the Windows SDK. |
Windows |
---|
Important Note for Windows Vista Existing applications that access Windows XP Acoustic Echo Cancellation (AEC) features via the DirectSound API will no longer obtain AEC when running on Windows Vista. These applications will still run, but their calls to AEC-specific DirectSound API calls will have no effect on the captured audio. To learn how to obtain AEC in Windows Vista, See the Windows Vista AEC topics in the Windows SDK. |
Windows |
---|
Important Note for Windows Vista Existing applications that access Windows XP Acoustic Echo Cancellation (AEC) features via the DirectSound API will no longer obtain AEC when running on Windows Vista. These applications will still run, but their calls to AEC-specific DirectSound API calls will have no effect on the captured audio. To learn how to obtain AEC in Windows Vista, See the Windows Vista AEC topics in the Windows SDK. |
The three least significant bits in *pdwStatus describe the convergence history; that is, the success of the effect in canceling the echo. The convergence history can be used by the application to determine if the algorithm has converged and remained in the converged state since it started processing data.
Initially, the AEC algorithm sets the three lower bits to 0 for the uninitialized state (
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following values.
Return code |
DSERR_INVALIDPARAM |
DSERR_OUTOFMEMORY |
Windows |
---|
Important Note for Windows Vista Existing applications that access Windows XP Acoustic Echo Cancellation (AEC) features via the DirectSound API will no longer obtain AEC when running on Windows Vista. These applications will still run, but their calls to AEC-specific DirectSound API calls will have no effect on the captured audio. To learn how to obtain AEC in Windows Vista, See the Windows Vista AEC topics in the Windows SDK. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following values.
Return code |
DSERR_INVALIDPARAM |
DSERR_OUTOFMEMORY |
If the method fails, the return value may be DSERR_INVALIDPARAM.
Windows |
---|
Important Note for Windows Vista Existing applications that access Windows XP Acoustic Echo Cancellation (AEC) features via the DirectSound API will no longer obtain AEC when running on Windows Vista. These applications will still run, but their calls to AEC-specific DirectSound API calls will have no effect on the captured audio. To learn how to obtain AEC in Windows Vista, See the Windows Vista AEC topics in the Windows SDK. |
Constant | Value |
0x0 | |
0x1 | |
0x2 | |
0x8 |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following values.
Return code |
DSERR_INVALIDPARAM |
DSERR_OUTOFMEMORY |
Windows |
---|
Important Note for Windows Vista Existing applications that access Windows XP Acoustic Echo Cancellation (AEC) features via the DirectSound API will no longer obtain AEC when running on Windows Vista. These applications will still run, but their calls to AEC-specific DirectSound API calls will have no effect on the captured audio. To learn how to obtain AEC in Windows Vista, See the Windows Vista AEC topics in the Windows SDK. |
The three least significant bits in *pdwStatus describe the convergence history; that is, the success of the effect in canceling the echo. The convergence history can be used by the application to determine if the algorithm has converged and remained in the converged state since it started processing data.
Initially, the AEC algorithm sets the three lower bits to 0 for the uninitialized state (
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_OUTOFMEMORY.
Windows |
---|
Important Note for Windows Vista Existing applications that access Windows XP Acoustic Echo Cancellation (AEC) features via the DirectSound API will no longer obtain AEC when running on Windows Vista. These applications will still run, but their calls to AEC-specific DirectSound API calls will have no effect on the captured audio. To learn how to obtain AEC in Windows Vista, See the Windows Vista AEC topics in the Windows SDK. |
Applications should not reset an effect except when necessary because it has entered an incorrect state. This might be done in response to user input. An effect must not be reset arbitrarily at startup, because another application might be using the same effect.
The
Obtain this interface by using the DirectSoundCreate8 or DirectSoundFullDuplexCreate8 function, or by using CoCreateInstance or CoCreateInstanceEx to create an object of class CLSID_DirectSound8.
In addition to the methods inherited from
Method | Description |
---|---|
IDirectSound8::Compact | The Compact method has no effect. |
IDirectSound8::CreateSoundBuffer | The CreateSoundBuffer method creates a sound buffer object to manage audio samples. |
IDirectSound8::DuplicateSoundBuffer | The DuplicateSoundBuffer method creates a new secondary buffer that shares the original buffer's memory. |
IDirectSound8::GetCaps | The GetCaps method retrieves the capabilities of the hardware device that is represented by the device object. |
IDirectSound8::GetSpeakerConfig | The GetSpeakerConfig method retrieves the speaker configuration. |
IDirectSound8::Initialize | The Initialize method initializes a device object that was created by using the CoCreateInstance function. |
IDirectSound8::SetCooperativeLevel | The SetCooperativeLevel method sets the cooperative level of the application for this sound device. |
IDirectSound8::SetSpeakerConfig | The SetSpeakerConfig method specifies the speaker configuration of the device. |
The VerifyCertification method ascertains whether the device driver is certified for DirectX. |
The LPDIRECTSOUND8 type is defined as a reference to the
typedef struct*LPDIRECTSOUND8;
Only objects of class CLSID_DirectSound8 support this interface. All device objects created by DirectSoundCreate8 and DirectSoundFullDuplexCreate8 fall into this category. Objects of class CLSID_DirectSound, which include all those created by using the earlier DirectSoundCreate function, support only the earlier
The behavior of CLSID_DirectSound8 objects is somewhat different from that of CLSID_DirectSound objects. These differences are found in the
In calls to
New buffer creation flags are supported.
Buffers are not filled with silence on creation.
The
WAV formats in the
Information retrieved in the
Because of resource-sharing requirements, the maximum capabilities in one area might be available only at the cost of another area.
If the method succeeds, the return value is DS_OK, or DS_NO_VIRTUALIZATION if a requested 3D algorithm was not available and stereo panning was substituted. See the description of the guid3DAlgorithm member of
Return code |
DSERR_ALLOCATED |
DSERR_BADFORMAT |
DSERR_BUFFERTOOSMALL |
DSERR_CONTROLUNAVAIL |
DSERR_DS8_REQUIRED |
DSERR_INVALIDCALL |
DSERR_INVALIDPARAM |
DSERR_NOAGGREGATION |
DSERR_OUTOFMEMORY |
DSERR_UNINITIALIZED |
DSERR_UNSUPPORTED |
DirectSound does not initialize the contents of the buffer, and the application cannot assume that it contains silence.
If an attempt is made to create a buffer with the
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the error values shown in the following table.
Return code |
DSERR_GENERIC |
DSERR_INVALIDPARAM |
DSERR_UNINITIALIZED |
Information retrieved in the
Because of resource-sharing requirements, the maximum capabilities in one area might be available only at the cost of another area.
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following error values:
Return code |
DSERR_ALLOCATED |
DSERR_INVALIDCALL |
DSERR_INVALIDPARAM |
DSERR_OUTOFMEMORY |
DSERR_UNINITIALIZED |
This method is not valid for buffers created with the
Initially, the duplicate buffer will have the same parameters as the original buffer. However, the application can change the parameters of each buffer independently, and each can be played or stopped without affecting the other.
The buffer memory is released when the last object referencing it is released.
There is a known issue with volume levels of duplicated buffers. The duplicated buffer will play at full volume unless you change the volume to a different value than the original buffer's volume setting. If the volume stays the same (even if you explicitly set the same volume in the duplicated buffer with a IDirectSoundBuffer8::SetVolume call), the buffer will play at full volume regardless. To work around this problem, immediately set the volume of the duplicated buffer to something slightly different than what it was, even if you change it one millibel. The volume may then be immediately set back again to the original desired value.
Value | Description |
For DirectX 8.0 and later, has the same effect as | |
Sets the normal level. This level has the smoothest multitasking and resource-sharing behavior, but because it does not allow the primary buffer format to change, output is restricted to the default 8-bit format. | |
Sets the priority level. Applications with this cooperative level can call the SetFormat and Compact methods. | |
Sets the write-primary level. The application has write access to the primary buffer. No secondary buffers can be played. This level cannot be set if the DirectSound driver is being emulated for the device; that is, if the GetCaps method returns the |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the error values shown in the following table.
Return code |
DSERR_ALLOCATED |
DSERR_INVALIDPARAM |
DSERR_UNINITIALIZED |
DSERR_UNSUPPORTED |
The application must set the cooperative level by calling this method before its buffers can be played. The recommended cooperative level is
Do not call this method if any buffers are locked.
The return value is DS_OK.
This method was formerly used for compacting the on-board memory of ISA sound cards.
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the error values shown in the following table.
Return code |
---|
DSERR_INVALIDPARAM |
DSERR_UNINITIALIZED |
The value returned at pdwSpeakerConfig can be a packed DWORD containing both configuration and geometry information. Use the DSSPEAKER_CONFIG and DSSPEAKER_GEOMETRY macros to unpack the DWORD, as in the following example:
if (DSSPEAKER_CONFIG(dwSpeakerConfig) ==) { if (DSSPEAKER_GEOMETRY(dwSpeakerConfig) == ) { // Configuration is wide stereo. ...} }
To use #defines implemented in Windows Vista, set the DIRECTSOUND_VERSION to 0x1000 before including dsound.h.
The IDirectSoundCaptureFXNoiseSuppress8 interface is used to set and retrieve parameters on a capture buffer that supports noise suppression. This interface requires Microsoft WindowsXP or later.
IDirectSoundCaptureFXNoiseSuppress8 is a define for
This interface is obtained by calling GetObjectInPath on the buffer that supports the effect.
In addition to the methods inherited from
Method | Description |
---|---|
IDirectSoundCaptureFXNoiseSuppress8::GetAllParameters | The IDirectSoundCaptureFXNoiseSuppress8::GetAllParameters method retrieves the noise suppression parameters of a buffer. |
IDirectSoundCaptureFXNoiseSuppress8::Reset | The IDirectSoundCaptureFXNoiseSuppress8::Reset method resets the effect to its initial state. |
IDirectSoundCaptureFXNoiseSuppress8::SetAllParameters | The IDirectSoundCaptureFXNoiseSuppress8::SetAllParameters method sets the noise suppression parameters of a buffer. |
The LPDIRECTSOUNDNOISESUPPRESS8 type is defined as a reference to the IDirectSoundNoiseSuppress8 interface:
typedef struct IDirectSoundCaptureFXNoiseSuppress8 *LPDIRECTSOUNDCAPTUREFXNOISESUPPRESS8;Info
Operating System: Requires Microsoft WindowsXP or later.
Windows |
---|
Important Note for Windows Vista Existing applications that access Windows XP Acoustic Echo Cancellation (AEC) features via the DirectSound API will no longer obtain AEC when running on Windows Vista. These applications will still run, but their calls to AEC-specific DirectSound API calls will have no effect on the captured audio. To learn how to obtain AEC in Windows Vista, See the Windows Vista AEC topics in the Windows SDK. |
Windows |
---|
Important Note for Windows Vista Existing applications that access Windows XP Acoustic Echo Cancellation (AEC) features via the DirectSound API will no longer obtain AEC when running on Windows Vista. These applications will still run, but their calls to AEC-specific DirectSound API calls will have no effect on the captured audio. To learn how to obtain AEC in Windows Vista, See the Windows Vista AEC topics in the Windows SDK. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following values:
Return code |
DSERR_INVALIDPARAM |
DSERR_OUTOFMEMORY |
Windows |
---|
Important Note for Windows Vista Existing applications that access Windows XP Acoustic Echo Cancellation (AEC) features via the DirectSound API will no longer obtain AEC when running on Windows Vista. These applications will still run, but their calls to AEC-specific DirectSound API calls will have no effect on the captured audio. To learn how to obtain AEC in Windows Vista, See the Windows Vista AEC topics in the Windows SDK. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following values:
Return code |
DSERR_INVALIDPARAM |
DSERR_OUTOFMEMORY |
Windows |
---|
Important Note for Windows Vista Existing applications that access Windows XP Acoustic Echo Cancellation (AEC) features via the DirectSound API will no longer obtain AEC when running on Windows Vista. These applications will still run, but their calls to AEC-specific DirectSound API calls will have no effect on the captured audio. To learn how to obtain AEC in Windows Vista, See the Windows Vista AEC topics in the Windows SDK. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_OUTOFMEMORY.
Windows |
---|
Important Note for Windows Vista Existing applications that access Windows XP Acoustic Echo Cancellation (AEC) features via the DirectSound API will no longer obtain AEC when running on Windows Vista. These applications will still run, but their calls to AEC-specific DirectSound API calls will have no effect on the captured audio. To learn how to obtain AEC in Windows Vista, See the Windows Vista AEC topics in the Windows SDK. |
Applications should not reset an effect except when necessary because it has entered an incorrect state. This might be done in response to user input. An effect must not be reset arbitrarily at startup, because another application might be using the same effect.
The IDirectSoundFXParamEq8 interface is used to set and retrieve effect parameters on a buffer that supports parametric equalizer effects.
In addition to the methods inherited from
Method | Description |
---|---|
IDirectSoundFXParamEq8::GetAllParameters | The GetAllParameters method retrieves the parametric equalizer parameters of a buffer. |
IDirectSoundFXParamEq8::SetAllParameters | The SetAllParameters method sets the parametric equalizer parameters of a buffer. |
If the method succeeds, the return value is DS_OK or S_FALSE. See the Remarks for
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
The
The
To obtain the interface, use the CreateSoundBuffer method to retrieve
For the primary buffer, you must use the
Not all methods of
In addition to the methods inherited from
Method | Description |
---|---|
The GetObjectInPath method retrieves an interface for an effect object associated with the buffer. | |
Number of elements in the pDSFXDesc and pdwResultCodes arrays. If this value is 0, pDSFXDesc and pdwResultCodes must both be |
Method | Description |
---|---|
The AcquireResources method allocates resources for a buffer that was created with the | |
IDirectSoundBuffer8::Restore | The Restore method restores the memory allocation for a lost sound buffer. |
Method | Description |
---|---|
IDirectSoundBuffer8::GetCurrentPosition | The GetCurrentPosition method retrieves the position of the play and write cursors in the sound buffer. |
IDirectSoundBuffer8::Lock | The Lock method readies all or part of the buffer for a data write and returns references to which data can be written. |
IDirectSoundBuffer8::Play | The Play method causes the sound buffer to play, starting at the play cursor. |
IDirectSoundBuffer8::SetCurrentPosition | The SetCurrentPosition method sets the position of the play cursor, which is the point at which the next byte of data is read from the buffer. |
IDirectSoundBuffer8::Stop | The Stop method causes the sound buffer to stop playing. |
IDirectSoundBuffer8::Unlock | The Unlock method releases a locked sound buffer. |
Method | Description |
---|---|
IDirectSoundBuffer8::GetFrequency | The GetFrequency method retrieves the frequency, in samples per second, at which the buffer is playing. |
IDirectSoundBuffer8::GetPan | The GetPan method retrieves the relative volume of the left and right audio channels. |
IDirectSoundBuffer8::GetVolume | The GetVolume method retrieves the attenuation of the sound. |
IDirectSoundBuffer8::SetFrequency | The SetFrequency method sets the frequency at which the audio samples are played. |
IDirectSoundBuffer8::SetPan | The SetPan method sets the relative volume of the left and right channels. |
IDirectSoundBuffer8::SetVolume | The SetVolume method sets the attenuation of the sound. |
Method | Description |
---|---|
IDirectSoundBuffer8::GetCaps | The GetCaps method retrieves the capabilities of the buffer object. |
IDirectSoundBuffer8::GetFormat | The GetFormat method retrieves a description of the format of the sound data in the buffer, or the buffer size needed to retrieve the format description. |
IDirectSoundBuffer8::GetStatus | The GetStatus method retrieves the status of the sound buffer. |
IDirectSoundBuffer8::Initialize | The Initialize method initializes a sound buffer object if it has not yet been initialized. |
IDirectSoundBuffer8::SetFormat | The SetFormat method sets the format of the primary buffer. Whenever this application has the input focus, DirectSound will set the primary buffer to the specified format. |
The LPDIRECTSOUNDBUFFER8 type is defined as a reference to the
typedef struct*LPDIRECTSOUNDBUFFER8;
For this method to succeed, CoInitialize must have been called. Additionally, the buffer must not be playing or locked.
Note |
---|
This parameter must be |
Value | Description |
---|---|
Effect is instantiated in hardware. | |
Effect is instantiated in software. | |
Effect has not yet been assigned to hardware or software. This value is returned if the buffer was created with the | |
No effect was created because resources weren't available. | |
Effect is available but was not created because one of the other effects requested could not be created. If any of the effects requested cannot be created, none of them are, and the call fails. | |
Effect is not registered on the system, and the method failed as a result. |
If the method succeeds, the return value is DS_OK or DS_INCOMPLETE. If the method fails, the return value may be one of the error values shown in the following table.
Return code |
---|
CO_E_NOTINITIALIZED |
DSERR_CONTROLUNAVAIL |
DSERR_GENERIC |
DSERR_INVALIDPARAM |
DSERR_INVALIDCALL |
DSERR_NOINTERFACE |
DSERR_PRIOLEVELNEEDED |
In addition, the method can return an error value from DMO methods, including
If the method fails, the value for each effect in pdwResultCodes is either DSFXF_PRESENT or
For the method to succeed, the buffer must have been created with the
If the method returns DSERR_NOINTERFACE or another COM error, check the result code array for
An effect must be set on a buffer before the effect interface can be obtained. To obtain the effect interface, use GetObjectInPath.
If the method succeeds, the return value is DS_OK or DS_INCOMPLETE. If the method fails, the return value may be one of the error values shown in the following table.
Return code |
---|
DSERR_CONTROLUNAVAIL |
DSERR_INVALIDCALL |
DSERR_INVALIDPARAM |
Normally, buffers created with
A buffer with acquired resources that is not yet playing is not a candidate for premature termination by the voice management flags passed to the Play method.
Resources that have been acquired by AcquireResources are released when playback is stopped.
If the method is called on a buffer on which it has already been called, the status of the effects is returned but no additional resources are allocated.
The dwEffectsCount parameter to this function must be the same as the one passed in the call to SetFX.
If an attempt is made to acquire resources for a buffer with the
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following error values:
Return code |
DSERR_CONTROLUNAVAIL |
DSERR_INVALIDPARAM |
DSERR_OBJECTNOTFOUND |
Any DMO that has been set on a buffer by using SetFX can be retrieved, even it has not been allocated resources.
The following interfaces can be retrieved for the various DMOs supplied with DirectX.
rguidInterface | *ppObject |
IID_IDirectSoundFXGargle8 | IDirectSoundFXGargle8 |
IID_IDirectSoundFXChorus8 | IDirectSoundFXChorus8 |
IID_IDirectSoundFXFlanger8 | IDirectSoundFXFlanger8 |
IID_IDirectSoundFXEcho8 | IDirectSoundFXEcho8 |
IID_IDirectSoundFXDistortion8 | IDirectSoundFXDistortion8 |
IID_IDirectSoundFXCompressor8 | IDirectSoundFXCompressor8 |
IID_IDirectSoundFXParamEq8 | IDirectSoundFXParamEq8 |
IID_IDirectSoundFXWavesReverb8 | IDirectSoundFXWavesReverb8 |
IID_IDirectSoundFXI3DL2Reverb8 | IDirectSoundFXI3DL2Reverb8 |
In addition, the following interfaces are available for any of the standard DMOs. For information on these interfaces, see the Help for DirectX Media Objects.
rguidInterface | *ppObject |
IID_IMediaObject | |
IID_IMediaObjectInPlace | |
IID_IMediaParams | IMediaParams |
NoteWhen the DirectSound API is used to play buffers, parameter curves (envelopes) set by using the IMediaParams interface do not work, because DirectSound does not timestamp the DMO buffers.
The value in dwIndex is the index of the object within the array of effects passed to SetFX. This is not necessarily the actual position of the object in the effects chain, because some effects might not have been created.
An object is returned solely on the basis of whether it matches rguidObject and dwIndex. It is up to the application to ensure that rguidInterface specifies an interface that can be expected to be found on the object.
The
The
To obtain the interface, use the CreateSoundBuffer method to retrieve
For the primary buffer, you must use the
Not all methods of
In addition to the methods inherited from
Method | Description |
---|---|
The GetObjectInPath method retrieves an interface for an effect object associated with the buffer. | |
Number of elements in the pDSFXDesc and pdwResultCodes arrays. If this value is 0, pDSFXDesc and pdwResultCodes must both be |
Method | Description |
---|---|
The AcquireResources method allocates resources for a buffer that was created with the | |
IDirectSoundBuffer8::Restore | The Restore method restores the memory allocation for a lost sound buffer. |
Method | Description |
---|---|
IDirectSoundBuffer8::GetCurrentPosition | The GetCurrentPosition method retrieves the position of the play and write cursors in the sound buffer. |
IDirectSoundBuffer8::Lock | The Lock method readies all or part of the buffer for a data write and returns references to which data can be written. |
IDirectSoundBuffer8::Play | The Play method causes the sound buffer to play, starting at the play cursor. |
IDirectSoundBuffer8::SetCurrentPosition | The SetCurrentPosition method sets the position of the play cursor, which is the point at which the next byte of data is read from the buffer. |
IDirectSoundBuffer8::Stop | The Stop method causes the sound buffer to stop playing. |
IDirectSoundBuffer8::Unlock | The Unlock method releases a locked sound buffer. |
Method | Description |
---|---|
IDirectSoundBuffer8::GetFrequency | The GetFrequency method retrieves the frequency, in samples per second, at which the buffer is playing. |
IDirectSoundBuffer8::GetPan | The GetPan method retrieves the relative volume of the left and right audio channels. |
IDirectSoundBuffer8::GetVolume | The GetVolume method retrieves the attenuation of the sound. |
IDirectSoundBuffer8::SetFrequency | The SetFrequency method sets the frequency at which the audio samples are played. |
IDirectSoundBuffer8::SetPan | The SetPan method sets the relative volume of the left and right channels. |
IDirectSoundBuffer8::SetVolume | The SetVolume method sets the attenuation of the sound. |
Method | Description |
---|---|
IDirectSoundBuffer8::GetCaps | The GetCaps method retrieves the capabilities of the buffer object. |
IDirectSoundBuffer8::GetFormat | The GetFormat method retrieves a description of the format of the sound data in the buffer, or the buffer size needed to retrieve the format description. |
IDirectSoundBuffer8::GetStatus | The GetStatus method retrieves the status of the sound buffer. |
IDirectSoundBuffer8::Initialize | The Initialize method initializes a sound buffer object if it has not yet been initialized. |
IDirectSoundBuffer8::SetFormat | The SetFormat method sets the format of the primary buffer. Whenever this application has the input focus, DirectSound will set the primary buffer to the specified format. |
The LPDIRECTSOUNDBUFFER8 type is defined as a reference to the
typedef struct*LPDIRECTSOUNDBUFFER8;
The
The flags specified in the dwFlags member of the
The return value is between
The returned value is measured in hundredths of a decibel (dB), in the range of DSBPAN_LEFT to DSBPAN_RIGHT. These values are defined in Dsound.h as -10,000 and 10,000 respectively. The value DSBPAN_LEFT means the right channel is effectively silent. The value DSBPAN_RIGHT means the left channel is effectively silent. The neutral value is DSBPAN_CENTER, defined as 0, which means that both channels are at full volume. When one channel is attenuated, the other remains at full volume.
The pan control acts cumulatively with the volume control.
The frequency value for software buffers is in the range of DSBFREQUENCY_MIN to DSBFREQUENCY_MAX, defined in Dsound.h. Hardware buffers can return other values.
This method cannot be called on the primary buffer.
If the buffer is playing, the cursor immediately moves to the new position and play continues from that point. If it is not playing, playback will begin from the new position the next time the Play method is called.
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
The
The flags specified in the dwFlags member of the
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following error values:
Return code |
DSERR_INVALIDPARAM |
DSERR_PRIOLEVELNEEDED |
The write cursor is the point in the buffer ahead of which it is safe to write data to the buffer. Data should not be written to the part of the buffer after the play cursor and before the write cursor.
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
The format structure can have a variable length that depends on the format. Before retrieving the format description, the application should query the buffer object for the size of the format by calling this method and specifying
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following error values:
Return code |
DSERR_CONTROLUNAVAIL |
DSERR_INVALIDPARAM |
DSERR_PRIOLEVELNEEDED |
The return value is between
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following error values:
Return code |
DSERR_CONTROLUNAVAIL |
DSERR_INVALIDPARAM |
DSERR_PRIOLEVELNEEDED |
The returned value is measured in hundredths of a decibel (dB), in the range of DSBPAN_LEFT to DSBPAN_RIGHT. These values are defined in Dsound.h as -10,000 and 10,000 respectively. The value DSBPAN_LEFT means the right channel is effectively silent. The value DSBPAN_RIGHT means the left channel is effectively silent. The neutral value is DSBPAN_CENTER, defined as 0, which means that both channels are at full volume. When one channel is attenuated, the other remains at full volume.
The pan control acts cumulatively with the volume control.
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following error values:
Return code |
DSERR_CONTROLUNAVAIL |
DSERR_INVALIDPARAM |
DSERR_PRIOLEVELNEEDED |
The frequency value for software buffers is in the range of DSBFREQUENCY_MIN to DSBFREQUENCY_MAX, defined in Dsound.h. Hardware buffers can return other values.
Value | Description |
The buffer is lost and must be restored before it can be played or locked. | |
The buffer is being looped. If this value is not set, the buffer will stop when it reaches the end of the sound data. This value is returned only in combination with | |
The buffer is playing. If this value is not set, the buffer is stopped. | |
The buffer is playing in software. Set only for buffers created with the | |
The buffer is playing in hardware. Set only for buffers created with the | |
The buffer was prematurely terminated by the voice manager and is not playing. Set only for buffers created with the |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following error values.
Return code |
DSERR_INVALIDPARAM |
DSERR_ALREADYINITIALIZED |
Because the CreateSoundBuffer method calls Initialize internally, applications do not need to call this method.
Value | Description |
Start the lock at the write cursor. The dwOffset parameter is ignored. | |
Lock the entire buffer. The dwBytes parameter is ignored. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following error values:
Return code |
DSERR_BUFFERLOST |
DSERR_INVALIDCALL |
DSERR_INVALIDPARAM |
DSERR_PRIOLEVELNEEDED |
This method accepts an offset and a byte count, and returns two write references and their associated sizes. If the locked portion does not extend to the end of the buffer and wrap to the beginning, the second reference, ppvAudioBytes2, receives
If the application passes
After writing data to the references returned by this method, the application must immediately call Unlock to notify DirectSound that the data is ready for playback. Failure to do so can cause audio breakup or silence on some sound device configurations.
This method returns write references only. The application should not try to read sound data from this reference, because the data might not be valid. For example, if the buffer is located in on-card memory, the reference might be an address to a temporary buffer in system memory. When IDirectSoundBuffer8::Unlock is called, the contents of this temporary buffer are transferred to the on-card memory.
Looping flag
Value | Description |
After the end of the audio buffer is reached, play restarts at the beginning of the buffer. Play continues until explicitly stopped. This flag must be set when playing a primary buffer. |
Voice allocation flags
The voice allocation flags are valid only for buffers created with the
Value | Description |
Play this voice in a hardware buffer only. If the hardware has no available voices and no voice management flags are set, the call to IDirectSoundBuffer8::Play fails. This flag cannot be combined with | |
Play this voice in a software buffer only. This flag cannot be combined with |
Voice management flags
The voice management flags are valid only for buffers created with the
Value | Description |
If the hardware has no available voices, a currently playing nonlooping buffer will be stopped to make room for the new buffer. The buffer prematurely terminated is the one with the least time left to play. | |
If the hardware has no available voices, a currently playing buffer will be stopped to make room for the new buffer. The buffer prematurely terminated will be selected from buffers that have the buffer's DSBCAPS_ MUTE3DATMAXDISTANCE flag set and are beyond their maximum distance. If there are no such buffers, the method fails. | |
If the hardware has no available voices, a currently playing buffer will be stopped to make room for the new buffer. The buffer prematurely terminated will be the one with the lowest priority as set by the dwPriority parameter passed to IDirectSoundBuffer8::Play for the buffer. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following error values:
Return code |
DSERR_BUFFERLOST |
DSERR_INVALIDCALL |
DSERR_INVALIDPARAM |
DSERR_PRIOLEVELNEEDED |
If SetCooperativeLevel has not been called, the method returns DS_OK, but no sound will be produced until a cooperative level has been set.
If the application is multithreaded, the thread that plays the buffer must continue to exist as long as the buffer is playing. Buffers created on WDM drivers stop playing when the thread is terminated.
If the buffer specified in the method is already playing, the call to the method succeeds and the buffer continues to play. However, the flags defined in the most recent call supersede flags defined in previous calls.
When called on the primary buffer, this method causes the buffer to start playing to the sound device. If the application has set the
If the method is called with a voice allocation or voice management flag set on a buffer that was not created with the
The following table shows the behavior of the method under various combinations of the voice allocation and voice management flags when no free hardware voices are available.
Neither | |||
Sound with least time left to play is terminated and the new sound plays on the released voice. | Sound with least time left to play is terminated and the new sound plays on the released voice. | New sound plays in software. | |
If any sounds currently playing in hardware are beyond their maximum distance and have the | If any sounds currently playing in hardware are beyond their maximum distance and have the | New sound plays in software. | |
If the new sound's priority is higher than or equal to that of any sound currently playing in hardware, one of the lowest-priority sounds is terminated and the new sound plays in hardware. Otherwise, the call fails. | If the new sound's priority is higher than or equal to that of any sound currently playing in hardware, one of the lowest-priority sounds is terminated and the new sound plays in hardware. Otherwise, the new sound plays in software. | New sound plays in software. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following error values:
Return code |
DSERR_INVALIDCALL |
DSERR_INVALIDPARAM |
DSERR_PRIOLEVELNEEDED |
This method cannot be called on the primary buffer.
If the buffer is playing, the cursor immediately moves to the new position and play continues from that point. If it is not playing, playback will begin from the new position the next time the Play method is called.
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following error values:
Return code |
DSERR_BADFORMAT |
DSERR_INVALIDCALL |
DSERR_INVALIDPARAM |
DSERR_OUTOFMEMORY |
DSERR_PRIOLEVELNEEDED |
DSERR_UNSUPPORTED |
The format of the primary buffer should be set before secondary buffers are created.
The method fails if the application has the
If the application is using DirectSound at the
If the cooperative level is
This method is not available for secondary sound buffers. If a new format is required, the application must create a new DirectSoundBuffer object.
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following error values:
Return code |
DSERR_CONTROLUNAVAIL |
DSERR_GENERIC |
DSERR_INVALIDPARAM |
DSERR_PRIOLEVELNEEDED |
Allowable values are between
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following error values:
Return code |
DSERR_CONTROLUNAVAIL |
DSERR_GENERIC |
DSERR_INVALIDPARAM |
DSERR_PRIOLEVELNEEDED |
The returned value is measured in hundredths of a decibel (dB), in the range of DSBPAN_LEFT to DSBPAN_RIGHT. These values are defined in Dsound.h as -10,000 and 10,000 respectively. The value DSBPAN_LEFT means the right channel is attenuated by 100 dB and is effectively silent. The value DSBPAN_RIGHT means the left channel is silent. The neutral value is DSBPAN_CENTER, defined as 0, which means that both channels are at full volume. When one channel is attenuated, the other remains at full volume.
The pan control acts cumulatively with the volume control.
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following error values:
Return code |
DSERR_CONTROLUNAVAIL |
DSERR_GENERIC |
DSERR_INVALIDPARAM |
DSERR_PRIOLEVELNEEDED |
Increasing or decreasing the frequency changes the perceived pitch of the audio data. This method does not affect the format of the buffer.
Before setting the frequency, you should ascertain whether the frequency is supported by checking the dwMinSecondarySampleRate and dwMaxSecondarySampleRate members of the
This method is not valid for the primary buffer.
If the method succeeds, the return value is DS_OK. Returns an error code if the method fails.
For secondary sound buffers, IDirectSoundBuffer8::Stop sets the play cursor to the sample that follows the last sample played. This means that when the Play method is next called on the buffer, it will continue playing where it left off.
For the primary buffer, if an application has the
However, if IDirectSoundBuffer8::Stop is called on a primary buffer and the application has a cooperative level other than
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following error values:
Return code |
DSERR_INVALIDCALL |
DSERR_INVALIDPARAM |
DSERR_PRIOLEVELNEEDED |
An application must pass both references, pvAudioPtr1 and pvAudioPtr2, returned by the IDirectSoundBuffer8::Lock method to ensure the correct pairing of IDirectSoundBuffer8::Lock and IDirectSoundBuffer8::Unlock. The second reference is needed even if nothing was written to the second reference.
The values in dwAudioBytes1 and dwAudioBytes2 must specify the number of bytes actually written to each part of the buffer, which might be less than the size of the lock. DirectSound uses these values to determine how much data to commit to the device.
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following error values:
Return code
DSERR_BUFFERLOST
DSERR_INVALIDCALL
DSERR_PRIOLEVELNEEDED
If the application does not have the input focus, IDirectSoundBuffer8::Restore might not succeed. For example, if the application with the input focus has the
After DirectSound restores the buffer memory, the application must rewrite the buffer with valid sound data. DirectSound cannot restore the contents of the memory, only the memory itself.
The application can receive notification that a buffer is lost when it specifies that buffer in a call to the Lock or Play method. These methods return DSERR_BUFFERLOST to indicate a lost buffer. The GetStatus method can also be used to retrieve the status of the sound buffer and test for the
The IDirectSound3DBuffer8 interface is used to retrieve and set parameters that describe the position, orientation, and environment of a sound buffer in 3D space.
IDirectSound3DBuffer8 is a define for
The IDirectSound3DBuffer8 interface is obtained from a buffer that was created with the
In addition to the methods inherited from
Method | Description |
---|---|
IDirectSound3DBuffer8::GetMode | The GetMode method retrieves the operation mode for 3D sound processing. |
IDirectSound3DBuffer8::SetMode | The SetMode method sets the operation mode for 3D sound processing. |
Method | Description |
---|---|
IDirectSound3DBuffer8::GetAllParameters | The GetAllParameters method retrieves the 3D properties of the sound buffer. |
IDirectSound3DBuffer8::SetAllParameters | The SetAllParameters method sets all 3D sound buffer properties. |
Method | Description |
---|---|
IDirectSound3DBuffer8::GetMaxDistance | The GetMaxDistance method retrieves the maximum distance, which is the distance from the listener beyond which sounds in this buffer are no longer attenuated. |
IDirectSound3DBuffer8::GetMinDistance | The GetMinDistance method retrieves the minimum distance, which is the distance from the listener at which sounds in this buffer begin to be attenuated. |
IDirectSound3DBuffer8::SetMaxDistance | The SetMaxDistance method sets the maximum distance, which is the distance from the listener beyond which sounds in this buffer are no longer attenuated. |
IDirectSound3DBuffer8::SetMinDistance | The SetMinDistance method sets the minimum distance, which is the distance from the listener at which sounds in this buffer begin to be attenuated. |
Method | Description |
---|---|
IDirectSound3DBuffer8::GetPosition | The GetPosition method retrieves the position of the sound source. |
IDirectSound3DBuffer8::SetPosition | The SetPosition method sets the position of the sound source. |
Method | Description |
---|---|
IDirectSound3DBuffer8::GetConeAngles | The GetConeAngles method retrieves the inside and outside angles of the sound projection cone. |
IDirectSound3DBuffer8::GetConeOrientation | The GetConeOrientation method retrieves the orientation of the sound projection cone. |
IDirectSound3DBuffer8::GetConeOutsideVolume | The GetConeOutsideVolume method retrieves the volume of the sound outside the outside angle of the sound projection cone. |
IDirectSound3DBuffer8::SetConeAngles | The SetConeAngles method sets the inside and outside angles of the sound projection cone. |
IDirectSound3DBuffer8::SetConeOrientation | The SetConeOrientation method sets the orientation of the sound projection cone. |
IDirectSound3DBuffer8::SetConeOutsideVolume | The SetConeOutsideVolume method sets the volume of the sound outside the outside angle of the sound projection cone. |
Method | Description |
---|---|
IDirectSound3DBuffer8::GetVelocity | The GetVelocity method retrieves the velocity of the sound source. |
IDirectSound3DBuffer8::SetVelocity | The SetVelocity method sets the velocity of the sound source. |
The LPDIRECTSOUND3DBUFFER type is defined as a reference to the IDirectSound3DBuffer8 interface:
typedef struct*LPDIRECTSOUND3DBUFFER;
If the method succeeds, the return value is DS_OK.
If the method fails, the return value may be DSERR_INVALIDPARAM.
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
The minimum, maximum, and default cone angles are defined in Dsound.h as DS3D_MINCONEANGLE, DS3D_MAXCONEANGLE, and DS3D_DEFAULTCONEANGLE.
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
The values returned are not necessarily the same as those set by using the SetConeOrientation method. DirectSound normalizes orientation vectors so that all axes have a magnitude of less than or equal to 1.0.
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
Volume levels are expressed as attenuation, in hundredths of a decibel. Allowable values are between
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
The default maximum distance, defined as DS3D_DEFAULTMAXDISTANCE, is effectively infinite.
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
By default, the minimum distance value is DS3D_DEFAULTMINDISTANCE, defined as 1.0 (corresponding to 1.0 meter at the default distance factor of 1.0 meters per unit).
Value | Description |
Processing of 3D sound is disabled. The sound seems to originate from the center of the listener's head. | |
Sound parameters (position, velocity, and orientation) are relative to the listener's parameters. In this mode, the absolute parameters of the sound are updated automatically as the listener's parameters change, so that the relative parameters remain constant. | |
Normal processing. This is the default mode. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
By default, distance units are meters, but the units can be changed by using the SetDistanceFactor method.
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
Velocity is used for Doppler effects only. It does not actually move the buffer. For more information, see Doppler Effect.
The default unit of measurement is meters per second, but this can be changed by using the SetDistanceFactor method.
Value | Description |
DS3D_DEFERRED | Settings are not applied until the application calls the CommitDeferredSettings method. This allows the application to change several settings and generate a single recalculation. |
DS3D_IMMEDIATE | Settings are applied immediately, causing the system to recalculate the 3D coordinates for all 3D sound buffers. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
Value | Description |
DS3D_DEFERRED | Settings are not applied until the application calls the CommitDeferredSettings method. This allows the application to change several settings and generate a single recalculation. |
DS3D_IMMEDIATE | Settings are applied immediately, causing the system to recalculate the 3D coordinates for all 3D sound buffers. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
The minimum, maximum, and default cone angles are defined in Dsound.h as DS3D_MINCONEANGLE, DS3D_MAXCONEANGLE, and DS3D_DEFAULTCONEANGLE. Each angle must be in the range of 0 degrees (no cone) to 360 degrees (the full sphere). The default value is 360.
Value | Description |
DS3D_DEFERRED | Settings are not applied until the application calls the CommitDeferredSettings method. This allows the application to change several settings and generate a single recalculation. |
DS3D_IMMEDIATE | Settings are applied immediately, causing the system to recalculate the 3D coordinates for all 3D sound buffers. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
This method has no effect unless the cone angle and cone outside volume have also been set to values other than the default.
Value | Description |
DS3D_DEFERRED | Settings are not applied until the application calls the CommitDeferredSettings method. This allows the application to change several settings and generate a single recalculation. |
DS3D_IMMEDIATE | Settings are applied immediately, causing the system to recalculate the 3D coordinates for all 3D sound buffers. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
Volume levels are represented by attenuation. Allowable values are between
Value | Description |
DS3D_DEFERRED | Settings are not applied until the application calls the CommitDeferredSettings method. This allows the application to change several settings and generate a single recalculation. |
DS3D_IMMEDIATE | Settings are applied immediately, causing the system to recalculate the 3D coordinates for all 3D sound buffers. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
The default maximum distance, defined as DS3D_DEFAULTMAXDISTANCE, is effectively infinite.
The default unit of measurement is meters, but this can be changed by using the SetDistanceFactor method.
Value | Description |
DS3D_DEFERRED | Settings are not applied until the application calls the CommitDeferredSettings method. This allows the application to change several settings and generate a single recalculation. |
DS3D_IMMEDIATE | Settings are applied immediately, causing the system to recalculate the 3D coordinates for all 3D sound buffers. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
By default, the minimum distance value is DS3D_DEFAULTMINDISTANCE, defined as 1.0 (corresponding to 1.0 meter at the default distance factor of 1.0 meters per unit).
The default unit of measurement is meters, but this can be changed by using the SetDistanceFactor method.
Value | Description |
---|---|
Processing of 3D sound is disabled. The sound seems to originate from the center of the listener's head. | |
Sound parameters (position, velocity, and orientation) are relative to the listener's parameters. In this mode, the absolute parameters of the sound are updated automatically as the listener's parameters change, so that the relative parameters remain constant. | |
Normal processing. This is the default mode. |
Value | Description |
---|---|
DS3D_DEFERRED | Settings are not applied until the application calls the CommitDeferredSettings method. This allows the application to change several settings and generate a single recalculation. |
DS3D_IMMEDIATE | Settings are applied immediately, causing the system to recalculate the 3D coordinates for all 3D sound buffers. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
Value | Description |
DS3D_DEFERRED | Settings are not applied until the application calls the CommitDeferredSettings method. This allows the application to change several settings and generate a single recalculation. |
DS3D_IMMEDIATE | Settings are applied immediately, causing the system to recalculate the 3D coordinates for all 3D sound buffers. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
The default unit of measurement is meters, but this can be changed by using the SetDistanceFactor method.
Value | Description |
DS3D_DEFERRED | Settings are not applied until the application calls the CommitDeferredSettings method. This allows the application to change several settings and generate a single recalculation. |
DS3D_IMMEDIATE | Settings are applied immediately, causing the system to recalculate the 3D coordinates for all 3D sound buffers. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
Velocity is used only for calculating Doppler effect. It does not change the position of the buffer. For more information, see Doppler Effect.
The default unit of measurement is meters per second, but this can be changed by using the SetDistanceFactor method.
The IDirectSoundNotify8 interface sets up notification events for a playback or capture buffer.
IDirectSoundNotify8 is a define for
The interface is obtained by calling the QueryInterface method of an existing interface on a DirectSound buffer object. Secondary buffers support notifications only if they are created with the
In addition to the methods inherited from
Method | Description |
---|---|
IDirectSoundNotify8::SetNotificationPositions | The SetNotificationPositions method sets the notification positions. During capture or playback, whenever the read or play cursor reaches one of the specified offsets, the associated event is signaled. |
The LPDIRECTSOUNDNOTIFY type is defined as a reference to the
typedef struct*LPDIRECTSOUNDNOTIFY;
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be one of the following error values:
Return code |
DSERR_INVALIDPARAM |
DSERR_OUTOFMEMORY |
The value DSBPN_OFFSETSTOP can be specified in the dwOffset member to tell DirectSound to signal the associated event when the Stop or Stop method is called or when the end of the buffer has been reached and the playback is not looping. If it is used, this should be the last item in the position-notify array.
If a position-notify array has already been set, the method replaces the previous array.
The buffer must be stopped when this method is called.
The IDirectSound3DListener8 interface is used to retrieve and set parameters that describe a listener's position, orientation, and listening environment in 3D space.
The interface can be obtained by calling the IDirectSoundBuffer8::QueryInterface method on a primary buffer created with the
In addition to the methods inherited from
Method | Description |
---|---|
IDirectSound3DListener8::CommitDeferredSettings | The CommitDeferredSettings method commits any deferred settings made since the last call to this method. |
IDirectSound3DListener8::GetAllParameters | The GetAllParameters method retrieves all 3D parameters of the sound environment and the listener. |
IDirectSound3DListener8::SetAllParameters | The SetAllParameters method sets all 3D parameters of the sound environment and the listener. |
Method | Description |
---|---|
IDirectSound3DListener8::GetDistanceFactor | The GetDistanceFactor method retrieves the distance factor, which is the number of meters in a vector unit. |
IDirectSound3DListener8::GetDopplerFactor | The GetDopplerFactor method retrieves the multiplier for the Doppler effect. |
IDirectSound3DListener8::GetRolloffFactor | The GetRolloffFactor method retrieves the rolloff factor, which determines the rate of attenuation over distance. |
IDirectSound3DListener8::SetDistanceFactor | The SetDistanceFactor method sets the distance factor, which is the number of meters in a vector unit. |
IDirectSound3DListener8::SetDopplerFactor | The SetDopplerFactor method sets the multiplier for the Doppler effect. |
IDirectSound3DListener8::SetRolloffFactor | The SetRolloffFactor method sets the rolloff factor, which determines the rate of attenuation over distance. |
Method | Description |
---|---|
IDirectSound3DListener8::GetOrientation | The GetOrientation method retrieves the orientation of the listener's head. |
IDirectSound3DListener8::GetPosition | The GetPosition method retrieves the listener's position. |
IDirectSound3DListener8::GetVelocity | The GetVelocity method retrieves the listener's velocity. |
IDirectSound3DListener8::SetOrientation | The SetOrientation method sets the orientation of the listener's head. |
IDirectSound3DListener8::SetPosition | The SetPosition method sets the listener's position. |
IDirectSound3DListener8::SetVelocity | The SetVelocity method sets the listener's velocity. |
The LPDIRECTSOUND3DLISTENER type is defined as a reference to the
typedef struct*LPDIRECTSOUND3DLISTENER;
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
The Doppler factor has a range of DS3D_MINDOPPLERFACTOR (no Doppler effects) to DS3D_MAXDOPPLERFACTOR (defined as 10 times the Doppler effects found in the real world). The default value is DS3D_DEFAULTDOPPLERFACTOR (1.0).
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
The front vector points in the direction of the listener's nose, and the top vector points up from the top of the listener's head. By default, the front vector is (0,0,1.0) and the top vector is (0,1.0,0).
The values returned are not necessarily the same as those set by using SetOrientation. DirectSound normalizes orientation vectors so that they are at right angles and have a magnitude of less than or equal to 1.0.
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
By default, measurement units are meters, but this can be changed by calling the SetDistanceFactor method.
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
The rolloff factor has a range of DS3D_MINROLLOFFFACTOR (no rolloff) to DS3D_MAXROLLOFFFACTOR (defined as 10 times the rolloff found in the real world). The default value is DS3D_DEFAULTROLLOFFFACTOR (1.0). For more information, see Rolloff Factor.
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
Velocity is used only for calculating Doppler effect. It does not change the listener's position. To move the listener, use the SetPosition method.
The default velocity is (0,0,0).
By default, measurement units are meters per second, but this can be changed by calling the SetDistanceFactor method.
Value | Description |
DS3D_DEFERRED | Settings are not applied until the application calls the CommitDeferredSettings method. This allows the application to change several settings and generate a single recalculation. |
DS3D_IMMEDIATE | Settings are applied immediately, causing the system to recalculate the 3D coordinates for all 3D sound buffers. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
Value | Description |
DS3D_DEFERRED | Settings are not applied until the application calls the CommitDeferredSettings method. This allows the application to change several settings and generate a single recalculation. |
DS3D_IMMEDIATE | Settings are applied immediately, causing the system to recalculate the 3D coordinates for all 3D sound buffers. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
The distance factor has a range of DS3D_MINDISTANCEFACTOR to DS3D_MAXDISTANCEFACTOR, defined in Dsound.h as FLT_MIN and FLT_MAX respectively. The default value is DS3D_DEFAULTDISTANCEFACTOR, or 1.0.
Value | Description |
DS3D_DEFERRED | Settings are not applied until the application calls the CommitDeferredSettings method. This allows the application to change several settings and generate a single recalculation. |
DS3D_IMMEDIATE | Settings are applied immediately, causing the system to recalculate the 3D coordinates for all 3D sound buffers. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
The Doppler factor has a range of DS3D_MINDOPPLERFACTOR (no Doppler effects) to DS3D_MAXDOPPLERFACTOR (defined as 10 times the Doppler effects found in the real world). The default value is DS3D_DEFAULTDOPPLERFACTOR (1.0).
Value | Description |
DS3D_DEFERRED | Settings are not applied until the application calls the CommitDeferredSettings method. This allows the application to change several settings and generate a single recalculation. |
DS3D_IMMEDIATE | Settings are applied immediately, causing the system to recalculate the 3D coordinates for all 3D sound buffers. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
The front vector points in the direction of the listener's nose, and the top vector points up from the top of the listener's head. By default, the front vector is (0,0,1.0) and the top vector is (0,1.0,0).
The top vector must be at right angles to the front vector. If necessary, DirectSound adjusts the top vector after setting the front vector.
Value | Description |
DS3D_DEFERRED | Settings are not applied until the application calls the CommitDeferredSettings method. This allows the application to change several settings and generate a single recalculation. |
DS3D_IMMEDIATE | Settings are applied immediately, causing the system to recalculate the 3D coordinates for all 3D sound buffers. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
By default, measurement units are meters, but this can be changed by calling the SetDistanceFactor method.
Value | Description |
DS3D_DEFERRED | Settings are not applied until the application calls the CommitDeferredSettings method. This allows the application to change several settings and generate a single recalculation. |
DS3D_IMMEDIATE | Settings are applied immediately, causing the system to recalculate the 3D coordinates for all 3D sound buffers. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
The rolloff factor has a range of DS3D_MINROLLOFFFACTOR (no rolloff) to DS3D_MAXROLLOFFFACTOR (defined as 10 times the rolloff found in the real world). The default value is DS3D_DEFAULTROLLOFFFACTOR (1.0). For more information, see Rolloff Factor.
Value | Description |
DS3D_DEFERRED | Settings are not applied until the application calls the CommitDeferredSettings method. This allows the application to change several settings and generate a single recalculation. |
DS3D_IMMEDIATE | Settings are applied immediately, causing the system to recalculate the 3D coordinates for all 3D sound buffers. |
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
Velocity is used only for Doppler effects. It does not actually move the listener. To change the listener's position, use the SetPosition method. The default velocity is (0,0,0).
By default, measurement units are meters per second, but this can be changed by calling the SetDistanceFactor method.
If the method succeeds, the return value is DS_OK.
The IDirectSoundFXWavesReverb8 interface is used to set and retrieve effect parameters on a buffer that supports Waves reverberation.
This interface is obtained by calling GetObjectInPath on the buffer that supports the effect.
In addition to the methods inherited from
Method | Description |
---|---|
IDirectSoundFXWavesReverb8::GetAllParameters | The GetAllParameters method retrieves the music reverberation parameters of a buffer. |
IDirectSoundFXWavesReverb8::SetAllParameters | The SetAllParameters method sets the music reverberation parameters of a buffer. |
The Waves reverberation DMO is based on the Waves MaxxVerb technology, which is licenced to Microsoft.
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
If the method succeeds, the return value is DS_OK. If the method fails, the return value may be DSERR_INVALIDPARAM.
The dwMode member is ignored when this structure is passed to IDirectSoundCaptureFXAec8::SetAllParameters.
Windows |
---|
Important Note for Windows Vista Existing applications that access Windows XP Acoustic Echo Cancellation (AEC) features via the DirectSound API will no longer obtain AEC when running on Windows Vista. These applications will still run, but their calls to AEC-specific DirectSound API calls will have no effect on the captured audio. To learn how to obtain AEC in Windows Vista, See the Windows Vista AEC topics in the Windows SDK. |
Value | Description |
---|---|
The effect is passing capture and render data through without modifying it. | |
The effect is running in half duplex mode. Not presently supported. | |
The effect is running in full duplex mode. |
Value |
---|
DSFXCHORUS_PHASE_NEG_180 |
DSFXCHORUS_PHASE_NEG_90 |
DSFXCHORUS_PHASE_ZERO |
DSFXCHORUS_PHASE_90 |
DSFXCHORUS_PHASE_180 |
The default value is DSFXCHORUS_PHASE_90.
The values in fPostEQBandwidth, fPostEQCenterFrequency, and fPreLowpassCutoff cannot exceed one-third of the frequency of the buffer. If an attempt is made to set a value greater than this, but within the range of accepted values, the parameter is set to the nearest supported value and S_FALSE is returned by IDirectSoundFXDistortion8::SetAllParameters.
Value | Description |
---|---|
DSFXFLANGER_WAVE_TRIANGLE | Triangle. |
DSFXFLANGER_WAVE_SIN | Sine. |
Value |
---|
DSFXFLANGER_PHASE_NEG_180 |
DSFXFLANGER_PHASE_NEG_90 |
DSFXFLANGER_PHASE_ZERO |
DSFXFLANGER_PHASE_90 |
DSFXFLANGER_PHASE_180 |
The default value is DSFXFLANGER_PHASE_ZERO.
Value | Description |
---|---|
DSFXGARGLE_WAVE_TRIANGLE | Triangular waveform. |
DSFXGARGLE_WAVE_SQUARE | Square waveform. |
The default value is DSFXGARGLE_WAVE_TRIANGLE.
Windows |
---|
Important Note for Windows Vista Existing applications that access Windows XP Acoustic Echo Cancellation (AEC) features via the DirectSound API will no longer obtain AEC when running on Windows Vista. These applications will still run, but their calls to AEC-specific DirectSound API calls will have no effect on the captured audio. To learn how to obtain AEC in Windows Vista, See the Windows Vista AEC topics in the Windows SDK. |
The value in fCenter cannot exceed one-third of the sampling frequency of the buffer. If an attempt is made to set a value greater than this, but within the range of accepted values, the parameter is set to the nearest supported value and S_FALSE is returned by IDirectSoundFXParamEq8::SetAllParameters.
An earlier version of this structure, DSBUFFERDESC1, is maintained in Dsound.h for compatibility with DirectX 7 and earlier.
When creating a primary buffer, applications must set the dwBufferBytes member to zero. DirectSound will determine the best buffer size for the particular sound device in use. To determine the size of a created primary buffer, call IDirectSoundBuffer8::GetCaps.
The DSBCAPS_CTRLDEFAULT flag is no longer supported. This flag was defined as
On VXD drivers, a sound buffer created with
The
The 3D algorithms represent selection of the software emulation layer only: that is, the software algorithm that is used when no hardware is present for acceleration. In order to maximize hardware utilization,
If a free hardware 3D voice is available, that 3D hardware voice is used.
If no free hardware 3D voices are available and a 2D hardware voice is available, that 2D hardware voice will be used. This is possible because the
If no free 2D or 3D hardware voices are available, the voice will be played in software using the
If a speaker configuration other than
If a buffer is created using one of the HRTF algorithms, and the HRTF algorithm is not available on the system (for example, a non-WDM system), a success code, DS_NO_VIRTUALIZATION, is returned. The sound buffer created will use
Custom effects can be implemented as DMOs. Effect DMOs must implement the
If dwFlags is zero, the effect is placed in hardware if possible. If the hardware does not support the effect (always the case since DirectX 9.0), software is used. If the effect is not available at all, the call to SetFX fails.
Value | Description |
---|---|
DSFX_LOCHARDWARE | Effect must be in hardware. If the effect is not available in hardware, |
DSFX_LOCSOFTWARE | Effect must be in software, even if the hardware supports acceleration of guidDSFXClass. If the effect is not available in software, SetFX raises an error. Since DirectX 9.0, all effects are in software regardless of whether this flag is set. |
Value | Description |
---|---|
Chorus | |
Compressor | |
Distortion | |
Echo | |
Flanger | |
Gargle | |
Interactive 3D Level 2 reverb | |
Parametric equalizer | |
Waves reverb |