BASS_MIDI_FontGetPresets
Retrieves the presets in a soundfont.
BOOL BASS_MIDI_FontGetPresets( HSOUNDFONT handle, DWORD *presets );
Parameters
handle | The soundfont to get the presets from. |
presets | A pointer to an array to receive the presets. |
Return value
If successful, TRUE is returned, else FALSE is returned. Use BASS_ErrorGetCode to get the error code.Error codes
BASS_ERROR_HANDLE | handle is not valid. |
Remarks
Before using this function to retrieve the presets, BASS_MIDI_FontGetInfo should be used to get the number of presets in the soundfont. The presets are delivered with the preset number in the LOWORD and the bank number in the HIWORD, and in numerically ascending order.Example
List all presets in a soundfont, with their names.int a; BASS_MIDI_FONTINFO info; BASS_MIDI_FontGetInfo(handle, &info;); // get soundfont info for preset count DWORD *presets=(DWORD*)malloc(info.presets*sizeof(DWORD)); // allocate array for presets BASS_MIDI_FontGetPresets(handle, presets); // get the presets for (a=0; a<info.presets; a++) { DWORD preset=LOWORD(presets[a]), bank=HIWORD(presets[a]); // extract preset and bank number const char *name=BASS_MIDI_FontGetPreset(handle, preset, bank); // get the preset's name printf("%d.%d: %s\n", bank, preset, name); } free(presets);
See also
BASS_MIDI_FontGetInfo, BASS_MIDI_FontGetPreset