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 |
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 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.
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. |
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, 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 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.
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 |
In Windows Vista and later versions of Windows, SetSpeakerConfig is a NOP. For Windows Vista and later versions, the speaker configuration is a system setting that should not be modified by an application. End users can set the speaker configuration through control panels.
Speaker ConfigurationsThese tables contain the possible speaker configurations.
Value | Description |
---|---|
The audio is played through a speaker arrangement of five surround speakers with a subwoofer. ( | |
The audio is played through a home theater speaker arrangement of five surround speakers with a subwoofer. This value applies to Windows Vista or later. | |
The audio is passed through directly, without being configured for speakers. | |
The audio is played through headphones. | |
The audio is played through a single speaker. | |
The audio is played through quadraphonic speakers. | |
The audio is played through stereo speakers (default value). | |
The audio is played through surround speakers. | |
The audio is played through a wide speaker arrangement of seven surround speakers with a subwoofer. ( | |
The audio is played through a home theater speaker arrangement of seven surround speakers with a subwoofer. This value applies to Windows XP SP2 or later. |
Value | Description |
---|---|
The speakers are directed over an arc of 20 degrees. | |
The speakers are directed over an arc of 10 degrees. | |
The speakers are directed over an arc of 5 degrees. | |
The speakers are directed over an arc of 180 degrees. |
If a geometry value is to be used, it must be packed in a DWORD along with the
lpds->SetSpeakerConfig(DSSPEAKER_COMBINED(, ));
To use #defines implemented in Windows Vista, set the DIRECTSOUND_VERSION to 0x1000 before including dsound.h.
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.
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
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 |
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.
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 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 DSBVOLUME_MAX (no attenuation) and DSBVOLUME_MIN (silence). The default value is DS3D_DEFAULTCONEOUTSIDEVOLUME (no attenuation). These values are defined in Dsound.h. DirectSound does not support amplification.
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.
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.
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 DSBVOLUME_MAX (no attenuation) and DSBVOLUME_MIN (silence). The default value is DS3D_DEFAULTCONEOUTSIDEVOLUME (no attenuation). These values are defined in Dsound.h. DirectSound does not support amplification.
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 |
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.
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 |
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 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
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.
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.
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.
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.
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 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
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_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 DSBVOLUME_MAX (no attenuation) and DSBVOLUME_MIN (silence). These values are defined in Dsound.h as 0 and ?10,000 respectively. The value DSBVOLUME_MAX represents the original, unadjusted volume of the stream. The value DSBVOLUME_MIN indicates an audio volume attenuated by 100 dB, which, for all practical purposes, is silence. DirectSound does not support amplification.
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. 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.
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.
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 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 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.
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