80.5.9 Preloading Patches With Internal MIDI Synthesizers

Some internal MIDI synthesizer devices can't keep all of their patches loaded simultaneously. These devices must preload their patch data.

Windows provides the following functions to request that a synthesizer preload and cache specified patches:

Function Description

midiOutCachePatches Requests that an internal MIDI synthesizer device preload and cache specified melodic patches.
midiOutCacheDrumPatches Requests that an internal MIDI synthesizer device preload and cache specified key-based percussion patches.

The midiOutCachePatches function takes a pointer to a PATCHARRAY to indicate the patches to be cached. The MMSYSTEM.H file defines the PATCHARRAY data type as follows:

typedef WORD PATCHARRAY[MIDIPATCHSIZE];

Each element in the array corresponds to a patch with each of the 16 bits representing one of the 16 MIDI channels. Bits are set for each of the channels that use that particular patch. For example, if patch number 0 is used by physical MIDI channels 0 and 8, set element 0 of the array to 0x0101:

This illustration is not available for this release

The midiOutCacheDrumPatches function takes a pointer to a KEYARRAY to indicate the key-based percussion patches to be cached. The MMSYSTEM.H file defines the KEYARRAY data type as follows:

typedef WORD KEYARRAY[MIDIPATCHSIZE];

Each element in the array corresponds to a key-based percussion patch with each of the 16 bits representing one of the 16 MIDI channels. Bits are set for each of the channels that use that particular patch. For example, if the percussion patch for key number 60 is used by physical MIDI channels 9 and 15, set element 60 of the array to 0x8200:

This illustration is not available for this release