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;
io_flow::handle_t ioFlowH;
unsigned tmp;
double crossFadeSrate;
unsigned crossFadeCnt;
@ -1017,7 +1015,7 @@ namespace cw
unsigned fragBegLoc = 0;
// 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.");
goto errLabel;
@ -1243,12 +1241,6 @@ namespace cw
rc_t rc = kOkRC;
unsigned midiEventN = 0;
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");
_set_status(app,"Loading...");
@ -1258,13 +1250,6 @@ namespace cw
if((rc = _load_piano_score(app,midiEventN)) != kOkRC )
goto errLabel;
/*
if( !firstLoadFl)
{
minLoc = std::max(minLoc,app->minLoc);
maxLoc = std::min(maxLoc,app->maxLoc);
}
*/
// reset the timestamp tracker
track_loc_reset( app->psH );
@ -1275,22 +1260,21 @@ namespace cw
unsigned begPlayLocUuId = io::uiFindElementUuId(app->ioH, kBegPlayLocNumbId);
unsigned endPlayLocUuId = io::uiFindElementUuId(app->ioH, kEndPlayLocNumbId);
unsigned end_play_loc = app->end_play_loc==0 ? app->maxLoc : app->end_play_loc;
unsigned beg_play_loc = app->minLoc <= app->beg_play_loc && app->beg_play_loc <= app->maxLoc ? app->beg_play_loc : app->minLoc;
if( app->end_play_loc == 0 )
app->end_play_loc = app->maxLoc;
io::uiSetNumbRange( app->ioH, begPlayLocUuId, app->minLoc, app->maxLoc, 1, 0, app->minLoc );
io::uiSetNumbRange( app->ioH, endPlayLocUuId, app->minLoc, app->maxLoc, 1, 0, app->maxLoc );
if( !(app->minLoc <= app->beg_play_loc && app->beg_play_loc <= app->maxLoc) )
app->beg_play_loc = app->minLoc;
//io::uiSendValue( app->ioH, begPlayLocUuId, app->minLoc);
//io::uiSendValue( app->ioH, endPlayLocUuId, app->maxLoc);
io::uiSendValue( app->ioH, begPlayLocUuId, beg_play_loc);
io::uiSendValue( app->ioH, endPlayLocUuId, end_play_loc);
io::uiSetNumbRange( app->ioH, begPlayLocUuId, app->minLoc, app->maxLoc, 1, 0, app->beg_play_loc );
io::uiSetNumbRange( app->ioH, endPlayLocUuId, app->minLoc, app->maxLoc, 1, 0, app->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
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kInsertLocId ), true );
}
// update the current event and event count
@ -1324,6 +1308,8 @@ namespace cw
else
_set_status(app,"%i MIDI events loaded.",midiEventN);
io::uiSetEnable( app->ioH, io::uiFindElementUuId( app->ioH, kLoadBtnId ), false );
return rc;
}
@ -1673,11 +1659,12 @@ namespace cw
break;
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");
//app->tmp = !app->tmp;
//io_flow::print(app->ioFlowH);
//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;
case kSaveBtnId:
@ -1773,7 +1760,6 @@ namespace cw
break;
case kFragWetDryGainId:
//printf("UI wet/dry:%f\n",m.value->u.d);
_on_ui_frag_value( app, m.uuId, m.value->u.d );
break;
@ -1902,6 +1888,14 @@ namespace cw
_on_echo_master_value( app, preset_sel::kMasterSyncDelayMsVarId, m.uuId );
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 kHalfPedalDelayMs:
@ -2025,6 +2019,9 @@ namespace cw
rc = _ui_callback(app,m->u.ui);
break;
case io::kExecTId:
break;
default:
assert(0);

View File

@ -1,82 +1,128 @@
{
main: {
parent: "uiDivId"
parent: "uiDivId"
panel: {
panel: {
name: "panelDivId",
title: "",
name: "panelDivId",
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: loadBtnId, title:"Load" },
button:{ name: saveBtnId, title:"Save" },
},
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: loadBtnId, title:"Load" },
button:{ name: saveBtnId, title:"Save" },
},
row: {
check: { name: printMidiCheckId, title: "Print MIDI" },
check: { name: pianoMidiCheckId, title: "Piano MIDI" },
check: { name: samplerMidiCheckId, title: "Sampler MIDI" },
number: { name: syncDelayMsId, title: "Delay (ms)", min:0, max:1000, step:1, decpl:0 },
},
row: {
check: { name: printMidiCheckId, title: "Print MIDI" },
check: { name: pianoMidiCheckId, title: "Piano MIDI" },
check: { name: samplerMidiCheckId, title: "Sampler MIDI" },
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" },
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: {
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" },
},
frag_panel: {
row: {
check:{ name: midiThruCheckId, title:"MIDI Thru" },
numb_disp: { name: curMidiEvtCntId, title:"Current Loc:" },
numb_disp: { name: totalMidiEvtCntId, title:"Max Loc:" },
},
panel: {
name: fragPanelId
addClassName: fragPanel
row: {
number:{ name: insertLocId, title:"End Loc:", min:0, max:100000, step:1, decpl:0 },
button:{ name: insertBtnId, title:"Insert", enable: false },
},
row: {
name: fragPanelRowId
addClassName: fragPanelRow
row: {
button:{ name: deleteBtnId, title:"Delete Selected", enable: false },
},
col: {
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: {
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: {
string: { name: fragNoteId, addClassName: fragNote, title:"Note" },
}
},
col: {
number:{ name: fragWetDryGainId, title:"Wet/Dry", min:0.0, max:1.0, step:0.1, decpl:2 },
number:{ name: fragFadeOutMsId, title:"Fade Ms", min:0.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" }
}
}