From 7ba28465c80e20be69682cc5855bc6c21d872440 Mon Sep 17 00:00:00 2001 From: kevin Date: Sun, 17 Dec 2023 08:51:46 -0500 Subject: [PATCH] cwScoreParse.h,cwPresetSel.cpp,cwIOPresetSelApp.cpp : Added global constant score_parse:kInvalidLocId. --- cwIoPresetSelApp.cpp | 17 ++++++++--------- cwPresetSel.cpp | 5 ++--- cwScoreParse.h | 5 +++++ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/cwIoPresetSelApp.cpp b/cwIoPresetSelApp.cpp index efad57f..5fd3b20 100644 --- a/cwIoPresetSelApp.cpp +++ b/cwIoPresetSelApp.cpp @@ -34,7 +34,6 @@ #include "cwSfTrack.h" #include "cwScoreFollower.h" -#define INVALID_LOC (0) namespace cw { @@ -972,7 +971,7 @@ namespace cw unsigned _get_loc_from_score_follower( app_t* app, double secs, unsigned muid, uint8_t status, uint8_t d0, uint8_t d1 ) { - unsigned loc = INVALID_LOC; + unsigned loc = score_parse::kInvalidLocId; // if this is a MIDI note-on event - then udpate the score follower if( midi::isNoteOn(status,d1) && muid != kInvalidIdx ) @@ -1054,7 +1053,7 @@ namespace cw // TODO: ZERO SHOULD BE A VALID LOC VALUE - MAKE -1 THE INVALID LOC VALUE - if( loc != INVALID_LOC && app->trackMidiFl ) + if( loc != score_parse::kInvalidLocId && app->trackMidiFl ) { if( preset_sel::track_loc( app->psH, loc, f ) ) { @@ -1140,7 +1139,7 @@ namespace cw frameIdxRef = kInvalidIdx; - if( app->in_audio_begin_loc != INVALID_LOC ) + if( app->in_audio_begin_loc != score_parse::kInvalidLocId ) { if((e0 = loc_to_event(app->scoreH,app->in_audio_begin_loc)) == nullptr ) { @@ -2015,8 +2014,8 @@ namespace cw // allocate the locMap[] app->locMap = mem::resizeZ( app->locMap, midiEventN ); app->locMapN = midiEventN; - app->minPerfLoc = INVALID_LOC; - app->maxPerfLoc = INVALID_LOC; + app->minPerfLoc = score_parse::kInvalidLocId; + app->maxPerfLoc = score_parse::kInvalidLocId; // allocate the the player msg array m = mem::allocZ( midiEventN ); @@ -2037,14 +2036,14 @@ namespace cw app->locMap[i].loc = e->loc; app->locMap[i].timestamp = m[i].timestamp; - if( e->loc != INVALID_LOC ) + if( e->loc != score_parse::kInvalidLocId ) { - if( app->minPerfLoc == INVALID_LOC ) + if( app->minPerfLoc == score_parse::kInvalidLocId ) app->minPerfLoc = e->loc; else app->minPerfLoc = std::min(app->minPerfLoc,e->loc); - if( app->maxPerfLoc == INVALID_LOC ) + if( app->maxPerfLoc == score_parse::kInvalidLocId ) app->maxPerfLoc = e->loc; else app->maxPerfLoc = std::max(app->maxPerfLoc,e->loc); diff --git a/cwPresetSel.cpp b/cwPresetSel.cpp index 49754b0..b49ecd0 100644 --- a/cwPresetSel.cpp +++ b/cwPresetSel.cpp @@ -14,7 +14,6 @@ #include "cwScoreParse.h" #include "cwSfScore.h" -#define INVALID_LOC 0 namespace cw { @@ -961,8 +960,8 @@ void cw::preset_sel::get_loc_range( handle_t h, unsigned& minLocRef, unsigned& m if( p->fragL == nullptr ) { - minLocRef = INVALID_LOC; - maxLocRef = INVALID_LOC; + minLocRef = score_parse::kInvalidLocId; + maxLocRef = score_parse::kInvalidLocId; } else { diff --git a/cwScoreParse.h b/cwScoreParse.h index 7289bc6..d468af7 100644 --- a/cwScoreParse.h +++ b/cwScoreParse.h @@ -2,6 +2,11 @@ namespace cw { namespace score_parse { + + enum { + kInvalidLocId = 0 + }; + enum { kInvalidTId, kBarTId,