Merge branch 'master' of gitea.larke.org:kevin/libcw
This commit is contained in:
commit
32ed80183b
@ -1871,9 +1871,10 @@ cw::rc_t cw::flow::apply_preset( handle_t h, const multi_preset_selector_t& mps
|
|||||||
bool secProbFl = cwIsFlag(mps.flags, kSecPresetProbFl );
|
bool secProbFl = cwIsFlag(mps.flags, kSecPresetProbFl );
|
||||||
bool interpFl = cwIsFlag(mps.flags, kInterpPresetFl );
|
bool interpFl = cwIsFlag(mps.flags, kInterpPresetFl );
|
||||||
bool allFl = cwIsFlag(mps.flags, kAllowAllPresetFl);
|
bool allFl = cwIsFlag(mps.flags, kAllowAllPresetFl);
|
||||||
bool dryFl = cwIsFlag(mps.flags, kDryPriorityPresetFl);
|
bool dryPrioFl = cwIsFlag(mps.flags, kDryPriorityPresetFl);
|
||||||
|
bool drySelFl = cwIsFlag(mps.flags, kDrySelectedPresetFl);
|
||||||
|
|
||||||
printf("preset flags: pri:%i sec:%i interp:%i all:%i dry:%i\n",priProbFl,secProbFl,interpFl,allFl,dryFl);
|
printf("preset flags: pri:%i sec:%i interp:%i all:%i dry-(prio:%i sel:%i) n:%i\n",priProbFl,secProbFl,interpFl,allFl,dryPrioFl,drySelFl,mps.presetN);
|
||||||
|
|
||||||
// verify that the set of candidate presets is not empty
|
// verify that the set of candidate presets is not empty
|
||||||
if( mps.presetN == 0 )
|
if( mps.presetN == 0 )
|
||||||
|
@ -10,7 +10,8 @@ namespace cw
|
|||||||
kSecPresetProbFl = 0x02,
|
kSecPresetProbFl = 0x02,
|
||||||
kInterpPresetFl = 0x04,
|
kInterpPresetFl = 0x04,
|
||||||
kAllowAllPresetFl = 0x08,
|
kAllowAllPresetFl = 0x08,
|
||||||
kDryPriorityPresetFl = 0x10
|
kDryPriorityPresetFl = 0x10,
|
||||||
|
kDrySelectedPresetFl = 0x20,
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct preset_order_str
|
typedef struct preset_order_str
|
||||||
|
@ -90,6 +90,7 @@ namespace cw
|
|||||||
kPresetInterpCheckId,
|
kPresetInterpCheckId,
|
||||||
kPresetAllowAllCheckId,
|
kPresetAllowAllCheckId,
|
||||||
kPresetDryPriorityCheckId,
|
kPresetDryPriorityCheckId,
|
||||||
|
kPresetDrySelectedCheckId,
|
||||||
|
|
||||||
|
|
||||||
kEnaRecordCheckId,
|
kEnaRecordCheckId,
|
||||||
@ -202,6 +203,7 @@ namespace cw
|
|||||||
{ kPanelDivId, kPresetInterpCheckId, "presetInterpCheckId" },
|
{ kPanelDivId, kPresetInterpCheckId, "presetInterpCheckId" },
|
||||||
{ kPanelDivId, kPresetAllowAllCheckId, "presetAllowAllCheckId" },
|
{ kPanelDivId, kPresetAllowAllCheckId, "presetAllowAllCheckId" },
|
||||||
{ kPanelDivId, kPresetDryPriorityCheckId, "presetDryPriorityCheckId" },
|
{ kPanelDivId, kPresetDryPriorityCheckId, "presetDryPriorityCheckId" },
|
||||||
|
{ kPanelDivId, kPresetDrySelectedCheckId, "presetDrySelectedCheckId" },
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -938,14 +940,16 @@ namespace cw
|
|||||||
{
|
{
|
||||||
unsigned multiPresetN = 0;
|
unsigned multiPresetN = 0;
|
||||||
|
|
||||||
// allow-any-fl = pri-prob-fl && allow-any-flag
|
// allow-any,dry-priority,dry-selected may only be set when pri-prob is set
|
||||||
bool allowAnyFl = cwIsFlag(app->multiPresetFlags,flow::kAllowAllPresetFl) && cwIsFlag(app->multiPresetFlags,flow::kPriPresetProbFl);
|
bool allowAnyFl = cwIsFlag(app->multiPresetFlags,flow::kAllowAllPresetFl) && cwIsFlag(app->multiPresetFlags,flow::kPriPresetProbFl);
|
||||||
bool dryPriorityFl = cwIsFlag(app->multiPresetFlags,flow::kDryPriorityPresetFl) && cwIsFlag(app->multiPresetFlags,flow::kPriPresetProbFl);
|
bool dryPriorityFl = cwIsFlag(app->multiPresetFlags,flow::kDryPriorityPresetFl) && cwIsFlag(app->multiPresetFlags,flow::kPriPresetProbFl);
|
||||||
|
bool drySelectedFl = cwIsFlag(app->multiPresetFlags,flow::kDrySelectedPresetFl) && cwIsFlag(app->multiPresetFlags,flow::kPriPresetProbFl);
|
||||||
|
|
||||||
unsigned activePresetFlags = 0;
|
unsigned activePresetFlags = 0;
|
||||||
|
|
||||||
activePresetFlags = cwEnaFlag(activePresetFlags, preset_sel::kAllActiveFl, allowAnyFl);
|
activePresetFlags = cwEnaFlag(activePresetFlags, preset_sel::kAllActiveFl, allowAnyFl);
|
||||||
activePresetFlags = cwEnaFlag(activePresetFlags, preset_sel::kDryPriorityFl, dryPriorityFl);
|
activePresetFlags = cwEnaFlag(activePresetFlags, preset_sel::kDryPriorityFl, dryPriorityFl);
|
||||||
|
activePresetFlags = cwEnaFlag(activePresetFlags, preset_sel::kDrySelectedFl, drySelectedFl);
|
||||||
|
|
||||||
flow::multi_preset_selector_t mp_sel =
|
flow::multi_preset_selector_t mp_sel =
|
||||||
{ .flags = app->multiPresetFlags,
|
{ .flags = app->multiPresetFlags,
|
||||||
@ -3053,6 +3057,12 @@ rc_t _on_ui_play_loc(app_t* app, unsigned appId, unsigned loc);
|
|||||||
if((rc = _fragment_load_data(app)) != kOkRC )
|
if((rc = _fragment_load_data(app)) != kOkRC )
|
||||||
rc = cwLogError(rc,"Preset data restore failed.");
|
rc = cwLogError(rc,"Preset data restore failed.");
|
||||||
|
|
||||||
|
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kPresetInterpCheckId ), false );
|
||||||
|
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kPresetAllowAllCheckId ), false );
|
||||||
|
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kPresetDryPriorityCheckId ), false );
|
||||||
|
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kPresetDrySelectedCheckId ), false );
|
||||||
|
|
||||||
|
|
||||||
_on_live_midi_checkbox(app,app->useLiveMidiFl);
|
_on_live_midi_checkbox(app,app->useLiveMidiFl);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
@ -3122,10 +3132,17 @@ rc_t _on_ui_play_loc(app_t* app, unsigned appId, unsigned loc);
|
|||||||
|
|
||||||
case kPriPresetProbCheckId:
|
case kPriPresetProbCheckId:
|
||||||
app->multiPresetFlags = cwEnaFlag(app->multiPresetFlags,flow::kPriPresetProbFl,m.value->u.b);
|
app->multiPresetFlags = cwEnaFlag(app->multiPresetFlags,flow::kPriPresetProbFl,m.value->u.b);
|
||||||
|
|
||||||
|
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kPresetAllowAllCheckId ), m.value->u.b );
|
||||||
|
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kPresetDrySelectedCheckId ), m.value->u.b );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kSecPresetProbCheckId:
|
case kSecPresetProbCheckId:
|
||||||
app->multiPresetFlags = cwEnaFlag(app->multiPresetFlags,flow::kSecPresetProbFl,m.value->u.b);
|
app->multiPresetFlags = cwEnaFlag(app->multiPresetFlags,flow::kSecPresetProbFl,m.value->u.b);
|
||||||
|
|
||||||
|
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kPresetInterpCheckId ), m.value->u.b );
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kPresetInterpCheckId:
|
case kPresetInterpCheckId:
|
||||||
@ -3134,12 +3151,16 @@ rc_t _on_ui_play_loc(app_t* app, unsigned appId, unsigned loc);
|
|||||||
|
|
||||||
case kPresetAllowAllCheckId:
|
case kPresetAllowAllCheckId:
|
||||||
app->multiPresetFlags = cwEnaFlag(app->multiPresetFlags,flow::kAllowAllPresetFl,m.value->u.b);
|
app->multiPresetFlags = cwEnaFlag(app->multiPresetFlags,flow::kAllowAllPresetFl,m.value->u.b);
|
||||||
|
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kPresetDryPriorityCheckId ), m.value->u.b );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kPresetDryPriorityCheckId:
|
case kPresetDryPriorityCheckId:
|
||||||
app->multiPresetFlags = cwEnaFlag(app->multiPresetFlags,flow::kDryPriorityPresetFl,m.value->u.b);
|
app->multiPresetFlags = cwEnaFlag(app->multiPresetFlags,flow::kDryPriorityPresetFl,m.value->u.b);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case kPresetDrySelectedCheckId:
|
||||||
|
app->multiPresetFlags = cwEnaFlag(app->multiPresetFlags,flow::kDrySelectedPresetFl,m.value->u.b);
|
||||||
|
break;
|
||||||
|
|
||||||
case kMidiThruCheckId:
|
case kMidiThruCheckId:
|
||||||
cwLogInfo("MIDI thru:%i",m.value->u.b);
|
cwLogInfo("MIDI thru:%i",m.value->u.b);
|
||||||
@ -3405,6 +3426,10 @@ rc_t _on_ui_play_loc(app_t* app, unsigned appId, unsigned loc);
|
|||||||
io::uiSendValue( app->ioH, m.uuId, preset_cfg_flags(app->ioFlowH) & flow::kDryPriorityPresetFl );
|
io::uiSendValue( app->ioH, m.uuId, preset_cfg_flags(app->ioFlowH) & flow::kDryPriorityPresetFl );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case kPresetDrySelectedCheckId:
|
||||||
|
io::uiSendValue( app->ioH, m.uuId, preset_cfg_flags(app->ioFlowH) & flow::kDrySelectedPresetFl );
|
||||||
|
break;
|
||||||
|
|
||||||
case kWetInGainId:
|
case kWetInGainId:
|
||||||
_on_echo_master_value( app, preset_sel::kMasterWetInGainVarId, m.uuId );
|
_on_echo_master_value( app, preset_sel::kMasterWetInGainVarId, m.uuId );
|
||||||
break;
|
break;
|
||||||
|
@ -41,6 +41,7 @@ namespace cw
|
|||||||
|
|
||||||
flow::preset_order_t* presetOrderA; // presetOrderA[ presetLabelN ]
|
flow::preset_order_t* presetOrderA; // presetOrderA[ presetLabelN ]
|
||||||
flow::preset_order_t* multiPresetA; // activePresetA[ presetLabelN ]
|
flow::preset_order_t* multiPresetA; // activePresetA[ presetLabelN ]
|
||||||
|
flow::preset_order_t* dryPresetOrder; // pointer to the dry preset in presetOrderA[]
|
||||||
|
|
||||||
alt_label_t* altLabelA;
|
alt_label_t* altLabelA;
|
||||||
unsigned altLabelN;
|
unsigned altLabelN;
|
||||||
@ -928,6 +929,9 @@ cw::rc_t cw::preset_sel::create( handle_t& hRef, const object_t* cfg )
|
|||||||
p->presetLabelA[i].label = mem::duplStr(label);
|
p->presetLabelA[i].label = mem::duplStr(label);
|
||||||
p->presetOrderA[i].preset_label = p->presetLabelA[i].label;
|
p->presetOrderA[i].preset_label = p->presetLabelA[i].label;
|
||||||
p->presetOrderA[i].order = 1;
|
p->presetOrderA[i].order = 1;
|
||||||
|
|
||||||
|
if( textIsEqual(p->presetOrderA[i].preset_label,"dry") )
|
||||||
|
p->dryPresetOrder = p->presetOrderA + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -964,6 +968,8 @@ cw::rc_t cw::preset_sel::create( handle_t& hRef, const object_t* cfg )
|
|||||||
if( p->defaultPresetIdx == kInvalidIdx )
|
if( p->defaultPresetIdx == kInvalidIdx )
|
||||||
cwLogError(kInvalidStateRC,"No default preset was set.");
|
cwLogError(kInvalidStateRC,"No default preset was set.");
|
||||||
|
|
||||||
|
if( p->dryPresetOrder == nullptr )
|
||||||
|
rc = cwLogError(kInvalidStateRC,"The 'dry' preset was not found.");
|
||||||
|
|
||||||
|
|
||||||
hRef.set(p);
|
hRef.set(p);
|
||||||
@ -1536,13 +1542,28 @@ const cw::flow::preset_order_t* cw::preset_sel::fragment_active_presets( handle
|
|||||||
|
|
||||||
count_ref = 0;
|
count_ref = 0;
|
||||||
|
|
||||||
// if this is a dry-only fragment and dryOnlFy is set or if all active flag is not set
|
// Note that kAllActiveFl,kDryPriorityFl,kDrySelectedFl will only be set
|
||||||
if( (cwIsFlag(flags,kDryPriorityFl) && f->dryOnlyFl) || cwIsNotFlag(flags,kAllActiveFl) )
|
// when the preset is being selected probabilistically
|
||||||
preset_order = _load_active_multi_preset_array(p,f,flags,count_ref);
|
|
||||||
|
// if this fragment is dry-selected or dry-only and the associated flags are set
|
||||||
|
// then select then return the 'dry' preset
|
||||||
|
if( (cwIsFlag(flags,kDrySelectedFl) && f->drySelectedFl) || (cwIsFlag(flags,kDryPriorityFl) && f->dryOnlyFl) )
|
||||||
|
{
|
||||||
|
preset_order = p->dryPresetOrder;
|
||||||
|
count_ref = 1;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
preset_order = p->presetOrderA;
|
// if all active is set then return all presets ...
|
||||||
count_ref = p->presetLabelN;
|
if( cwIsFlag(flags,kAllActiveFl) )
|
||||||
|
{
|
||||||
|
preset_order = p->presetOrderA;
|
||||||
|
count_ref = p->presetLabelN;
|
||||||
|
}
|
||||||
|
else // ... otherwise return the active presets only
|
||||||
|
{
|
||||||
|
preset_order = _load_active_multi_preset_array(p,f,flags,count_ref);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return preset_order;
|
return preset_order;
|
||||||
@ -1762,12 +1783,18 @@ cw::rc_t cw::preset_sel::read( handle_t h, const char* fn )
|
|||||||
_set_alt_str( p, f, i, alt_str );
|
_set_alt_str( p, f, i, alt_str );
|
||||||
|
|
||||||
if( playFl )
|
if( playFl )
|
||||||
|
{
|
||||||
f->altPresetIdxA[0] = preset_idx;
|
f->altPresetIdxA[0] = preset_idx;
|
||||||
|
|
||||||
|
// if the dry preset is selected
|
||||||
|
if( preset_idx == dryPresetIdx )
|
||||||
|
f->drySelectedFl = true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if only one preset is active and the dry preset is active
|
// if only one preset is active and the dry preset is active
|
||||||
f->dryOnlyFl = activePresetN==1 && (f->presetA[dryPresetIdx].order>0 || f->presetA[dryPresetIdx].playFl);
|
f->dryOnlyFl = activePresetN==1 && (f->presetA[dryPresetIdx].order>0 || f->presetA[dryPresetIdx].playFl);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1795,7 +1822,7 @@ cw::rc_t cw::preset_sel::report( handle_t h )
|
|||||||
unsigned elapsedMs = time::elapsedMs(t0,f->endTimestamp);
|
unsigned elapsedMs = time::elapsedMs(t0,f->endTimestamp);
|
||||||
double mins = elapsedMs / 60000.0;
|
double mins = elapsedMs / 60000.0;
|
||||||
|
|
||||||
cwLogInfo("%3i id:%3i end loc:%3i end min:%f dry-only:%i",i,f->fragId,f->endLoc, mins, f->dryOnlyFl);
|
cwLogInfo("%3i id:%3i end loc:%3i end min:%f dry-only:%i dry-sel:%i",i,f->fragId,f->endLoc, mins, f->dryOnlyFl, f->drySelectedFl);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
@ -1810,8 +1837,9 @@ cw::rc_t cw::preset_sel::report_presets( handle_t h )
|
|||||||
|
|
||||||
for(; f!=nullptr; f=f->link)
|
for(; f!=nullptr; f=f->link)
|
||||||
{
|
{
|
||||||
const char* dry_label = f->dryOnlyFl ? "dry" : "";
|
const char* dry_only_label = f->dryOnlyFl ? "only" : "";
|
||||||
cwLogPrint("%5i %5i %3s ",beg_loc,f->endLoc,dry_label);
|
const char* dry_sel_label = f->drySelectedFl ? "sel" : "";
|
||||||
|
cwLogPrint("%5i %5i dry-(%4s %3s)",beg_loc,f->endLoc,dry_only_label,dry_sel_label);
|
||||||
for(unsigned i=0; i<f->presetN; ++i)
|
for(unsigned i=0; i<f->presetN; ++i)
|
||||||
if( f->presetA[i].playFl || f->presetA[i].order!=0 )
|
if( f->presetA[i].playFl || f->presetA[i].order!=0 )
|
||||||
cwLogPrint("(%s-%i) ", p->presetLabelA[ f->presetA[i].preset_idx ].label, f->presetA[i].order);
|
cwLogPrint("(%s-%i) ", p->presetLabelA[ f->presetA[i].preset_idx ].label, f->presetA[i].order);
|
||||||
|
@ -32,7 +32,9 @@ namespace cw
|
|||||||
unsigned endPlayLoc;
|
unsigned endPlayLoc;
|
||||||
char* note;
|
char* note;
|
||||||
|
|
||||||
bool dryOnlyFl;
|
bool dryOnlyFl; // there is one active preset and it is dry
|
||||||
|
bool drySelectedFl; // the dry preset was selected ('playFl' is set)
|
||||||
|
|
||||||
preset_t* presetA; // presetA[ presetN ] - status of each preset
|
preset_t* presetA; // presetA[ presetN ] - status of each preset
|
||||||
unsigned presetN;
|
unsigned presetN;
|
||||||
|
|
||||||
@ -140,8 +142,9 @@ namespace cw
|
|||||||
unsigned fragment_seq_count( handle_t h, unsigned fragId );
|
unsigned fragment_seq_count( handle_t h, unsigned fragId );
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
kAllActiveFl = 0x01,
|
kAllActiveFl = 0x01,
|
||||||
kDryPriorityFl = 0x02
|
kDryPriorityFl = 0x02,
|
||||||
|
kDrySelectedFl = 0x04
|
||||||
};
|
};
|
||||||
|
|
||||||
const flow::preset_order_t* fragment_active_presets( handle_t h, const frag_t* f, unsigned flags, unsigned& count_ref );
|
const flow::preset_order_t* fragment_active_presets( handle_t h, const frag_t* f, unsigned flags, unsigned& count_ref );
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
check: { name: presetInterpCheckId, title: "Interp:"},
|
check: { name: presetInterpCheckId, title: "Interp:"},
|
||||||
check: { name: presetAllowAllCheckId, title: "Allow All:" },
|
check: { name: presetAllowAllCheckId, title: "Allow All:" },
|
||||||
check: { name: presetDryPriorityCheckId,title: "Dry Priority:" },
|
check: { name: presetDryPriorityCheckId,title: "Dry Priority:" },
|
||||||
|
check: { name: presetDrySelectedCheckId,title: "Dry Selected:" },
|
||||||
},
|
},
|
||||||
|
|
||||||
row: {
|
row: {
|
||||||
|
Loading…
Reference in New Issue
Block a user