diff --git a/cwPresetSel.cpp b/cwPresetSel.cpp index 7c468c5..7335b9a 100644 --- a/cwPresetSel.cpp +++ b/cwPresetSel.cpp @@ -910,8 +910,12 @@ bool cw::preset_sel::track_loc( handle_t h, unsigned loc, const cw::preset_sel:: // if 'f' is valid but different from 'last_ts_frag' if( f != nullptr && f != p->last_ts_frag ) { - p->last_ts_frag = f; - frag_changed_fl = true; + // don't allow the selected fragment to go backwards + if( p->last_ts_frag == nullptr || (p->last_ts_frag != nullptr && p->last_ts_frag->endLoc < f->endLoc) ) + { + p->last_ts_frag = f; + frag_changed_fl = true; + } } frag_Ref = p->last_ts_frag; diff --git a/cwPresetSel.h b/cwPresetSel.h index e99f0cb..e16d791 100644 --- a/cwPresetSel.h +++ b/cwPresetSel.h @@ -115,6 +115,7 @@ namespace cw void track_timestamp_reset( handle_t h ); bool track_timestamp( handle_t h, const time::spec_t& ts, const cw::preset_sel::frag_t*& frag_Ref ); + // Same as track_timestamp_???() but tracks the score 'loc' instead of timestamp. void track_loc_reset( handle_t h ); bool track_loc( handle_t h, unsigned loc, const cw::preset_sel::frag_t*& frag_Ref );