Direct Sound Interfaces

Created by Jijith Nadumuri at 28 Apr 2010 12:17 and updated at 28 Apr 2010 12:52

DirectSound Interfaces

DirectSound is on of the audio APIs of DirectX, the other one being DirectMusic. DirectSound and DirectMusic are separate components of DirectX with some overlapping functionality. Both play WAV sounds, and DirectMusic ultimately synthesizes all sounds into waveforms that are played through DirectSound buffers.

DirectSound is the API of choice for scenarios that require low-level management of hardware resources, such as games with many short sounds that must be played with the lowest possible latency and use of system resources.

Root Interfaces

IDirectSound8

IDirectSound8 is one of the root interfaces of DirectSound (others being IDirectSoundCapture8 and IDirectSoundFullDuplex8). It represents the sound playback (sound rendering) capability of the audio device (sound card). It is used to create sound buffer objects, manage sound devices, and set up the environment.

Creation methods:-

DirectSoundCreate8 Creates only a IDirectSound8 object

DirectSoundFullDuplexCreate8 Creates objects for sound capturing and full duplexing also, along with the IDirectSound8 object, to support full duplex mode of sound (both sound playback and sound capture.)

IDirectSoundCapture8

IDirectSoundCapture8 is one of the root interfaces of DirectSound. It represents the sound capture (sound recording) capability of the audio device (sound card). This interface is used to create sound capture buffers.

Creation methods:-

DirectSoundCaptureCreate8 Creates only IDirectSoundCapture8 object
DirectSoundFullDuplexCreate8 Creates IDirectSoundCapture8 along with IDirectSoundFullDuplex8 object and IDirectSound8 object, to support full duplex mode of sound.
CoCreateInstance Using CLSID_DirectSoundCapture8, the COM class ID of the interface
CoCreateInstanceEx Using CLSID_DirectSoundCapture8, the COM class ID of the interface

IDirectSoundFullDuplex8

IDirectSoundFullDuplex8 is one of the root interfaces of DirectSound. It represents the full duplex (sound rendering and recording) capability of the audio device (sound card).

Creation methods:-

DirectSoundFullDuplexCreate8 IDirectSoundCapture8 and DirectSound8 objects are also is created along with IDirectSoundFullDuplex8 object.
CoCreateInstance Using CLSID_DirectSoundFullDuplex8, the COM class ID of the interface
CoCreateInstanceEx Using CLSID_DirectSoundFullDuplex8, the COM class ID of the interface

Sound Buffer Interfaces

Sound buffers are memory blocks that store sound data, just like a Direct3D Surface stores the graphics data. A primary sound buffer is a buffer that will be rendered by an audio device ( sound card). Sound data in other buffers called secondary buffers are mixed and copyied to the primary buffer for rendering.

IDirectSoundBuffer8

The IDirectSoundBuffer8 interface represnts a sound playback buffer. A playback buffer is used to render (play) a sound as against capturing a sound. The interface IDirectSoundBuffer8 can instanciate only secondary sound buffers. To represent a primary sound buffer you should use an instance of the older interface viz IDirectSoundBuffer.

Creation method:-

IDirectSound8::CreateSoundBuffer

IDirectSound3DBuffer8

The IDirectSound3DBuffer8 interface represnts a 3D sound playback buffer. It is used to render a sound that is locatable in 3D space. Such a sound has got its own position, orientation, and environment in the 3D space.

Creation method:-

There is no creation method. The interface has to be queried using the IUnknown method viz QueryInterface, using the interface ID. Usually, the 3D sound playback buffer interface is queried by an ordinary sound playack buffer object as follows:- IDirectSoundBuffer8::QueryInterface.

IDirectSoundCaptureBuffer8

The IDirectSoundCaptureBuffer8 interface represnts a sound capture buffer. It is used to capture or record a sound from an audio device.

Creation method:-

IDirectSoundCapture8::CreateCaptureBuffer

Other Interfaces

IDirectSound3DListener8

The IDirectSound3DListener8 interface represents a listener of 3D sound. The interface contains parameters that describe a listener's position, orientation, and listening environment in 3D space.

Creation method:-

There is no creation method for this interface. The interface can be obtained by calling the IDirectSoundBuffer::QueryInterface method on a primary buffer.

IDirectSoundNotify8

The IDirectSoundNotify8 interface is used to set a notification event during a sound playback or a sound capture. The event is set to trigger at a specified location in the playback time or in the capture time.

Creation method:-

There is no creation method. The interface has to be queried using the IUnknown method viz QueryInterface, using the interface ID.

IKsPropertySet

The IKsPropertySet interface is used for accessing a set of properties of sound drivers. The properties of a sound driver forms a property set. You can set or get a property onto or from the sound driver. Hardware and filter vendors can define new capabilities as properties, arrange them in property sets, and publish the specification for these property sets.

Note:- The IKsPropertySet interface is part of the WDM KS (Win32 Driver Model Kernel Streaming) architecture.

Creation method:-

There is no creation method. The interface has to be queried using the IUnknown method viz QueryInterface, using the interface ID.

Interfaces for Playback Effects

DirectSound contains 9 interfaces that represents various playback effects like chorus, echo etc. A sound playback buffer can obtain these interfaces by calling IDirectSoundBuffer8::GetObjectInPath, which will take the class ID of the requied playback-effects interface. To set an effect IDirectSoundBuffer8::SetFX method is used.

IDirectSoundFXChorus8

This interface represnts the chorus effect. Chorus is a voice-doubling effect created by echoing the original sound with a slight delay and slightly modulating the delay of the echo.

IDirectSoundFXCompressor8

This interface represnts the compression effect. Compression is a reduction in the fluctuation of a signal above a certain amplitude.

IDirectSoundFXDistortion8

This interface represnts the distortion effect. Distortion is achieved by adding harmonics to the signal in such a way that, as the level increases, the top of the waveform becomes squared off or clipped.
IDirectSoundFXEcho8

This interface represnts the echo effect. An echo effect causes an entire sound to be repeated after a fixed delay.

IDirectSoundFXFlanger8

This interface represnts the flange effect. Flange is an echo effect in which the delay between the original signal and its echo is very short and varies over time. The result is sometimes referred to as a sweeping sound. The term flange originated with the practice of grabbing the flanges of a tape reel to change the speed.

IDirectSoundFXGargle8

This interface represnts the gargle effect. The gargle effect modulates the amplitude of the signal.

IDirectSoundFXParamEq8

This interface represnts the parametric equalizer effect. A parametric equalizer amplifies or attenuates signals of a given frequency. You can have multiple instances of parametric equlaizer effect, with different frequency settings, to produce a combined effect.

IDirectSoundFXI3DL2Reverb8

This interface represents environmental reverberation effect. DirectX provides partial support for environmental reverberation in accordance with the Interactive 3D Audio Level 2 (I3DL2) specification, published by the Interactive Audio Special Interest Group. The DirectX environmental reverb effect is an implementation of the listener properties in the I3DL2 specification. Source properties are not supported.

IDirectSoundFXWavesReverb8

This interface represents a Waves reverberation effect. The Waves reverberation effect is intended for use with music. It is based on the Waves MaxxVerb technology, which is licenced to Microsoft.

Interfaces for Capture Effects

DirectSound contains 2 interfaces that represents the following capture effects viz acoustic echo cancellation (AEC) and noise suppression. A sound capture buffer can obtain these interfaces by calling IDirectSoundCaptureBuffer8::GetObjectInPath, which will take the class ID of the requied capture-effects interface. The effects are set or reset using the interface’s Set method.

IDirectSoundCaptureFXAec8

This interface is used for acoustic echo cancellation effect. Acoustic echo cancellation (AEC) is primarily of interest for applications that use voice communication from one site to another. It prevents the proliferation of echos in the communication channel.

IDirectSoundCaptureFXNoiseSuppress8

This interface is used for noise suppression effect. Noise suppression can be applied only if AEC is also enabled. The noise suppression capture effect removes constant background noise, such as fan noise.

Share:- Facebook

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License