From 0eea3aeb42afb708f6a556899be33a1d437bb2e8 Mon Sep 17 00:00:00 2001 From: kevin Date: Tue, 27 Jun 2023 17:26:32 -0400 Subject: [PATCH] cwScoreFollower.h/cpp : Added ability to enable/disable the score follower via the cfg. arg. --- cwScoreFollower.cpp | 14 +++++++++++++- cwScoreFollower.h | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/cwScoreFollower.cpp b/cwScoreFollower.cpp index 5424995..c70402a 100644 --- a/cwScoreFollower.cpp +++ b/cwScoreFollower.cpp @@ -39,6 +39,7 @@ namespace cw { typedef struct score_follower_str { + bool enableFl; double srate; unsigned search_area_locN; unsigned key_wnd_locN; @@ -74,7 +75,8 @@ namespace cw const char* cm_score_csv_fname; - if((rc = cfg->getv("cm_score_csv_fname", cm_score_csv_fname, + if((rc = cfg->getv("enable_flag", p->enableFl, + "cm_score_csv_fname", cm_score_csv_fname, "search_area_locN", p->search_area_locN, "key_wnd_locN", p->key_wnd_locN )) != kOkRC ) { @@ -324,6 +326,12 @@ cw::rc_t cw::score_follower::destroy( handle_t& hRef ) return rc; } +bool cw::score_follower::is_enabled( handle_t h ) +{ + score_follower_t* p = _handleToPtr(h); + return p->enableFl; +} + cw::rc_t cw::score_follower::reset( handle_t h, unsigned cwLocId ) { rc_t rc = kOkRC; @@ -363,6 +371,10 @@ cw::rc_t cw::score_follower::exec( handle_t h, double sec, unsigned smpIdx, uns unsigned scLocIdx = cmInvalidIdx; unsigned pre_match_id_curN = p->match_id_curN; + if( !p->enableFl ) + return cwLogError(kInvalidStateRC,"The score follower is not enabled."); + + newMatchFlRef = false; // Note: pass p->perf_idx as 'muid' to the score follower diff --git a/cwScoreFollower.h b/cwScoreFollower.h index 1a7e8b6..ff3e8ef 100644 --- a/cwScoreFollower.h +++ b/cwScoreFollower.h @@ -11,6 +11,8 @@ namespace cw rc_t destroy( handle_t& hRef ); + bool is_enabled( handle_t h ); + // Set the starting search location and calls clear_match_id_array(). rc_t reset( handle_t h, unsigned loc );