diff --git a/cwScoreFollower.cpp b/cwScoreFollower.cpp index 036309e..436ba91 100644 --- a/cwScoreFollower.cpp +++ b/cwScoreFollower.cpp @@ -422,6 +422,46 @@ void cw::score_follower::clear_match_id_array( handle_t h ) p->match_id_curN = 0; } +cw::rc_t cw::score_follower::cw_loc_range( handle_t h, unsigned& minLocRef, unsigned& maxLocRef ) +{ + rc_t rc = kOkRC; + score_follower_t* p = _handleToPtr(h); + + minLocRef = kInvalidId; + maxLocRef = kInvalidId; + + if( p->cwLocToCmLocA==nullptr || p->cwLocToCmLocN == 0 ) + { + rc = cwLogError(kInvalidStateRC,"The cw location range is not yet set."); + goto errLabel; + } + + minLocRef = 1; + maxLocRef = p->cwLocToCmLocN-1; + + errLabel: + return rc; +} + +bool cw::score_follower::is_loc_in_range( handle_t h, unsigned loc ) +{ + rc_t rc; + unsigned minLoc = 0; + unsigned maxLoc = 0; + + if((rc = cw_loc_range(h,minLoc,maxLoc)) != kOkRC ) + return false; + + return minLoc <= loc && loc <= maxLoc; +} + +unsigned cw::score_follower::has_stored_performance( handle_t h ) +{ + score_follower_t* p = _handleToPtr(h); + return p->perf_idx > 0; +} + + cw::rc_t cw::score_follower::write_svg_file( handle_t h, const char* out_fname, bool show_muid_fl ) { score_follower_t* p = _handleToPtr(h); diff --git a/cwScoreFollower.h b/cwScoreFollower.h index 737ccf1..7555367 100644 --- a/cwScoreFollower.h +++ b/cwScoreFollower.h @@ -24,6 +24,12 @@ namespace cw // Clear the match id array. This should be done to empty the current_match_id_array() void clear_match_id_array( handle_t h ); + + rc_t cw_loc_range( handle_t h, unsigned& minLocRef, unsigned& maxLocRef ); + bool is_loc_in_range( handle_t h, unsigned loc ); + + unsigned has_stored_performance( handle_t h ); + // Write an SVG file containing a graphic view of the score following results since the last call to reset(). // Set show_muid_fl to true to display the 'muid' of the performed notes in the // SVG rendering, otherwise the performed note sequence (order of arrival) id is shown.