Manually Downloading Bands
You can manually download a band in one of the following ways:
- Call IDirectMusicSegment8::Download to download the bands and waveforms in a segment to either an audiopath or a performance.
- Obtain an IDirectMusicBand8 interface from a loaded object, and call the IDirectMusicBand8::Download method.
- Call the IDirectMusicSegment8::SetParam method with the GUID_Download or GUID_DownloadToAudioPath parameter to download the band in the segment's first band track. You can also use IDirectMusicPerformance8::SetParam to set this parameter on the primary segment, or IDirectMusicTrack8::SetParamEx to set it directly on a band track. For more information, see Setting and Retrieving Track Parameters.
If your application creates audiopaths that use more than one port, you must download bands to the individual audiopaths, not to the performance. However, most applications use only a single port, and in this case it is safe to download all instrument data to either an audiopath or the performance. When a band is downloaded to an audiopath, the instrument data is downloaded to the port on that audiopath and is then available to any audiopath using the same port.
There is no danger in downloading the same instrument multiple times. If an instrument appears in one band multiple times or if it appears in multiple bands that are all opened and downloaded at the same time, only one copy of the instrument is sent to the synthesizer.
The following example function loads a band from a file and downloads it to the performance:
HRESULT DownloadBand(
IDirectMusicLoader8 *pLoader,
IDirectMusicPerformance8 *pPerf,
WCHAR *pwszFile)
{
IDirectMusicBand8* pBand;
HRESULT hr;
hr = pLoader->LoadObjectFromFile(CLSID_DirectMusicBand, IID_IDirectMusicBand8,
pwszFile, (void **)&pBand);
if (SUCCEEDED(hr))
{
hr = pBand->Download(pPerf);
}
return hr;
}