From ab2bb493d1c1c46a18f629b63d3e20991ce2626f Mon Sep 17 00:00:00 2001 From: kevin Date: Thu, 8 Feb 2024 11:09:40 -0500 Subject: [PATCH] cwScoreFollower.cpp : The file output from write_sync_perf_csv() now includes the section which each matched event belongs to. --- cwScoreFollower.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/cwScoreFollower.cpp b/cwScoreFollower.cpp index 8867d90..6207509 100644 --- a/cwScoreFollower.cpp +++ b/cwScoreFollower.cpp @@ -638,9 +638,10 @@ cw::rc_t cw::score_follower::write_sync_perf_csv( handle_t h, const char* out_fn if( midi::isNoteOn(m->status,d1) ) { - unsigned bar = 0; - unsigned loc = score_parse::kInvalidLocId; - unsigned dlevel = -1; + unsigned bar = 0; + const char* sectionLabel = ""; + unsigned loc = score_parse::kInvalidLocId; + unsigned dlevel = -1; char sciPitch[ midi::kMidiSciPitchCharCnt + 1 ]; midi::midiToSciPitch( d0, sciPitch, midi::kMidiSciPitchCharCnt ); @@ -664,18 +665,19 @@ cw::rc_t cw::score_follower::write_sync_perf_csv( handle_t h, const char* out_fn goto errLabel; } - bar = e->barNumb; - curBarNumb = std::max(bar,curBarNumb); - dlevel = e->dynLevel; - loc = resultA[i].oLocId == kInvalidId ? score_parse::kInvalidLocId : resultA[i].oLocId; + bar = e->barNumb; + sectionLabel = e->section != nullptr ? e->section->label : ""; + curBarNumb = std::max(bar,curBarNumb); + dlevel = e->dynLevel; + loc = resultA[i].oLocId == kInvalidId ? score_parse::kInvalidLocId : resultA[i].oLocId; break; } } - rc = file::printf(fH, "%i,%i,%i,%i,0,%f,0.0,0.0,0,%s,,%i,%i,%i,%i,,,,,%i,%i,%i\n", - bar,i,1,loc,secs,sciPitch,dlevel,m->status,d0,d1,dampPedalDownFl,softPedalDownFl,sostPedalDownFl); + rc = file::printf(fH, "%i,%i,%i,%i,0,%f,0.0,0.0,0,%s,,%i,%i,%i,%i,,%s,,,%i,%i,%i\n", + bar,i,1,loc,secs,sciPitch,dlevel,m->status,d0,d1,sectionLabel,dampPedalDownFl,softPedalDownFl,sostPedalDownFl); } else {