Microsoft DirectX 8.1 (C++) |
The SetPatch method sets the patch number for the instrument. Although each instrument in a
Syntax
HRESULT SetPatch(
DWORD dwPatch
);
Parameters
dwPatch
New patch number to assign to instrument.
Return Values
If the method succeeds, the return value is S_OK.
If it fails, the method can return one of the error values shown in the following table.
Return code |
DMUS_E_NOT_INIT |
DMUS_E_INVALIDPATCH |
Remarks
The following code example gets an instrument from a collection, remaps its MSB bank select to a different bank, and then downloads the instrument.
Example Code
HRESULT myRemappedDownload(
IDirectMusicCollection8 *pCollection,
IDirectMusicPort8 *pPort,
IDirectMusicDownloadedInstrument8 **ppDLInstrument,
BYTE bMSB, // Requested MIDI MSB for patch bank select
DWORD dwPatch) // Requested patch
{
HRESULT hr;
IDirectMusicInstrument8* pInstrument;
hr = pCollection->GetInstrument(dwPatch, &pInstrument);
if (SUCCEEDED(hr))
{
dwPatch &= 0xFF00FFFF; // Clear MSB.
dwPatch |= bMSB << 16; // Insert new MSB value.
pInstrument->SetPatch(dwPatch);
hr = pPort->DownloadInstrument(pInstrument,
ppDLInstrument,
NULL, 0); // Download all regions.
pInstrument->Release();
}
return hr;
}
Requirements
Header: Declared in dmusicc.h.
See Also