Microsoft DirectX 8.1 (Visual Basic) |
The InitAudio method initializes the performance and optionally sets up a default audiopath. This method must be called before the performance can play using audiopaths.
object.InitAudio( _
hwnd As Long, _
lFlags As CONST_DMUS_AUDIO, _
AudioParams As DMUS_AUDIOPARAMS, _
[DirectSound As DirectSound8], _
[lDefaultPathType As CONST_DMUSIC_STANDARD_AUDIO_PATH], _
[lPChannelCount As Long] )
Parts
object
Resolves to a DirectMusicPerformance8 object.
hwnd
Window handle to use for the creation of DirectSound. If 0, the foreground window is used. See Remarks.
This parameter is ignored if a DirectSound8 object is passed to the method in DirectSound. In that case the application is responsible for setting the window handle by using DirectSound8.SetCooperativeLevel.
lFlags
Flags from the CONST_DMUS_AUDIO enumeration that specify requested features. If the lValidData member of the AudioParams type is not zero, this value is ignored and the requested features are specified in the lFeatures member of AudioParams.
AudioParams
DMUS_AUDIOPARAMS type that specifies parameters for the synthesizer and receives information about what parameters were set. If the lValidData member is zero, default parameters are set.
DirectSound
Optional DirectSound8 object to use by default for wave output.
If this parameter is a DirectSound8 variable set to Nothing, a DirectSound object is created and the variable is set to that object.
If this parameter is omitted, a private DirectSound8 object is created.
See Remarks.
lDefaultPathType
Value that specifies the default audiopath type. Can be zero or omitted if no default path type is wanted, or one of the constants of the CONST_DMUSIC_STANDARD_AUDIO_PATH enumeration.
lPChannelCount
Value that specifies the number of
Return Values
If the method fails, an error is raised. Possible values for Err.Number include the following:
DMUS_E_ALREADY_INITED |
DMUS_E_OUTOFMEMORY |
Remarks
This method can be called only once.
The performance must be terminated by using the DirectMusicPerformance8.CloseDown method before being released.
There should be only one DirectSound8 object per process. If your application uses DirectSound8 separately, it should pass that object in DirectSound. It must first set the cooperative level by passing DSSCL_PRIORITY to DirectSound8.SetCooperativeLevel.
You can pass 0 in the hwnd parameter to give the current foreground window handle to DirectSound. However, do not assume that the application window will be in the foreground during initialization. It is best to pass the top-level application window handle.
Parameters set in the lFlags and AudioParams parameters apply to the default audiopath and any audiopaths created subsequently.