From 7444044c05958209a7d485f08205ae5dc6f5d930 Mon Sep 17 00:00:00 2001 From: kevin Date: Mon, 30 Jan 2023 19:25:01 -0500 Subject: [PATCH] cwMidiFile.h : Update status checkers to check that the status is a channel message before accessing 'chMsgPtr' --- cwMidiFile.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/cwMidiFile.h b/cwMidiFile.h index c0eef83..df2018e 100644 --- a/cwMidiFile.h +++ b/cwMidiFile.h @@ -96,17 +96,17 @@ namespace cw } u; } trackMsg_t; - inline bool isNoteOn(const trackMsg_t* m) { return midi::isNoteOn( m->status,m->u.chMsgPtr->d1); } - inline bool isNoteOff(const trackMsg_t* m) { return midi::isNoteOff(m->status,m->u.chMsgPtr->d1); } + inline bool isNoteOn(const trackMsg_t* m) { return midi::isChStatus(m->status) ? midi::isNoteOn( m->status,m->u.chMsgPtr->d1) : false; } + inline bool isNoteOff(const trackMsg_t* m) { return midi::isChStatus(m->status) ? midi::isNoteOff(m->status,m->u.chMsgPtr->d1) : false; } - inline bool isPedalUp(const trackMsg_t* m) { return midi::isPedalUp( m->status, m->u.chMsgPtr->d0, m->u.chMsgPtr->d1); } - inline bool isPedalDown(const trackMsg_t* m) { return midi::isPedalDown( m->status, m->u.chMsgPtr->d0, m->u.chMsgPtr->d1); } + inline bool isPedalUp(const trackMsg_t* m) { return midi::isChStatus(m->status) ? midi::isPedalUp( m->status, m->u.chMsgPtr->d0, m->u.chMsgPtr->d1) : false; } + inline bool isPedalDown(const trackMsg_t* m) { return midi::isChStatus(m->status) ? midi::isPedalDown( m->status, m->u.chMsgPtr->d0, m->u.chMsgPtr->d1) : false; } - inline bool isSustainPedalUp(const trackMsg_t* m) { return midi::isSustainPedalUp( m->status,m->u.chMsgPtr->d0,m->u.chMsgPtr->d1); } - inline bool isSustainPedalDown(const trackMsg_t* m) { return midi::isSustainPedalDown( m->status,m->u.chMsgPtr->d0,m->u.chMsgPtr->d1); } + inline bool isSustainPedalUp(const trackMsg_t* m) { return midi::isChStatus(m->status) ? midi::isSustainPedalUp( m->status,m->u.chMsgPtr->d0,m->u.chMsgPtr->d1) : false; } + inline bool isSustainPedalDown(const trackMsg_t* m) { return midi::isChStatus(m->status) ? midi::isSustainPedalDown( m->status,m->u.chMsgPtr->d0,m->u.chMsgPtr->d1) : false; } - inline bool isSostenutoPedalUp(const trackMsg_t* m) { return midi::isSostenutoPedalUp( m->status,m->u.chMsgPtr->d0,m->u.chMsgPtr->d1); } - inline bool isSostenutoPedalDown(const trackMsg_t* m) { return midi::isSostenutoPedalDown(m->status,m->u.chMsgPtr->d0,m->u.chMsgPtr->d1); } + inline bool isSostenutoPedalUp(const trackMsg_t* m) { return midi::isChStatus(m->status) ? midi::isSostenutoPedalUp( m->status,m->u.chMsgPtr->d0,m->u.chMsgPtr->d1) : false; } + inline bool isSostenutoPedalDown(const trackMsg_t* m) { return midi::isChStatus(m->status) ? midi::isSostenutoPedalDown(m->status,m->u.chMsgPtr->d0,m->u.chMsgPtr->d1) : false; } typedef handle handle_t;