Step 2: Retrieve the Buffer

DirectMusic

Microsoft DirectX 9.0 SDK Update (Summer 2004)

Step 2: Retrieve the Buffer

By using the IDirectMusicAudioPath8::GetObjectInPath method, you can retrieve interfaces to objects that form part of the path. In the case of the DMUS_APATH_DYNAMIC_3D standard audiopath type, such objects could include the secondary buffer itself, the primary buffer, the DirectSound listener, or any DMOs set on buffers after the audiopath was created. The tutorial sample obtains the IDirectSound3DBuffer8 interface to the buffer:

IDirectSound3DBuffer8* pDSB = NULL;
 
p3DAudioPath->GetObjectInPath( 
    DMUS_PCHANNEL_ALL,  // Performance channel.
    DMUS_PATH_BUFFER,   // Stage in the path.
    0,                  // Index of buffer in chain.
    GUID_NULL,          // Class of object.
    0,                  // Index of object in buffer; ignored.
    IID_IDirectSound3DBuffer, // GUID of desired interface.
    (LPVOID*) &pDSB     // Pointer that receives interface.
);

The parameters to IDirectMusicAudioPath8::GetObjectInPath can be a little tricky to set up properly. For information on which parameters are relevant for objects at different stages in the path, see Retrieving Objects from an Audiopath.

In this case, you are retrieving a secondary buffer that is used by all performance channels on this audiopath. Set the dwPChannel parameter to DMUS_PCHANNEL_ALL.

Because the buffer you want is the first and in this case the only buffer in the chain, you pass 0 as dwBuffer. The DMUS_PATH_BUFFER stage contains only buffer objects, and not the DMOs attached to those buffers; therefore dwIndex is ignored.

Next: Step 3: Change Buffer Parameters


© 2004 Microsoft Corporation. All rights reserved.