Manually Downloading Bands

You can manually download a band in one of the following ways:

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;
}

© 2004 Microsoft Corporation. All rights reserved.