This method is used to download an instrument to the DLS device. Downloading an instrument means handing the data that makes up the instrument to the DLS device. This includes articulation data and all waves needed by the instrument. To save wave space, only waves and articulation required for a range are downloaded. The method returns an IDirectMusicDownloadedInstrument interface pointer, which is later used to unload the instrument.

HRESULT DownloadInstrument(
  IDirectMusicInstrument* pInstrument,
  IDirectMusicDownloadedInstrument** ppDownloadedInstrument,
  DMUS_NOTERANGE* pNoteRanges,
  DWORD dwNumNoteRanges;


  • pInstrument
    Instrument from which the method extracts the data to be downloaded.
  • ppDownloadedInstrument
    Address of a variable to receive a pointer to the IDirectMusicDownloadedInstrument interface.
  • pNoteRanges
    Address of an array of DMUS_NOTERANGE structures. Each entry in the array specifies a contiguous range of MIDI note messages to which the instrument must respond. An instrument region is downloaded only if at least one note in that region is specified in the DMUS_NOTERANGE structures.
  • dwNumNoteRanges
    Number of DMUS_NOTERANGE structures in the array pointed to by pNoteRanges. If this value is set to 0, the pNoteRanges parameter is ignored, and all regions and wave data for the instrument are downloaded.

Return Values

If the method succeeds, the return value is S_OK.

If it fails, the method can return one of the following error values:



To prevent memory loss, the instrument must be unloaded by calling both IDirectMusicPort::UnloadInstrument and IDirectMusicDownloadedInstrument::Release when it is no longer needed.


OS Versions: Windows CE .NET 4.0 and Windows CE .NET 4.1.
Header: Dmusicc.h.
Link Library: Dmusic.lib.

See Also

Working with Instruments | IDirectMusicDownloadedInstrument | IDirectMusicPort::Compact | DMUS_NOTERANGE

 Last updated on Monday, April 12, 2004

© 1992-2002 Microsoft Corporation. All rights reserved.