From db3755d8db3b8aa3c1e584009e3f18f0763edebb Mon Sep 17 00:00:00 2001 From: kevin Date: Wed, 16 Apr 2025 15:22:14 -0400 Subject: [PATCH] cwPresetSel.h/cpp : Aded preset_dry_index(), preset_sel(), fragment_report() --- cwPresetSel.cpp | 35 +++++++++++++++++++++++++++++++++-- cwPresetSel.h | 4 ++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/cwPresetSel.cpp b/cwPresetSel.cpp index f8235b0..2f21959 100644 --- a/cwPresetSel.cpp +++ b/cwPresetSel.cpp @@ -211,6 +211,8 @@ namespace cw { unsigned order = _get_preset_order(f->presetA + i, f->presetN-1); + f->presetA[i].prob_dom_idx = kInvalidIdx; + if( order > 0 ) { if( order> 0 && activeOrderA[order]==0 ) @@ -247,8 +249,6 @@ namespace cw preset_t* preset = f->presetA + activeIdxA[i]; unsigned order = _get_preset_order( preset, f->presetN-1); - preset->prob_dom_idx = i; - f->probDomA[i].index = activeIdxA[i]; f->probDomA[i].order = preset->playFl ? 0 : order; f->probDomA[i].domain = order==0 ? 1 : common_mult / order; @@ -262,6 +262,13 @@ namespace cw assert( f->probDomN>=1 && f->probDomA != nullptr ); + + for(unsigned i=0; iprobDomN; ++i) + { + assert( f->probDomA[i].index != kInvalidIdx && f->probDomA[i].index < f->presetN ); + f->presetA[ f->probDomA[i].index ].prob_dom_idx = i; + } + errLabel: if( rc != kOkRC ) @@ -1287,6 +1294,19 @@ const char* cw::preset_sel::preset_label( handle_t h, unsigned preset_idx ) return _preset_label(p,preset_idx); } +unsigned cw::preset_sel::preset_index( handle_t h, const char* preset_label ) +{ + preset_sel_t* p = _handleToPtr(h); + return _preset_label_to_index(p,preset_label); +} + +unsigned cw::preset_sel::dry_preset_index( handle_t h ) +{ + preset_sel_t* p = _handleToPtr(h); + return p->dryPresetIdx; +} + + const cw::flow::preset_order_t* cw::preset_sel::preset_order_array( handle_t h ) { preset_sel_t* p = _handleToPtr(h); @@ -1789,6 +1809,17 @@ unsigned cw::preset_sel::fragment_seq_count( handle_t h, unsigned fragId ) return n; } +void cw::preset_sel::fragment_report( handle_t h, const frag_t* f ) +{ + preset_sel_t* p = _handleToPtr(h); + for(unsigned i=0; ipresetN; ++i) + { + if( f->presetA[i].order > 0 || f->presetA[i].playFl) + cwLogPrint("%s%s%s:%i ", f->presetA[i].playFl ? "(" : "", _preset_label(p,f->presetA[i].preset_idx), f->presetA[i].playFl ? ")" : "",f->presetA[i].order); + } + cwLogPrint("\n"); +} + const cw::flow::preset_order_t* cw::preset_sel::fragment_active_presets( handle_t h, const frag_t* f, unsigned flags, unsigned& count_ref ) { diff --git a/cwPresetSel.h b/cwPresetSel.h index 04a4314..2d1666c 100644 --- a/cwPresetSel.h +++ b/cwPresetSel.h @@ -94,6 +94,8 @@ namespace cw unsigned preset_count( handle_t h ); const char* preset_label( handle_t h, unsigned preset_idx ); + unsigned preset_index( handle_t h, const char* label ); + unsigned dry_preset_index( handle_t h ); // Return preset_order[ preset_count() ] w/ all order's = 1 const flow::preset_order_t* preset_order_array( handle_t h ); @@ -155,6 +157,8 @@ namespace cw // Return the count of presets whose 'seqFl' is set. unsigned fragment_seq_count( handle_t h, unsigned fragId ); + void fragment_report( handle_t h, const frag_t* f ); + enum { kAllActiveFl = 0x01, kDryPriorityFl = 0x02,