Platform SDK: DirectX |
The IDirectMusicPerformance::Init method associates the performance with a DirectMusic object and a DirectSound object.
HRESULT Init( IDirectMusic** ppDirectMusic, LPDIRECTSOUND pDirectSound, HWND hWnd );
If the variable contains NULL, a DirectMusic object is created, and the interface pointer is returned.
If ppDirectMusic is NULL, a DirectMusic object is created and used internally by the performance.
See Remarks.
This parameter is ignored if pDirectSound is not NULL, in which case the application is responsible for setting the window handle in a call to IDirectSound::SetCooperativeLevel.
If the method succeeds, the return value is S_OK.
If it fails, the method can return one of the following error values:
DMUS_E_ALREADY_INITED |
E_OUTOFMEMORY |
E_POINTER |
This method should be called only once; it must be called before the performance can play.
A DirectMusic object can be associated with the performance in any of the following ways:
The performance must be terminated by using the IDirectMusicPerformance::CloseDown method before being released.
You can pass NULL in the hWnd parameter to pass the current foreground window handle to DirectSound. However, do not assume that the application window will be in the foreground during initialization. In general, the top-level application window handle is passed to DirectMusic, DirectSound, and DirectDraw. See the Remarks for IDirectSound::SetCooperativeLevel.
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
Header: Declared in dmusici.h.
Creating the Performance, Integrating DirectMusic and DirectSound