Purpose: Handles high level 3D segments. These
segments contain a CAudioPath object and inherit
from CSegment, C3DBuffer and C3DListener
objects
Remark: The returns values are based on the DirectX9
constants except DM_FAILED
The functions raise a CDMusicException
exception type with the error
data.
Member functions:
Function:
GetAudioPath
Declaration: CAudioPath& C3DSegment::GetAudioPath()
Purpose: Returns a reference to the
internal audiopath
Parameters: none
Returns:
CAudioPath | A reference to an audiopath object |
Function:
GetObjectPath
Declaration: HRESULT C3DSegment::GetObjectInPath(DWORD dwPChannel, DWORD dwStage, DWORD dwBuffer, REFGUID
guidObject,DWORD dwIndex,REFGUID iidInterface,void **ppObject)
Purpose: Retrieves an interface for
an object in the audiopath
Parameters:
dwPChannel
[in]:
dwStage [in]: Stage in the audiopath. Can be one of the values in the following table
Value | Description |
DMUS_PATH_AUDIOPATH_GRAPH | Get the audiopath toolgraph. One is created if none exists. |
DMUS_PATH_AUDIOPATH_TOOL | Get a tool from the audiopath toolgraph. |
DMUS_PATH_BUFFER | Get a DirectSound buffer. |
DMUS_PATH_BUFFER_DMO | Get a |
DMUS_PATH_MIXIN_BUFFER | Get a
global |
DMUS_PATH_MIXIN_BUFFER_DMO | Get a DMO in a global mix-in buffer. |
DMUS_PATH_PERFORMANCE | Get the performance. |
DMUS_PATH_PERFORMANCE_GRAPH | Get the performance toolgraph. One is created if none exists. |
DMUS_PATH_PERFORMANCE_TOOL | Get a tool from the performance toolgraph. |
DMUS_PATH_PORT | Get the synthesizer. |
DMUS_PATH_PRIMARY_BUFFER | Get the |
Remarks
The value in dwPChannel must be 0 for any stage that is not channel-specific. Objects in the following stages are channel-specific and can be retrieved by setting a channel number or DMUS_PCHANNEL_ALL in dwPChannel:
DMUS_PATH_AUDIOPATH_TOOL
DMUS_PATH_BUFFER
DMUS_PATH_BUFFER_DMO
DMUS_PATH_PERFORMANCE_TOOL
DMUS_PATH_PORT
The precedence of the parameters in filtering out unwanted objects is as follows:
If a matching object is found but the interface specified by iidInterface cannot be obtained, the method fails
Returns:
S_OK |
Succeeds |
Throws:
E_POINTER | An invalid pointer, usually NULL, was passed as a parameter |
E_NOINTERFACE | No object interface is available |
E_OUTOFMEMORY | Insufficient memory to complete the task |
E_INVALIDARG | Invalid argument. Often, this error results from failing to initialize the dwSize member of a structure before passing it to the method |
DMUS_E_NOT_FOUND | The requested item is not contained by the object |
DM_FAILED | Error, see DirectMidi causes |
Function:
Initialize
Declaration: HRESULT C3DSegment::Initialize(CAPathPerformance &pPerformance,DWORD dwType,DWORD dwPChannelCount)
Purpose: Initializes the C3DSegment
object
Parameters:
pPerformance [in]: Reference to an audiopath performance
dwType [in]: Type of internal audiopath:
Value | Description |
DMUS_APATH_DYNAMIC_3D | One bus to a 3-D buffer. Does not send to environmental reverb. |
DMUS_APATH_DYNAMIC_MONO | One bus to a mono buffer. |
DMUS_APATH_DYNAMIC_STEREO | Two buses to a stereo buffer. |
DMUS_APATH_SHARED_STEREOPLUSREVERB | Ordinary music setup |
dwPChannelCount [in]: Number of performance channels in the path
Returns:
S_OK | Succeeds |
Throws:
DMUS_E_NOT_INIT | A required object is not initialized or failed to initialize |
DSERR_BUFFERLOST | The buffer memory has been lost and must be restored |
E_INVALIDARG | Invalid argument. Often, this error results from failing to initialize the dwSize member of a structure before passing it to the method |
DM_FAILED | Error, see DirectMidi causes |
E_POINTER | An invalid pointer, usually NULL, was passed as a parameter |
E_NOINTERFACE | No object interface is available |
DMUS_E_NOT_FOUND | The requested item is not contained by the object |
E_OUTOFMEMORY | Insufficient memory to complete the task |
Function:
Initialize
Declaration: HRESULT
C3DSegment::Initialize(CAudioPath &Path)
Purpose: Initializes the C3DSegment
object given an external shared audiopath. This audiopath is not released by the
C3DSegment object destructor
Parameters:
Path [in]: Reference
to an audiopath
Returns:
S_OK | Succeeds |
Throws:
E_POINTER | An invalid pointer, usually NULL, was passed as a parameter |
E_NOINTERFACE | No object interface is available |
E_OUTOFMEMORY | Insufficient memory to complete the task |
E_INVALIDARG | Invalid argument. Often, this error results from failing to initialize the dwSize member of a structure before passing it to the method |
DMUS_E_NOT_FOUND | The requested item is not contained by the object |
DM_FAILED | Error, see DirectMidi causes |
Function:
operator = (CSegment &Segment)
Declaration: C3DSegment::operator = (const CSegment &Segment)
Purpose: Clones a Segment to a
C3DSegment object
Parameters:
CSegment [in]: Reference to a CSegment object
Returns:
C3DSegment | A cloned C3DSement. Important: It must be initialized before using 3D and audiopaths |
Throws:
DM_FAILED | Error, see DirectMidi causes |
E_POINTER | An invalid pointer, usually NULL, was passed as a parameter |
E_OUTOFMEMORY | Insufficient memory to complete the task |
Function:
operator = (C3DSegment &Segment)
Declaration: C3DSegment& C3DSegment::operator = (const C3DSegment &Segment)
Purpose: Clones a C3DSegment to
another C3DSegment object
Parameters:
C3DSegment [in]: Reference to a C3DSegment object
Returns:
C3DSegment | A cloned C3DSement. Important: It must be initialized before using 3D and audiopaths |
Throws:
DM_FAILED | Error, see DirectMidi causes |
E_POINTER | An invalid pointer, usually NULL, was passed as a parameter |
E_OUTOFMEMORY | Insufficient memory to complete the task |
Function:
ReleaseSegment
Declaration: HRESULT C3DSegment::ReleaseSegment()
Purpose: Releases a 3D segment.
Releases all internal objects
Parameters: none
Returns:
S_OK | Succeeds |
Function:
SetVolume
Declaration: HRESULT C3DSegment::SetVolume(long lVolume,DWORD dwDuration)
Purpose: Sets the volume for the
internal audiopath
Parameters:
lVolume [in]: Value that specifies the attenuation, in hundredths of a decibel. This value must be in the range from -9600 to 0. Zero is full volume
dwDuration [in]: Value that specifies the time, in milliseconds, over which the volume change takes place. A value of 0 ensures maximum efficiency
Returns:
S_OK | Succeeds |
Throws:
DM_FAILED | Error, see DirectMidi causes |
DMUS_E_NOT_INIT | A required object is not initialized or failed to initialize |
E_INVALIDARG | Invalid argument. Often, this error results from failing to initialize the dwSize member of a structure before passing it to the method |