Manually Downloading Bands

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

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 actually is sent down to the synthesizer.

The following function loads a band from disk and downloads it:

HRESULT myDownloadBand(
    IDirectMusicLoader *pILoader,      // Loader interface
    IDirectMusicBand **ppBand,         // To retrieve pointer
    IDirectMusicPerformance *pPerf,    // Performance to use band
    WCHAR *pwszFile)                   // File to load
 
{
    HRESULT hr;
    DMUS_OBJECTDESC Desc;              // Descriptor
 
    // Start by initializing Desc with the file name and GUID
    // for the band object.
 
    wcscpy(Desc.wszFileName,pwszFile);
    Desc.dwSize = sizeof(Desc);
    Desc.guidClass = CLSID_DirectMusicBand; 
    Desc.dwValidData = DMUS_OBJ_CLASS | 
            DMUS_OBJ_FILENAME | DMUS_OBJ_FULLPATH;
 
    hr = pILoader->GetObject(&Desc, IID_IDirectMusicBand,
            (void **) ppBand);
    if (SUCCEEDED(hr))
    {
 
        // Download the band via the performance.
        hr = (*ppBand)->Download(pPerf);
 
    }
    return hr;
}