cwFlow,cwFlowDecls,cwIoPresetIo.cpp,cwPreset, ui.cfg : Added 'dry-priority' flag.

Added Preset,IO realtime, MRP report buttons.
Changed main window layout slightly.
This commit is contained in:
kevin 2024-05-04 10:27:51 -04:00
parent 0f41dfbcbd
commit 4ff1ec578e
6 changed files with 128 additions and 75 deletions

View File

@ -1870,8 +1870,10 @@ cw::rc_t cw::flow::apply_preset( handle_t h, const multi_preset_selector_t& mps
bool priProbFl = cwIsFlag(mps.flags, kPriPresetProbFl ); bool priProbFl = cwIsFlag(mps.flags, kPriPresetProbFl );
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 dryFl = cwIsFlag(mps.flags, kDryPriorityPresetFl);
//printf("preset flags: pri:%i sec:%i interp:%i\n",priProbFl,secProbFl,interpFl); printf("preset flags: pri:%i sec:%i interp:%i all:%i dry:%i\n",priProbFl,secProbFl,interpFl,allFl,dryFl);
// 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 )

View File

@ -6,10 +6,11 @@ namespace cw
namespace flow namespace flow
{ {
enum { enum {
kPriPresetProbFl = 0x01, kPriPresetProbFl = 0x01,
kSecPresetProbFl = 0x02, kSecPresetProbFl = 0x02,
kInterpPresetFl = 0x04, kInterpPresetFl = 0x04,
kAllowAllPresetFl = 0x08 kAllowAllPresetFl = 0x08,
kDryPriorityPresetFl = 0x10
}; };
typedef struct preset_order_str typedef struct preset_order_str

View File

@ -47,6 +47,9 @@ namespace cw
kPanelDivId = 1000, kPanelDivId = 1000,
kQuitBtnId, kQuitBtnId,
kIoReportBtnId, kIoReportBtnId,
kIoRtReportBtnId,
kPresetReportBtnId,
kMRP_ReportBtnId,
kNetPrintBtnId, kNetPrintBtnId,
kReportBtnId, kReportBtnId,
kLatencyBtnId, kLatencyBtnId,
@ -85,6 +88,7 @@ namespace cw
kSecPresetProbCheckId, kSecPresetProbCheckId,
kPresetInterpCheckId, kPresetInterpCheckId,
kPresetAllowAllCheckId, kPresetAllowAllCheckId,
kPresetDryPriorityCheckId,
kEnaRecordCheckId, kEnaRecordCheckId,
@ -155,8 +159,11 @@ namespace cw
{ ui::kRootAppId, kPanelDivId, "panelDivId" }, { ui::kRootAppId, kPanelDivId, "panelDivId" },
{ kPanelDivId, kQuitBtnId, "quitBtnId" }, { kPanelDivId, kQuitBtnId, "quitBtnId" },
{ kPanelDivId, kIoReportBtnId, "ioReportBtnId" }, { kPanelDivId, kIoReportBtnId, "ioReportBtnId" },
{ kPanelDivId, kIoRtReportBtnId,"ioRtReportBtnId" },
{ kPanelDivId, kNetPrintBtnId, "netPrintBtnId" }, { kPanelDivId, kNetPrintBtnId, "netPrintBtnId" },
{ kPanelDivId, kReportBtnId, "reportBtnId" }, { kPanelDivId, kReportBtnId, "reportBtnId" },
{ kPanelDivId, kPresetReportBtnId, "presetReportBtnId" },
{ kPanelDivId, kMRP_ReportBtnId, "MRP_ReportBtnId" },
{ kPanelDivId, kLatencyBtnId, "latencyBtnId" }, { kPanelDivId, kLatencyBtnId, "latencyBtnId" },
{ kPanelDivId, kStartBtnId, "startBtnId" }, { kPanelDivId, kStartBtnId, "startBtnId" },
@ -191,6 +198,8 @@ namespace cw
{ kPanelDivId, kSecPresetProbCheckId, "presetProbSecCheckId" }, { kPanelDivId, kSecPresetProbCheckId, "presetProbSecCheckId" },
{ kPanelDivId, kPresetInterpCheckId, "presetInterpCheckId" }, { kPanelDivId, kPresetInterpCheckId, "presetInterpCheckId" },
{ kPanelDivId, kPresetAllowAllCheckId, "presetAllowAllCheckId" }, { kPanelDivId, kPresetAllowAllCheckId, "presetAllowAllCheckId" },
{ kPanelDivId, kPresetDryPriorityCheckId, "presetDryPriorityCheckId" },
{ kPanelDivId, kEnaRecordCheckId, "enaRecordCheckId" }, { kPanelDivId, kEnaRecordCheckId, "enaRecordCheckId" },
@ -926,16 +935,23 @@ namespace cw
{ {
unsigned multiPresetN = 0; unsigned multiPresetN = 0;
bool allowAnyFl = cwIsFlag(app->multiPresetFlags,flow::kAllowAllPresetFl) && cwIsFlag(app->multiPresetFlags,flow::kPriPresetProbFl); // allow-any-fl = pri-prob-fl && allow-any-flag
bool allowAnyFl = cwIsFlag(app->multiPresetFlags,flow::kAllowAllPresetFl) && cwIsFlag(app->multiPresetFlags,flow::kPriPresetProbFl);
bool dryPriorityFl = cwIsFlag(app->multiPresetFlags,flow::kDryPriorityPresetFl) && cwIsFlag(app->multiPresetFlags,flow::kPriPresetProbFl);
unsigned activePresetFlags = 0;
activePresetFlags = cwEnaFlag(activePresetFlags, preset_sel::kAllActiveFl, allowAnyFl);
activePresetFlags = cwEnaFlag(activePresetFlags, preset_sel::kDryPriorityFl, dryPriorityFl);
flow::multi_preset_selector_t mp_sel = flow::multi_preset_selector_t mp_sel =
{ .flags = app->multiPresetFlags, { .flags = app->multiPresetFlags,
.coeffV = score_evt->featV, .coeffV = score_evt->featV,
.coeffMinV = score_evt->featMinV, .coeffMinV = score_evt->featMinV,
.coeffMaxV = score_evt->featMaxV, .coeffMaxV = score_evt->featMaxV,
.coeffN = perf_meas::kValCnt, .coeffN = perf_meas::kValCnt,
.presetA = allowAnyFl ? preset_order_array(app->psH) : fragment_active_presets(app->psH,frag,multiPresetN), .presetA = fragment_active_presets(app->psH,frag,activePresetFlags,multiPresetN),
.presetN = allowAnyFl ? preset_count(app->psH) : multiPresetN .presetN = multiPresetN
}; };
if( mp_sel.presetA == nullptr || mp_sel.presetN == 0 ) if( mp_sel.presetA == nullptr || mp_sel.presetN == 0 )
@ -3031,6 +3047,10 @@ rc_t _on_ui_play_loc(app_t* app, unsigned appId, unsigned loc);
io::report( app->ioH ); io::report( app->ioH );
break; break;
case kIoRtReportBtnId:
io::realTimeReport(app->ioH);
break;
case kNetPrintBtnId: case kNetPrintBtnId:
if( app->ioFlowH.isValid() ) if( app->ioFlowH.isValid() )
io_flow::print_network(app->ioFlowH,flow_cross::kCurDestId); io_flow::print_network(app->ioFlowH,flow_cross::kCurDestId);
@ -3045,13 +3065,19 @@ rc_t _on_ui_play_loc(app_t* app, unsigned appId, unsigned loc);
//midi_record_play::save_csv(app->mrpH,"/home/kevin/temp/mrp_1.csv"); //midi_record_play::save_csv(app->mrpH,"/home/kevin/temp/mrp_1.csv");
//printf("%i %i\n",app->beg_play_loc,app->end_play_loc); //printf("%i %i\n",app->beg_play_loc,app->end_play_loc);
//io::realTimeReport(app->ioH); //io::realTimeReport(app->ioH);
//midi_record_play::report(app->mrpH);
//score_follower::write_svg_file(app->sfH,"/home/kevin/temp/temp_sf.html"); //score_follower::write_svg_file(app->sfH,"/home/kevin/temp/temp_sf.html");
//score_follower::midi_state_rt_report( app->sfH, "/home/kevin/temp/temp_midi_state_rt_report.txt" ); //score_follower::midi_state_rt_report( app->sfH, "/home/kevin/temp/temp_midi_state_rt_report.txt" );
//score_follower::score_report(app->sfH,"/home/kevin/temp/temp_cm_score_report.txt"); //score_follower::score_report(app->sfH,"/home/kevin/temp/temp_cm_score_report.txt");
break;
case kPresetReportBtnId:
preset_sel::report_presets(app->psH); preset_sel::report_presets(app->psH);
break; break;
case kMRP_ReportBtnId:
midi_record_play::report(app->mrpH);
break;
case kLatencyBtnId: case kLatencyBtnId:
latency_measure_report(app->ioH); latency_measure_report(app->ioH);
latency_measure_setup(app->ioH); latency_measure_setup(app->ioH);
@ -3085,6 +3111,10 @@ rc_t _on_ui_play_loc(app_t* app, unsigned appId, unsigned loc);
app->multiPresetFlags = cwEnaFlag(app->multiPresetFlags,flow::kAllowAllPresetFl,m.value->u.b); app->multiPresetFlags = cwEnaFlag(app->multiPresetFlags,flow::kAllowAllPresetFl,m.value->u.b);
break; break;
case kPresetDryPriorityCheckId:
app->multiPresetFlags = cwEnaFlag(app->multiPresetFlags,flow::kDryPriorityPresetFl,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);
@ -3341,6 +3371,10 @@ rc_t _on_ui_play_loc(app_t* app, unsigned appId, unsigned loc);
case kPresetAllowAllCheckId: case kPresetAllowAllCheckId:
io::uiSendValue( app->ioH, m.uuId, preset_cfg_flags(app->ioFlowH) & flow::kAllowAllPresetFl ); io::uiSendValue( app->ioH, m.uuId, preset_cfg_flags(app->ioFlowH) & flow::kAllowAllPresetFl );
break; break;
case kPresetDryPriorityCheckId:
io::uiSendValue( app->ioH, m.uuId, preset_cfg_flags(app->ioFlowH) & flow::kDryPriorityPresetFl );
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 );

View File

@ -829,7 +829,7 @@ namespace cw
return e; return e;
} }
const flow::preset_order_t* _load_active_multi_preset_array( preset_sel_t* p, const frag_t* f, unsigned& cnt_ref ) const flow::preset_order_t* _load_active_multi_preset_array( preset_sel_t* p, const frag_t* f, unsigned flags, unsigned& cnt_ref )
{ {
bool has_zero_fl = false; bool has_zero_fl = false;
cnt_ref = 0; cnt_ref = 0;
@ -1516,14 +1516,23 @@ unsigned cw::preset_sel::fragment_seq_count( handle_t h, unsigned fragId )
} }
const cw::flow::preset_order_t* cw::preset_sel::fragment_active_presets( handle_t h, const frag_t* f, 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 )
{ {
preset_sel_t* p = _handleToPtr(h); preset_sel_t* p = _handleToPtr(h);
const flow::preset_order_t* preset_order;
count_ref = 0;
return _load_active_multi_preset_array(p,f,count_ref); count_ref = 0;
// if this is a dry-only fragment and dryOnlFy is set or if all active flag is not set
if( (cwIsFlag(flags,kDryPriorityFl) && f->dryOnlyFl) || cwIsNotFlag(flags,kAllActiveFl) )
preset_order = _load_active_multi_preset_array(p,f,flags,count_ref);
else
{
preset_order = p->presetOrderA;
count_ref = p->presetLabelN;
}
return preset_order;
} }
@ -1607,10 +1616,11 @@ cw::rc_t cw::preset_sel::write( handle_t h, const char* fn )
cw::rc_t cw::preset_sel::read( handle_t h, const char* fn ) cw::rc_t cw::preset_sel::read( handle_t h, const char* fn )
{ {
rc_t rc = kOkRC; rc_t rc = kOkRC;
preset_sel_t* p = _handleToPtr(h); preset_sel_t* p = _handleToPtr(h);
object_t* root = nullptr; object_t* root = nullptr;
const object_t* fragL_obj = nullptr; const object_t* fragL_obj = nullptr;
unsigned dryPresetIdx = _preset_label_to_index(p,"dry");
// parse the preset file // parse the preset file
if((rc = objectFromFile(fn,root)) != kOkRC ) if((rc = objectFromFile(fn,root)) != kOkRC )
@ -1640,11 +1650,19 @@ cw::rc_t cw::preset_sel::read( handle_t h, const char* fn )
frag_t* f = nullptr; frag_t* f = nullptr;
const object_t* r = fragL_obj->child_ele(i); const object_t* r = fragL_obj->child_ele(i);
unsigned fragId=kInvalidId,endLoc=0,presetN=0,multiPresetN=0,begPlayLoc=0,endPlayLoc=0; unsigned fragId = kInvalidId;
double igain=0,ogain=0,wetDryGain=0,fadeOutMs=0; unsigned endLoc = 0;
const char* note = nullptr; unsigned presetN = 0;
const object_t* presetL_obj = nullptr; unsigned activePresetN = 0;
time::spec_t end_ts; unsigned begPlayLoc = 0;
unsigned endPlayLoc = 0;
double igain = 0;
double ogain = 0;
double wetDryGain = 0;
double fadeOutMs = 0;
const char* note = nullptr;
const object_t* presetL_obj = nullptr;
time::spec_t end_ts;
// parse the fragment record // parse the fragment record
if((rc = r->getv("fragId",fragId, if((rc = r->getv("fragId",fragId,
@ -1722,7 +1740,7 @@ cw::rc_t cw::preset_sel::read( handle_t h, const char* fn )
} }
if( order > 0 || playFl ) if( order > 0 || playFl )
multiPresetN += 1; activePresetN += 1;
f->presetA[ preset_idx ].order = order; f->presetA[ preset_idx ].order = order;
f->presetA[ preset_idx ].alt_str = mem::duplStr(alt_str); f->presetA[ preset_idx ].alt_str = mem::duplStr(alt_str);
@ -1735,18 +1753,9 @@ cw::rc_t cw::preset_sel::read( handle_t h, const char* fn )
} }
/* // if only one preset is active and the dry preset is active
// create the multiPresetA[] f->dryOnlyFl = activePresetN==1 && (f->presetA[dryPresetIdx].order>0 || f->presetA[dryPresetIdx].playFl);
if( multiPresetN>0 )
{
// make multiPresetA as large as possible
f->multiPresetA = mem::allocZ<flow::preset_order_t>(p->presetLabelN);
_load_multi_preset_array(p,f);
}
*/
} }
@ -1773,7 +1782,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",i,f->fragId,f->endLoc, mins); cwLogInfo("%3i id:%3i end loc:%3i end min:%f dry-only:%i",i,f->fragId,f->endLoc, mins, f->dryOnlyFl);
} }
return rc; return rc;
@ -1788,11 +1797,12 @@ cw::rc_t cw::preset_sel::report_presets( handle_t h )
for(; f!=nullptr; f=f->link) for(; f!=nullptr; f=f->link)
{ {
printf("%5i %5i ",beg_loc,f->endLoc); const char* dry_label = f->dryOnlyFl ? "dry" : "";
cwLogPrint("%5i %5i %3s ",beg_loc,f->endLoc,dry_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 )
printf("(%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);
printf("\n"); cwLogPrint("\n");
beg_loc = f->endLoc+1; beg_loc = f->endLoc+1;
} }

View File

@ -32,13 +32,10 @@ namespace cw
unsigned endPlayLoc; unsigned endPlayLoc;
char* note; char* note;
bool dryOnlyFl;
preset_t* presetA; // presetA[ presetN ] - status of each preset preset_t* presetA; // presetA[ presetN ] - status of each preset
unsigned presetN; unsigned presetN;
// array of stored presets in this frag. sequenced by ascending 'order'.
//flow::preset_order_t* multiPresetA;
//unsigned multiPresetN;
// altPresetIdxA[ alt_count() ] selected preset idx for each alt. // altPresetIdxA[ alt_count() ] selected preset idx for each alt.
unsigned* altPresetIdxA; unsigned* altPresetIdxA;
@ -141,7 +138,12 @@ 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 );
const flow::preset_order_t* fragment_active_presets( handle_t h, const frag_t* f, unsigned& count_ref ); enum {
kAllActiveFl = 0x01,
kDryPriorityFl = 0x02
};
const flow::preset_order_t* fragment_active_presets( handle_t h, const frag_t* f, unsigned flags, unsigned& count_ref );
rc_t write( handle_t h, const char* fn ); rc_t write( handle_t h, const char* fn );
rc_t read( handle_t h, const char* fn ); rc_t read( handle_t h, const char* fn );

View File

@ -8,12 +8,15 @@
title: "", title: "",
row: { row: {
button:{ name: quitBtnId, title:"Quit" }, button:{ name: quitBtnId, title:"Quit" },
button:{ name: ioReportBtnId, title:"IO Report" }, button:{ name: ioReportBtnId, title:"IO Report" },
button:{ name: netPrintBtnId, title:"Print Network" } button:{ name: ioRtReportBtnId, title:"IO RT Report" },
button:{ name: reportBtnId, title:"App Report" }, button:{ name: netPrintBtnId, title:"Print Network" }
button:{ name: latencyBtnId, title:"Latency Reset"}, button:{ name: presetReportBtnId,title:"Preset Report" }
button:{ name: saveBtnId, title:"Save" }, button:{ name: MRP_ReportBtnId, title:"MRP Report" },
button:{ name: reportBtnId, title:"App Report" },
button:{ name: latencyBtnId, title:"Latency Reset"},
button:{ name: saveBtnId, title:"Save" },
select:{ name: perfSelId, title:"Load",children: {} }, select:{ name: perfSelId, title:"Load",children: {} },
select:{ name: altSelId, title:"Alternatives",children: {} }, select:{ name: altSelId, title:"Alternatives",children: {} },
@ -21,10 +24,11 @@
}, },
row: { row: {
check: { name: presetProbPriCheckId, title: "Pri Prob::" }, check: { name: presetProbPriCheckId, title: "Pri Prob::" },
check: { name: presetProbSecCheckId, title: "Sec Prob:" }, check: { name: presetProbSecCheckId, title: "Sec Prob:" },
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:" },
}, },
row: { row: {
@ -34,12 +38,6 @@
number: { name: syncDelayMsId, title: "Delay (ms)", min:0, max:1000, step:1, decpl:0 }, number: { name: syncDelayMsId, title: "Delay (ms)", min:0, max:1000, step:1, decpl:0 },
}, },
row: {
number: { name: wetInGainId, title:"Wet In Gain", min:0, max:100.0, step:0.01, decpl:3 },
number: { name: wetOutGainId, title:"Wet Out Gain", min:0, max:100.0, step:0.01, decpl:3 },
number: { name: dryGainId, title:"Dry Gain", min:0, max:100.0, step:0.01, decpl:3 },
},
row: { row: {
button:{ name: startBtnId, title:"Start", enable: false }, button:{ name: startBtnId, title:"Start", enable: false },
button:{ name: stopBtnId, title:"Stop", enable: false }, button:{ name: stopBtnId, title:"Stop", enable: false },
@ -75,20 +73,6 @@
number:{ name: sfResetLocNumbId, title:"Loc", enable: false } number:{ name: sfResetLocNumbId, title:"Loc", enable: false }
}, },
row: {
number: { name: pvWndSmpCntId, title:"WndSmpCnt", min:128, max:4096, step:1, decpl:0 },
check: { name: sdBypassId, title:"Sd Bypass" },
number: { name: sdInGainId, title:"In Gain", min:-100.0, max:100.0, step:0.01, decpl:3 },
number: { name: sdCeilingId, title:"Ceiling", min:0, max:1000, step:0.1, decpl:2 },
number: { name: sdExpoId, title:"Expo", min:0, max:1000, step:0.1, decpl:2 },
number: { name: sdThreshId, title:"Thresh", min:0, max:1000, step:0.1, decpl:2 },
number: { name: sdUprId, title:"Upr", min:-10.0, max:10.0, step:0.01, decpl:3 },
number: { name: sdLwrId, title:"Lwr", min:-10.0, max:10.0, step:0.01, decpl:3 },
number: { name: sdMixId, title:"Mix", min:-10.0, max:10.0, step:0.01, decpl:3 },
check: { name: cmpBypassId, title:"C Bypass" },
},
row: { row: {
col: { col: {
@ -127,6 +111,26 @@
log: { name: logId, title:"Log" } log: { name: logId, title:"Log" }
}, },
row: {
number: { name: wetInGainId, title:"Wet In Gain", min:0, max:100.0, step:0.01, decpl:3 },
number: { name: wetOutGainId, title:"Wet Out Gain", min:0, max:100.0, step:0.01, decpl:3 },
number: { name: dryGainId, title:"Dry Gain", min:0, max:100.0, step:0.01, decpl:3 },
},
row: {
number: { name: pvWndSmpCntId, title:"WndSmpCnt", min:128, max:4096, step:1, decpl:0 },
check: { name: sdBypassId, title:"Sd Bypass" },
number: { name: sdInGainId, title:"In Gain", min:-100.0, max:100.0, step:0.01, decpl:3 },
number: { name: sdCeilingId, title:"Ceiling", min:0, max:1000, step:0.1, decpl:2 },
number: { name: sdExpoId, title:"Expo", min:0, max:1000, step:0.1, decpl:2 },
number: { name: sdThreshId, title:"Thresh", min:0, max:1000, step:0.1, decpl:2 },
number: { name: sdUprId, title:"Upr", min:-10.0, max:10.0, step:0.01, decpl:3 },
number: { name: sdLwrId, title:"Lwr", min:-10.0, max:10.0, step:0.01, decpl:3 },
number: { name: sdMixId, title:"Mix", min:-10.0, max:10.0, step:0.01, decpl:3 },
check: { name: cmpBypassId, title:"C Bypass" },
},
panel: { addClassName: velTunerPanel panel: { addClassName: velTunerPanel
row: { row: {