From ac62d77803eb9cc669b845bce37675678260075f Mon Sep 17 00:00:00 2001 From: kevin Date: Mon, 17 Mar 2014 10:01:47 -0700 Subject: [PATCH] cmMidi.h : Added status tests cmMidiIsNoteOn(), cmMidiIsCtl(), etc. --- cmMidi.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmMidi.h b/cmMidi.h index 7424ae5..fa1245e 100644 --- a/cmMidi.h +++ b/cmMidi.h @@ -82,6 +82,12 @@ extern "C" { #define cmMidiIsStatus( s ) (kNoteOffMdId <= (s) /*&& ((unsigned)(s)) <= kSysRtResetMdId*/ ) #define cmMidiIsChStatus( s ) (kNoteOffMdId <= (s) && (s) < kSysExMdId) +#define cmMidiIsNoteOn( s ) ( kNoteOnMdId <= (s) && (s) <= (kNoteOnMdId + kMidiChCnt) ) +#define cmMidiIsNoteOff( s, d1 ) ( cmMidiIsNoteOn(s) && (d1)==0 || kNoteOffMdId <= (s) && (s) <= (kNoteOffMdId + kMidiChCnt) ) +#define cmMidiIsCtl( s ) ( kCtlMdId <= (s) && (s) <= (kCtlMdId + kMidiChCnt) ) +#define cmMidiIsSustainPedal( s, d0 ) ( kCtlMdId <= (s) && (s) <= (kCtlMdId + kMidiChCnt) && (d0)== kSustainCtlMdId ) +#define cmMidiIsSustainPedalDown( s, d0, d1) ( cmMidiIsSustainPedal(s,d0) && (d1)>=64 ) +#define cmMidiIsSustainPedalUp( s, d0, d1) ( cmMidiIsSustainPedal(s,d0) && (d1)<64 ) const char* cmMidiStatusToLabel( cmMidiByte_t status ); const char* cmMidiMetaStatusToLabel( cmMidiByte_t metaStatus );