cwPresetSel.h/cpp : Aded preset_dry_index(), preset_sel(), fragment_report()

This commit is contained in:
kevin 2025-04-16 15:22:14 -04:00
parent ae24afd2ae
commit db3755d8db
2 changed files with 37 additions and 2 deletions

View File

@ -211,6 +211,8 @@ namespace cw
{ {
unsigned order = _get_preset_order(f->presetA + i, f->presetN-1); unsigned order = _get_preset_order(f->presetA + i, f->presetN-1);
f->presetA[i].prob_dom_idx = kInvalidIdx;
if( order > 0 ) if( order > 0 )
{ {
if( order> 0 && activeOrderA[order]==0 ) if( order> 0 && activeOrderA[order]==0 )
@ -247,8 +249,6 @@ namespace cw
preset_t* preset = f->presetA + activeIdxA[i]; preset_t* preset = f->presetA + activeIdxA[i];
unsigned order = _get_preset_order( preset, f->presetN-1); unsigned order = _get_preset_order( preset, f->presetN-1);
preset->prob_dom_idx = i;
f->probDomA[i].index = activeIdxA[i]; f->probDomA[i].index = activeIdxA[i];
f->probDomA[i].order = preset->playFl ? 0 : order; f->probDomA[i].order = preset->playFl ? 0 : order;
f->probDomA[i].domain = order==0 ? 1 : common_mult / order; f->probDomA[i].domain = order==0 ? 1 : common_mult / order;
@ -262,6 +262,13 @@ namespace cw
assert( f->probDomN>=1 && f->probDomA != nullptr ); assert( f->probDomN>=1 && f->probDomA != nullptr );
for(unsigned i=0; i<f->probDomN; ++i)
{
assert( f->probDomA[i].index != kInvalidIdx && f->probDomA[i].index < f->presetN );
f->presetA[ f->probDomA[i].index ].prob_dom_idx = i;
}
errLabel: errLabel:
if( rc != kOkRC ) 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); 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 ) const cw::flow::preset_order_t* cw::preset_sel::preset_order_array( handle_t h )
{ {
preset_sel_t* p = _handleToPtr(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; 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; i<f->presetN; ++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 ) const cw::flow::preset_order_t* cw::preset_sel::fragment_active_presets( handle_t h, const frag_t* f, unsigned flags, unsigned& count_ref )
{ {

View File

@ -94,6 +94,8 @@ namespace cw
unsigned preset_count( handle_t h ); unsigned preset_count( handle_t h );
const char* preset_label( handle_t h, unsigned preset_idx ); 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 // Return preset_order[ preset_count() ] w/ all order's = 1
const flow::preset_order_t* preset_order_array( handle_t h ); 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. // Return the count of presets whose 'seqFl' is set.
unsigned fragment_seq_count( handle_t h, unsigned fragId ); unsigned fragment_seq_count( handle_t h, unsigned fragId );
void fragment_report( handle_t h, const frag_t* f );
enum { enum {
kAllActiveFl = 0x01, kAllActiveFl = 0x01,
kDryPriorityFl = 0x02, kDryPriorityFl = 0x02,