Microsoft DirectX 9.0

C3DMusicSegment Sample Class

The C3DMusicSegment sample class represents a segment playing on a 3-D audiopath.

class C3DMusicSegment : public CMusicSegment
    IDirectMusicAudioPath8* m_p3DAudioPath;
    IDirectSound3DBuffer*   m_pDS3DBuffer;
    DS3DBUFFER              m_dsBufferParams;
    BOOL                    m_bDeferSettings;
    BOOL                    m_bCleanupAudioPath;

    C3DMusicSegment(IDirectMusicPerformance8* pPerformance, 
                   IDirectMusicLoader8* pLoader,
                   IDirectMusicSegment8* pSegment,
                   IDirectMusicAudioPath8* pAudioPath);
    virtual ~C3DMusicSegment();

    HRESULT Init();
    IDirectMusicAudioPath8* GetAudioPath() { return m_p3DAudioPath; }
            IDirectMusicAudioPath8* pAudioPath = NULL);
    VOID Set3DParameters(FLOAT fMinDistance, FLOAT fMaxDistance);
    VOID SetObjectProperties(D3DVECTOR* pvPosition, D3DVECTOR* pvVelocity);


The constructor stores pointers to the performance, loader, segment, and audiopath objects.

Public Methods

In addition to the methods inherited from CMusicSegment, the class contains the following public methods, in alphabetical order.

Method Description
GetAudioPath Returns a pointer to the IDirectMusicAudioPath8 interface in the m_p3DAudioPath member.
Init Creates a 3-D audiopath if one is not already associated with the segment, and retrieves the 3-D buffer in the m_pDS3DBuffer member.
Play Plays the segment, using the specified flags and audiopath. If no audiopath is specified, the audiopath in the m_p3DAudioPath member is used.
Set3DParameters Sets the minimum and maximum distances for the 3-D buffer.
SetObjectProperties Sets the position and velocity of the 3-D buffer.

The class is implemented in (SDK root)\samples\C++\Common\Src\Dmutil.cpp.

See Also