Retrieves the preset currently in use on a channel of a MIDI stream.
BOOL BASS_MIDI_StreamGetPreset( HSTREAM handle, DWORD chan, BASS_MIDI_FONT *font );
handle | The MIDI stream to retrieve the soundfont configuration of... 0 = get default soundfont configuration. |
chan | The MIDI channel... 0 = channel 1. |
fonts | Pointer to a structure to receive the preset information. |
BASS_ERROR_HANDLE | handle is not valid. |
BASS_ERROR_ILLPARAM | chan is not valid. |
BASS_ERROR_NOTAVAIL | No preset is currently in use on the specified MIDI channel. |
No preset information will be available for a MIDI channel until a note is played in that channel. The present and bank numbers will not necessarily match the channel's current MIDI_EVENT_PROGRAM and MIDI_EVENT_BANK event values, but rather what the MIDI stream's soundfont configuration maps those event values to.
BASS_MIDI_FONT font; int ch; for (ch = 0; ch < 16; ch++) { if (BASS_MIDI_StreamGetPreset(handle, ch, &font)) // get preset information for the MIDI channel printf("%d: %s\n", ch + 1, BASS_MIDI_FontGetPreset(font.font, font.preset, font.bank)); // display the preset name }