Although it is possible to use DirectMusic to send wave data to any device, the default synthesizer streams its output to DirectSound.
DirectMusic is capable of handling all the details of linking to DirectSound without any action on your part. When it creates or links to a DirectSound object, DirectMusic ensures that the primary buffer format matches that of the highest format among all DirectMusic ports.
In an application that uses only music files for its soundtrack, and does not require DirectSound for playing wave files or resources, the DirectSound object is typically created when the DirectMusic performance is initialized, as in the following example, where pPerf is a pointer to the IDirectMusicPerformance:
pPerf->Init(NULL, NULL, hwnd);
In this example, the first NULL specifies that the DirectMusic object is to be created and managed internally, the second NULL specifies the same for the DirectSound object, and hwnd is the controlling window for DirectSound.
Note It is good practice to supply the top-level application window handle when requesting that DirectMusic create the DirectSound object. See the Remarks for IDirectMusicPerformance::Init and IDirectSound::SetCooperativeLevel.
More information is contained in the following topics: