From 374d3ad8a8f5a1e88ccd3110842257e4575697f0 Mon Sep 17 00:00:00 2001 From: kevin Date: Sat, 6 Apr 2024 16:04:42 -0400 Subject: [PATCH] cwMidiDeviceTest.cpp,cwMidiFileDev.cpp,cwMidiParser.cpp : Updates to account for change of MIDI callback signature in cwMidiDecls.h. --- cwMidiDeviceTest.cpp | 4 ++-- cwMidiFileDev.cpp | 3 +-- cwMidiParser.cpp | 17 +++++++++++++---- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/cwMidiDeviceTest.cpp b/cwMidiDeviceTest.cpp index 75049e4..174dcd3 100644 --- a/cwMidiDeviceTest.cpp +++ b/cwMidiDeviceTest.cpp @@ -86,7 +86,7 @@ namespace cw return kOkRC; } - void _test_callback( const packet_t* pktArray, unsigned pktCnt ) + void _test_callback( void* cbArg, const packet_t* pktArray, unsigned pktCnt ) { unsigned i,j; time::spec_t cur_time = time::current_time(); @@ -95,7 +95,7 @@ namespace cw { const packet_t* p = pktArray + i; - test_t* t = (test_t*)p->cbArg; + test_t* t = (test_t*)cbArg; for(j=0; jmsgCnt; ++j) if( p->msgArray != NULL ) diff --git a/cwMidiFileDev.cpp b/cwMidiFileDev.cpp index ba4a064..9978e87 100644 --- a/cwMidiFileDev.cpp +++ b/cwMidiFileDev.cpp @@ -428,13 +428,12 @@ namespace cw if( p->cbFunc != nullptr ) { packet_t pkt = {}; - pkt.cbArg = p->cbArg; pkt.devIdx = p->base_dev_idx; pkt.portIdx = file_idx; pkt.msgArray = msgA; pkt.msgCnt = msgN; - p->cbFunc( &pkt, 1 ); + p->cbFunc( p->cbArg, &pkt, 1 ); } } diff --git a/cwMidiParser.cpp b/cwMidiParser.cpp index cfb0bb0..0ea317d 100644 --- a/cwMidiParser.cpp +++ b/cwMidiParser.cpp @@ -58,8 +58,8 @@ namespace cw cbRecd_t* c = p->cbChain; for(; c!=NULL; c=c->linkPtr) { - pkt->cbArg = c->cbDataPtr; - c->cbFunc( pkt, pktCnt ); + //pkt->cbArg = c->cbDataPtr; + c->cbFunc( c->cbDataPtr, pkt, pktCnt ); } } @@ -102,10 +102,19 @@ namespace cw // get a pointer to the next msg in the buffer msg_t* msgPtr = (msg_t*)(p->buf + p->bufIdx); + if( midi::isChStatus(p->status) ) + { + msgPtr->status = p->status & 0xf0; + msgPtr->ch = p->status & 0x0f; + } + else + { + msgPtr->status = p->status; + msgPtr->ch = 0; + } + // fill the buffer msg msgPtr->timeStamp = *timeStamp; - msgPtr->status = p->status & 0xf0; - msgPtr->ch = p->status & 0x0f; msgPtr->uid = kInvalidId; switch( p->dataCnt )