From 8c3af076c93b430102db817b68cc7e43d764db0c Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Fri, 12 May 2017 10:28:23 +0200 Subject: Use correct MIDI note ON mask. Signed-off-by: Hans Petter Selasky --- drumgizmo/input/jackmidi.cc | 3 ++- drumgizmo/input/midifile.cc | 3 ++- test/dgreftest/midiinputengine.cc | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/drumgizmo/input/jackmidi.cc b/drumgizmo/input/jackmidi.cc index 7c5cf1c..8f8d5cb 100644 --- a/drumgizmo/input/jackmidi.cc +++ b/drumgizmo/input/jackmidi.cc @@ -31,6 +31,7 @@ #include "jackmidi.h" static int const NOTE_ON = 0x90; +static int const NOTE_MASK = 0xF0; JackMidiInputEngine::JackMidiInputEngine(JackClient& client) : AudioInputEngineMidi{} @@ -122,7 +123,7 @@ void JackMidiInputEngine::process(jack_nframes_t num_frames) { continue; } - if((event.buffer[0] & NOTE_ON) != NOTE_ON) + if((event.buffer[0] & NOTE_MASK) != NOTE_ON) { continue; } diff --git a/drumgizmo/input/midifile.cc b/drumgizmo/input/midifile.cc index 89ffa6b..c3bd8ae 100644 --- a/drumgizmo/input/midifile.cc +++ b/drumgizmo/input/midifile.cc @@ -30,6 +30,7 @@ #include "midifile.h" static int const NOTE_ON = 0x90; +static int const NOTE_MASK = 0xF0; MidifileInputEngine::MidifileInputEngine() : AudioInputEngineMidi{} @@ -147,7 +148,7 @@ void MidifileInputEngine::run(size_t pos, size_t len, std::vector& even if(!smf_event_is_metadata(current_event)) { if((current_event->midi_buffer_length == 3) && - ((current_event->midi_buffer[0] & NOTE_ON) == NOTE_ON) && + ((current_event->midi_buffer[0] & NOTE_MASK) == NOTE_ON) && (track == -1 || current_event->track_number == track) && current_event->midi_buffer[2] > 0) { diff --git a/test/dgreftest/midiinputengine.cc b/test/dgreftest/midiinputengine.cc index aba726f..84f4cc6 100644 --- a/test/dgreftest/midiinputengine.cc +++ b/test/dgreftest/midiinputengine.cc @@ -29,6 +29,7 @@ #include static int const NOTE_ON = 0x90; +static int const NOTE_MASK = 0xF0; MidifileInputEngine::MidifileInputEngine() : AudioInputEngineMidi{} @@ -147,7 +148,7 @@ void MidifileInputEngine::run(size_t pos, size_t len, std::vector& even if(!smf_event_is_metadata(current_event)) { if((current_event->midi_buffer_length == 3) && - ((current_event->midi_buffer[0] & NOTE_ON) == NOTE_ON) && + ((current_event->midi_buffer[0] & NOTE_MASK) == NOTE_ON) && (track == -1 || current_event->track_number == track) && current_event->midi_buffer[2] > 0) { -- cgit v1.2.3