diff --git a/cwFlow.cpp b/cwFlow.cpp index 09a1e6e..4f8a0a0 100644 --- a/cwFlow.cpp +++ b/cwFlow.cpp @@ -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 secProbFl = cwIsFlag(mps.flags, kSecPresetProbFl ); 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 if( mps.presetN == 0 ) diff --git a/cwFlowDecl.h b/cwFlowDecl.h index 7303f99..5f73166 100644 --- a/cwFlowDecl.h +++ b/cwFlowDecl.h @@ -6,10 +6,11 @@ namespace cw namespace flow { enum { - kPriPresetProbFl = 0x01, - kSecPresetProbFl = 0x02, - kInterpPresetFl = 0x04, - kAllowAllPresetFl = 0x08 + kPriPresetProbFl = 0x01, + kSecPresetProbFl = 0x02, + kInterpPresetFl = 0x04, + kAllowAllPresetFl = 0x08, + kDryPriorityPresetFl = 0x10 }; typedef struct preset_order_str diff --git a/cwIoPresetSelApp.cpp b/cwIoPresetSelApp.cpp index 35b907f..66582a9 100644 --- a/cwIoPresetSelApp.cpp +++ b/cwIoPresetSelApp.cpp @@ -47,6 +47,9 @@ namespace cw kPanelDivId = 1000, kQuitBtnId, kIoReportBtnId, + kIoRtReportBtnId, + kPresetReportBtnId, + kMRP_ReportBtnId, kNetPrintBtnId, kReportBtnId, kLatencyBtnId, @@ -85,6 +88,7 @@ namespace cw kSecPresetProbCheckId, kPresetInterpCheckId, kPresetAllowAllCheckId, + kPresetDryPriorityCheckId, kEnaRecordCheckId, @@ -155,8 +159,11 @@ namespace cw { ui::kRootAppId, kPanelDivId, "panelDivId" }, { kPanelDivId, kQuitBtnId, "quitBtnId" }, { kPanelDivId, kIoReportBtnId, "ioReportBtnId" }, + { kPanelDivId, kIoRtReportBtnId,"ioRtReportBtnId" }, { kPanelDivId, kNetPrintBtnId, "netPrintBtnId" }, { kPanelDivId, kReportBtnId, "reportBtnId" }, + { kPanelDivId, kPresetReportBtnId, "presetReportBtnId" }, + { kPanelDivId, kMRP_ReportBtnId, "MRP_ReportBtnId" }, { kPanelDivId, kLatencyBtnId, "latencyBtnId" }, { kPanelDivId, kStartBtnId, "startBtnId" }, @@ -191,6 +198,8 @@ namespace cw { kPanelDivId, kSecPresetProbCheckId, "presetProbSecCheckId" }, { kPanelDivId, kPresetInterpCheckId, "presetInterpCheckId" }, { kPanelDivId, kPresetAllowAllCheckId, "presetAllowAllCheckId" }, + { kPanelDivId, kPresetDryPriorityCheckId, "presetDryPriorityCheckId" }, + { kPanelDivId, kEnaRecordCheckId, "enaRecordCheckId" }, @@ -926,16 +935,23 @@ namespace cw { 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 = { .flags = app->multiPresetFlags, .coeffV = score_evt->featV, .coeffMinV = score_evt->featMinV, .coeffMaxV = score_evt->featMaxV, .coeffN = perf_meas::kValCnt, - .presetA = allowAnyFl ? preset_order_array(app->psH) : fragment_active_presets(app->psH,frag,multiPresetN), - .presetN = allowAnyFl ? preset_count(app->psH) : multiPresetN + .presetA = fragment_active_presets(app->psH,frag,activePresetFlags,multiPresetN), + .presetN = multiPresetN }; 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 ); break; + case kIoRtReportBtnId: + io::realTimeReport(app->ioH); + break; + case kNetPrintBtnId: if( app->ioFlowH.isValid() ) 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"); //printf("%i %i\n",app->beg_play_loc,app->end_play_loc); //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::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"); + break; + + case kPresetReportBtnId: preset_sel::report_presets(app->psH); break; + case kMRP_ReportBtnId: + midi_record_play::report(app->mrpH); + break; + case kLatencyBtnId: latency_measure_report(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); break; + case kPresetDryPriorityCheckId: + app->multiPresetFlags = cwEnaFlag(app->multiPresetFlags,flow::kDryPriorityPresetFl,m.value->u.b); + break; + case kMidiThruCheckId: 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: io::uiSendValue( app->ioH, m.uuId, preset_cfg_flags(app->ioFlowH) & flow::kAllowAllPresetFl ); break; + + case kPresetDryPriorityCheckId: + io::uiSendValue( app->ioH, m.uuId, preset_cfg_flags(app->ioFlowH) & flow::kDryPriorityPresetFl ); + break; case kWetInGainId: _on_echo_master_value( app, preset_sel::kMasterWetInGainVarId, m.uuId ); diff --git a/cwPresetSel.cpp b/cwPresetSel.cpp index 28865f8..07f17f9 100644 --- a/cwPresetSel.cpp +++ b/cwPresetSel.cpp @@ -829,7 +829,7 @@ namespace cw 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; 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); - - count_ref = 0; + const flow::preset_order_t* preset_order; - 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 ) { - rc_t rc = kOkRC; - preset_sel_t* p = _handleToPtr(h); - object_t* root = nullptr; - const object_t* fragL_obj = nullptr; + rc_t rc = kOkRC; + preset_sel_t* p = _handleToPtr(h); + object_t* root = nullptr; + const object_t* fragL_obj = nullptr; + unsigned dryPresetIdx = _preset_label_to_index(p,"dry"); // parse the preset file 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; const object_t* r = fragL_obj->child_ele(i); - unsigned fragId=kInvalidId,endLoc=0,presetN=0,multiPresetN=0,begPlayLoc=0,endPlayLoc=0; - double igain=0,ogain=0,wetDryGain=0,fadeOutMs=0; - const char* note = nullptr; - const object_t* presetL_obj = nullptr; - time::spec_t end_ts; + unsigned fragId = kInvalidId; + unsigned endLoc = 0; + unsigned presetN = 0; + unsigned activePresetN = 0; + 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 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 ) - multiPresetN += 1; + activePresetN += 1; f->presetA[ preset_idx ].order = order; 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 ) } - /* - // create the multiPresetA[] - if( multiPresetN>0 ) - { - // make multiPresetA as large as possible - f->multiPresetA = mem::allocZ(p->presetLabelN); + // 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); - _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); 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; @@ -1788,11 +1797,12 @@ cw::rc_t cw::preset_sel::report_presets( handle_t h ) 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; ipresetN; ++i) 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); - printf("\n"); + cwLogPrint("(%s-%i) ", p->presetLabelA[ f->presetA[i].preset_idx ].label, f->presetA[i].order); + cwLogPrint("\n"); beg_loc = f->endLoc+1; } diff --git a/cwPresetSel.h b/cwPresetSel.h index 5b984c4..28007b8 100644 --- a/cwPresetSel.h +++ b/cwPresetSel.h @@ -32,13 +32,10 @@ namespace cw unsigned endPlayLoc; char* note; + bool dryOnlyFl; preset_t* presetA; // presetA[ presetN ] - status of each preset 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. unsigned* altPresetIdxA; @@ -141,7 +138,12 @@ namespace cw // Return the count of presets whose 'seqFl' is set. 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 read( handle_t h, const char* fn ); diff --git a/html/preset_sel/ui.cfg b/html/preset_sel/ui.cfg index 0b722b6..97d9d5f 100644 --- a/html/preset_sel/ui.cfg +++ b/html/preset_sel/ui.cfg @@ -8,12 +8,15 @@ title: "", row: { - button:{ name: quitBtnId, title:"Quit" }, - button:{ name: ioReportBtnId, title:"IO Report" }, - button:{ name: netPrintBtnId, title:"Print Network" } - button:{ name: reportBtnId, title:"App Report" }, - button:{ name: latencyBtnId, title:"Latency Reset"}, - button:{ name: saveBtnId, title:"Save" }, + button:{ name: quitBtnId, title:"Quit" }, + button:{ name: ioReportBtnId, title:"IO Report" }, + button:{ name: ioRtReportBtnId, title:"IO RT Report" }, + button:{ name: netPrintBtnId, title:"Print Network" } + button:{ name: presetReportBtnId,title:"Preset Report" } + 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: altSelId, title:"Alternatives",children: {} }, @@ -21,10 +24,11 @@ }, row: { - check: { name: presetProbPriCheckId, title: "Pri Prob::" }, - check: { name: presetProbSecCheckId, title: "Sec Prob:" }, - check: { name: presetInterpCheckId, title: "Interp:"} - check: { name: presetAllowAllCheckId,title: "Allow All:" }, + check: { name: presetProbPriCheckId, title: "Pri Prob::" }, + check: { name: presetProbSecCheckId, title: "Sec Prob:" }, + check: { name: presetInterpCheckId, title: "Interp:"}, + check: { name: presetAllowAllCheckId, title: "Allow All:" }, + check: { name: presetDryPriorityCheckId,title: "Dry Priority:" }, }, row: { @@ -34,12 +38,6 @@ 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: { button:{ name: startBtnId, title:"Start", enable: false }, button:{ name: stopBtnId, title:"Stop", enable: false }, @@ -75,20 +73,6 @@ 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: { col: { @@ -127,6 +111,26 @@ 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 row: {