cwIoPresetSelApp.cpp,ui.cfg: various fixes to correctly handle beg/endPlayLoc interface.

Fragment UI template is now read from html/preset_sel/ui.cfg.
This commit is contained in:
kevin 2022-12-13 20:58:06 -05:00
parent 13bc47389b
commit 644c57458d
2 changed files with 148 additions and 105 deletions

View File

@ -236,8 +236,6 @@ namespace cw
preset_sel::handle_t psH; preset_sel::handle_t psH;
io_flow::handle_t ioFlowH; io_flow::handle_t ioFlowH;
unsigned tmp;
double crossFadeSrate; double crossFadeSrate;
unsigned crossFadeCnt; unsigned crossFadeCnt;
@ -1017,7 +1015,7 @@ namespace cw
unsigned fragBegLoc = 0; unsigned fragBegLoc = 0;
// create the UI object // create the UI object
if((rc = io::uiCreateFromObject( app->ioH, app->frag_panel_cfg, fragListUuId, fragChanId )) != kOkRC ) if((rc = io::uiCreateFromRsrc( app->ioH, "frag_panel", fragListUuId, fragChanId )) != kOkRC )
{ {
rc = cwLogError(rc,"The fragments UI object creation failed."); rc = cwLogError(rc,"The fragments UI object creation failed.");
goto errLabel; goto errLabel;
@ -1243,12 +1241,6 @@ namespace cw
rc_t rc = kOkRC; rc_t rc = kOkRC;
unsigned midiEventN = 0; unsigned midiEventN = 0;
bool firstLoadFl = !app->scoreH.isValid(); bool firstLoadFl = !app->scoreH.isValid();
//unsigned minLoc = firstLoadFl ? 0 : app->minLoc;
//unsigned maxLoc = firstLoadFl ? 0 : app->maxLoc;
// if the score is already loaded
//if( app->scoreH.isValid() )
// return rc;
cwLogInfo("Loading"); cwLogInfo("Loading");
_set_status(app,"Loading..."); _set_status(app,"Loading...");
@ -1258,13 +1250,6 @@ namespace cw
if((rc = _load_piano_score(app,midiEventN)) != kOkRC ) if((rc = _load_piano_score(app,midiEventN)) != kOkRC )
goto errLabel; goto errLabel;
/*
if( !firstLoadFl)
{
minLoc = std::max(minLoc,app->minLoc);
maxLoc = std::min(maxLoc,app->maxLoc);
}
*/
// reset the timestamp tracker // reset the timestamp tracker
track_loc_reset( app->psH ); track_loc_reset( app->psH );
@ -1275,22 +1260,21 @@ namespace cw
unsigned begPlayLocUuId = io::uiFindElementUuId(app->ioH, kBegPlayLocNumbId); unsigned begPlayLocUuId = io::uiFindElementUuId(app->ioH, kBegPlayLocNumbId);
unsigned endPlayLocUuId = io::uiFindElementUuId(app->ioH, kEndPlayLocNumbId); unsigned endPlayLocUuId = io::uiFindElementUuId(app->ioH, kEndPlayLocNumbId);
unsigned end_play_loc = app->end_play_loc==0 ? app->maxLoc : app->end_play_loc; if( app->end_play_loc == 0 )
unsigned beg_play_loc = app->minLoc <= app->beg_play_loc && app->beg_play_loc <= app->maxLoc ? app->beg_play_loc : app->minLoc; app->end_play_loc = app->maxLoc;
io::uiSetNumbRange( app->ioH, begPlayLocUuId, app->minLoc, app->maxLoc, 1, 0, app->minLoc ); if( !(app->minLoc <= app->beg_play_loc && app->beg_play_loc <= app->maxLoc) )
io::uiSetNumbRange( app->ioH, endPlayLocUuId, app->minLoc, app->maxLoc, 1, 0, app->maxLoc ); app->beg_play_loc = app->minLoc;
//io::uiSendValue( app->ioH, begPlayLocUuId, app->minLoc); io::uiSetNumbRange( app->ioH, begPlayLocUuId, app->minLoc, app->maxLoc, 1, 0, app->beg_play_loc );
//io::uiSendValue( app->ioH, endPlayLocUuId, app->maxLoc); io::uiSetNumbRange( app->ioH, endPlayLocUuId, app->minLoc, app->maxLoc, 1, 0, app->end_play_loc );
io::uiSendValue( app->ioH, begPlayLocUuId, beg_play_loc);
io::uiSendValue( app->ioH, endPlayLocUuId, end_play_loc);
io::uiSendValue( app->ioH, begPlayLocUuId, app->beg_play_loc);
io::uiSendValue( app->ioH, endPlayLocUuId, app->end_play_loc);
// enable the insert 'End Loc' number box since the score is loaded // enable the insert 'End Loc' number box since the score is loaded
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kInsertLocId ), true ); io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kInsertLocId ), true );
} }
// update the current event and event count // update the current event and event count
@ -1324,6 +1308,8 @@ namespace cw
else else
_set_status(app,"%i MIDI events loaded.",midiEventN); _set_status(app,"%i MIDI events loaded.",midiEventN);
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kLoadBtnId ), false );
return rc; return rc;
} }
@ -1673,11 +1659,12 @@ namespace cw
break; break;
case kReportBtnId: case kReportBtnId:
preset_sel::report( app->psH ); //preset_sel::report( app->psH );
//io_flow::apply_preset( app->ioFlowH, 2000.0, app->tmp==0 ? "a" : "b"); //io_flow::apply_preset( app->ioFlowH, 2000.0, app->tmp==0 ? "a" : "b");
//app->tmp = !app->tmp; //app->tmp = !app->tmp;
//io_flow::print(app->ioFlowH); //io_flow::print(app->ioFlowH);
//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);
break; break;
case kSaveBtnId: case kSaveBtnId:
@ -1773,7 +1760,6 @@ namespace cw
break; break;
case kFragWetDryGainId: case kFragWetDryGainId:
//printf("UI wet/dry:%f\n",m.value->u.d);
_on_ui_frag_value( app, m.uuId, m.value->u.d ); _on_ui_frag_value( app, m.uuId, m.value->u.d );
break; break;
@ -1902,6 +1888,14 @@ namespace cw
_on_echo_master_value( app, preset_sel::kMasterSyncDelayMsVarId, m.uuId ); _on_echo_master_value( app, preset_sel::kMasterSyncDelayMsVarId, m.uuId );
break; break;
case kBegPlayLocNumbId:
io::uiSendValue( app->ioH, m.uuId, app->beg_play_loc );
break;
case kEndPlayLocNumbId:
io::uiSendValue( app->ioH, m.uuId, app->end_play_loc );
break;
/* /*
case kHalfPedalPedalVel: case kHalfPedalPedalVel:
case kHalfPedalDelayMs: case kHalfPedalDelayMs:
@ -2025,6 +2019,9 @@ namespace cw
rc = _ui_callback(app,m->u.ui); rc = _ui_callback(app,m->u.ui);
break; break;
case io::kExecTId:
break;
default: default:
assert(0); assert(0);

View File

@ -1,82 +1,128 @@
{ {
main: {
parent: "uiDivId"
parent: "uiDivId" panel: {
panel: { name: "panelDivId",
title: "",
name: "panelDivId", row: {
title: "", 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: loadBtnId, title:"Load" },
button:{ name: saveBtnId, title:"Save" },
},
row: { row: {
button:{ name: quitBtnId, title:"Quit" }, check: { name: printMidiCheckId, title: "Print MIDI" },
button:{ name: ioReportBtnId, title:"IO Report" }, check: { name: pianoMidiCheckId, title: "Piano MIDI" },
button:{ name: netPrintBtnId, title:"Print Network" } check: { name: samplerMidiCheckId, title: "Sampler MIDI" },
button:{ name: reportBtnId, title:"App Report" }, number: { name: syncDelayMsId, title: "Delay (ms)", min:0, max:1000, step:1, decpl:0 },
button:{ name: loadBtnId, title:"Load" }, },
button:{ name: saveBtnId, title:"Save" },
},
row: { row: {
check: { name: printMidiCheckId, title: "Print MIDI" }, number: { name: wetInGainId, title:"Wet In Gain", min:0, max:100.0, step:0.01, decpl:3 },
check: { name: pianoMidiCheckId, title: "Piano MIDI" }, number: { name: wetOutGainId, title:"Wet Out Gain", min:0, max:100.0, step:0.01, decpl:3 },
check: { name: samplerMidiCheckId, title: "Sampler MIDI" }, number: { name: dryGainId, title:"Dry Gain", min:0, max:100.0, step:0.01, decpl:3 },
number: { name: syncDelayMsId, title: "Delay (ms)", min:0, max:1000, step:1, decpl:0 }, },
row: {
button:{ name: startBtnId, title:"Start" },
button:{ name: stopBtnId, title:"Stop" },
number:{ name: begLocNumbId, title:"Loc:", min:0, max:100000, step:1, decpl:0 },
number:{ name: endLocNumbId, title:"End:", min:0, max:100000, step:1, decpl:0 },
check: { name: liveCheckId, title:"Live" },
},
row: {
check:{ name: midiThruCheckId, title:"MIDI Thru" },
numb_disp: { name: curMidiEvtCntId, title:"Current Loc:" },
numb_disp: { name: totalMidiEvtCntId, title:"Max Loc:" },
},
row: {
number:{ name: insertLocId, title:"End Loc:", min:0, max:100000, step:1, decpl:0 },
button:{ name: insertBtnId, title:"Insert", enable: false },
},
row: {
button:{ name: deleteBtnId, title:"Delete Selected", enable: false },
},
/*
row: {
number:{ name: halfPedalDelayMsId, title:"DelayMs:", min:0, max:5000, step:1, decpl:0 },
number:{ name: halfPedalPedalVelId, title:"PVel:", min:0, max:127, step:1, decpl:0 },
number:{ name: halfPedalPitchId, title:"Pitch:", min:0, max:127, step:1, decpl:0 },
number:{ name: halfPedalVelId, title:"Vel:", min:0, max:127, step:1, decpl:0 },
number:{ name: halfPedalDurMsId, title:"DurMs:", min:0, max:5000, step:1, decpl:0 },
number:{ name: halfPedalDnDelayMsId, title:"DownMs:", min:0, max:5000, step:1, decpl:0 },
},
*/
row: {
str_disp:{ name: statusId, title:"Status:", value: "" },
}
row: {
list:{ name: fragListId, addClassName: fragList },
},
row: {
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: { frag_panel: {
button:{ name: startBtnId, title:"Start" },
button:{ name: stopBtnId, title:"Stop" },
number:{ name: begLocNumbId, title:"Loc:", min:0, max:100000, step:1, decpl:0 },
number:{ name: endLocNumbId, title:"End:", min:0, max:100000, step:1, decpl:0 },
check: { name: liveCheckId, title:"Live" },
},
row: { panel: {
check:{ name: midiThruCheckId, title:"MIDI Thru" },
numb_disp: { name: curMidiEvtCntId, title:"Current Loc:" },
numb_disp: { name: totalMidiEvtCntId, title:"Max Loc:" },
},
name: fragPanelId
addClassName: fragPanel
row: { row: {
number:{ name: insertLocId, title:"End Loc:", min:0, max:100000, step:1, decpl:0 }, name: fragPanelRowId
button:{ name: insertBtnId, title:"Insert", enable: false }, addClassName: fragPanelRow
},
row: { col: {
button:{ name: deleteBtnId, title:"Delete Selected", enable: false }, numb_disp: { name: fragBegLocId, title:"Beg Loc", value: 0 },
}, numb_disp: { name: fragEndLocId, title:"End Loc", value: 0 },
number: { name: fragInGainId, title:"In Gain", min:0.0, max:100.0, step:0.1, decpl:1 },
number: { name: fragOutGainId, title:"Out Gain", min:0.0, max:100.0, step:0.1, decpl:1 },
},
col: {
row: {
name: fragPresetRowId,
addClassName: fragPresetRow,
},
/* row: {
row: { string: { name: fragNoteId, addClassName: fragNote, title:"Note" },
number:{ name: halfPedalDelayMsId, title:"DelayMs:", min:0, max:5000, step:1, decpl:0 }, }
number:{ name: halfPedalPedalVelId, title:"PVel:", min:0, max:127, step:1, decpl:0 }, },
number:{ name: halfPedalPitchId, title:"Pitch:", min:0, max:127, step:1, decpl:0 }, col: {
number:{ name: halfPedalVelId, title:"Vel:", min:0, max:127, step:1, decpl:0 }, number:{ name: fragWetDryGainId, title:"Wet/Dry", min:0.0, max:1.0, step:0.1, decpl:2 },
number:{ name: halfPedalDurMsId, title:"DurMs:", min:0, max:5000, step:1, decpl:0 }, number:{ name: fragFadeOutMsId, title:"Fade Ms", min:0.0, max:5000, step:1, decpl:0 },
number:{ name: halfPedalDnDelayMsId, title:"DownMs:", min:0, max:5000, step:1, decpl:0 }, row: {
}, button:{ name: fragPlaySeqBtnId, title:"Play Seq" },
*/ button:{ name: fragPlayAllBtnId, title:"Play All" },
}
},
col: {
number: { name: fragBegPlayLocId, title:"Begin", min:0, max:1000000, step:1, decpl:0 },
number: { name: fragEndPlayLocId, title:"End", min:0, max:1000000, step:1, decpl:0 },
button: { name: fragPlayBtnId, title:"Play" }
}
row: { }
str_disp:{ name: statusId, title:"Status:", value: "" }, }
} }
row: {
list:{ name: fragListId, addClassName: fragList },
},
row: {
log: { name: logId, title:"Log" }
}
} }