Platform SDK: DirectX |
This section pertains only to DirectX for Visual Basic. See DirectSound C/C++ Tutorials.
The next step is to load the wave into a sound buffer. The secondary buffer is described as it was in Tutorial 1. See Step 2: Load a Wave File into a Buffer. In this case you request DSBCAPS_CTRL3D rather than DSBCAPS_CTRLPAN. Panning, a 2-D effect, is not used in 3-D buffers.
In the following code, adapted from the Tutorial 2 SDK sample, file is the name of a valid wave file.
Dim bufferDesc1 As DSBUFFERDESC Dim waveFormat1 As WAVEFORMATEX bufferDesc1.lFlags = DSBCAPS_CTRL3D Or DSBCAPS_CTRLFREQUENCY _ Or DSBCAPS_CTRLVOLUME Or DSBCAPS_STATIC Set m_dsBuffer(i) = m_ds.CreateSoundBufferFromFile( _ file, bufferDesc1, waveFormat1)
Now create a DirectSound3DBuffer object to encapsulate the 3-D properties of the sound buffer.
Set m_ds3dBuffer(i) = m_dsBuffer(i).GetDirectSound3DBuffer