Skip to content

Commit 6164e2c

Browse files
author
Francois Best
committed
Fix issue #13 on GitHub.
1 parent d13353a commit 6164e2c

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

src/MIDI.hpp

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -483,24 +483,22 @@ inline bool MidiInterface<SerialPort>::read(Channel inChannel)
483483
if (inChannel >= MIDI_CHANNEL_OFF)
484484
return false; // MIDI Input disabled.
485485

486-
if (parse())
487-
{
488-
handleNullVelocityNoteOnAsNoteOff();
489-
if (inputFilter(inChannel))
490-
{
486+
if (!parse())
487+
return false;
491488

492-
#if (MIDI_BUILD_OUTPUT && MIDI_BUILD_THRU)
493-
thruFilter(inChannel);
494-
#endif
489+
handleNullVelocityNoteOnAsNoteOff();
490+
const bool channelMatch = inputFilter(inChannel);
495491

496-
#if MIDI_USE_CALLBACKS
497-
launchCallback();
498-
#endif
499-
return true;
500-
}
492+
if (MIDI_USE_CALLBACKS && channelMatch)
493+
{
494+
launchCallback();
501495
}
502496

503-
return false;
497+
#if MIDI_BUILD_THRU
498+
thruFilter(inChannel);
499+
#endif
500+
501+
return channelMatch;
504502
}
505503

506504
// -----------------------------------------------------------------------------

0 commit comments

Comments
 (0)