DirectX SDK |
The DirectMusicPerformance.Init method initializes the performance and associates it with a DirectSound object. This method should be called only once, before any other methods are called on the performance.
object.Init(DirectSound As DirectSound, hwnd As Long)
If the method fails, it raises an error, and Err.Number can be set to one of the following values:
DMUS_E_ALREADY_INITED |
DMUS_E_OUTOFMEMORY |
There should be only one DirectSound object per process. If your application uses a DirectSound object for playing waves, it must pass in that object here.
The hwnd parameter is significant only if DirectSound is Nothing. If a DirectSound object is created separately by the application and passed to this method, the application is responsible for setting the window handle in a call to DirectSound.SetCooperativeLevel.
Do not 0 pass as hwnd because the application window might not be in the foreground when the method is called. In general, the top-level application window handle should be passed to DirectMusicPerformance.Init, DirectSound.SetCooperativeLevel, and DirectDraw7.SetCooperativeLevel.
The performance must be terminated by using the DirectMusicPerformance.CloseDown method before being released.