Platform SDK: DirectX

IDirectMusicPerformance::DownloadInstrument

The IDirectMusicPerformance::DownloadInstrument method downloads DLS data for an instrument to a port.

HRESULT DownloadInstrument(
  IDirectMusicInstrument* pInst,
  DWORD dwPChannel,
  IDirectMusicDownloadedInstrument** ppDownInst,
  DMUS_NOTERANGE* pNoteRanges, 
  DWORD dwNumNoteRanges, 
  IDirectMusicPort** ppPort,
  DWORD* pdwGroup,
  DWORD* pdwMChannel
);

Parameters

pInst
Address of a variable that contains the instrument to download.
dwPChannel
PChannel to which the instrument is assigned.
ppDownInst
Address of a variable to receive a pointer to the downloaded instrument.
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.
ppPort
Address of a variable to receive a pointer to the port to which the instrument was downloaded.
pdwGroup
Address of a variable to receive the group to which the instrument is assigned.
pdwMChannel
Address of a variable to receive the MIDI channel to which the instrument is assigned.

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:

E_INVALIDARG
E_POINTER

Remarks

Most applications do not need to use this method because instrument downloading is normally handled by bands. See Downloading and Unloading Bands.

The method returns E_INVALIDARG if the PChannel is not assigned to a port.

To prevent loss of resources, unload the instrument by using the IDirectMusicPort::UnloadInstrument method when the instrument is no longer needed.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in dmusici.h.

See Also

IDirectMusicPort::DownloadInstrument, IDirectMusicPort::UnloadInstrument, Working with Instruments