Microsoft DirectX 8.1 (Visual Basic)

Creating the Performance

The performance object is the overall manager of playback. Among the tasks it performs are the following:

Most applications have a single DirectMusicPerformance8 object, but it is possible to have more than one performance with different parameters, such as master tempo or volume.

After the performance is created, it must be initialized by a call to DirectMusicPerformance8.InitAudio.

InitAudio associates a DirectSound8 object with the performance so that DirectSound can manage the sound data after it leaves the synthesizer. If your application uses DirectSound independently, you can either pass an existing object to InitAudio or set a variable to the object created by the method. In most cases, however, you don't need access to the DirectSound8 object.

By setting values in the DMUS_AUDIOPARAMS type that must be passed to InitAudio, the application can request synthesizer capabilities or set a synthesizer other than the default one. Most applications don't need to do this, and can request the default synthesizer and capabilities by leaving DMUS_AUDIOPARAMS.lValidData at 0.

The follow code example, in which objDX is a DirectX8 object, creates a performance and initializes it. It creates a standard default audiopath with 16 performance channels and all available features on the port.

Dim objDMPerformance as DirectMusicPerformance8
Dim audParams As DMUS_AUDIOPARAMS 
 
Set objDMPerformance = objDX.DirectMusicPerformanceCreate
objDMPerformance.InitAudio Me.hWnd, DMUS_AUDIOF_ALL, audParams, _
   Nothing, DMUS_APATH_SHARED_STEREOPLUSREVERB, 16