Hi - I need to filter midi from a stream created through BASS_MIDI_StreamCreateFile.
I searched the forums and found this old thread:
http://www.un4seen.com/forum/?topic=7914.msg53930#msg53930The method described there sort of works but I still hear the midi file playing faintly muted. I am using the exact code from the earlier post to test this (below). Any tips on why this may not be working?
BASS_ChannelSetSync(midi, BASS_SYNC_MIDI_EVENT|BASS_SYNC_MIXTIME, MIDI_EVENT_NOTE, PianoFilter, 0); // set NOTE event sync
...
void CALLBACK PianoFilter(HSYNC handle, DWORD channel, DWORD data, void *user)
{
if (!HIBYTE(data)) return; // it's a "note off", nothing to do
if (BASS_MIDI_StreamGetEvent(channel, HIWORD(data), MIDI_EVENT_DRUMS)) return; // ignore drum channels
DWORD preset=BASS_MIDI_StreamGetEvent(channel, HIWORD(data), MIDI_EVENT_PROGRAM); // get current preset
if (preset<9) // it's a piano
BASS_MIDI_StreamEvent(channel, HIWORD(data), MIDI_EVENT_NOTE, LOBYTE(data)); // release note (velocity=0)
}