cwIoPresetSelApp.cpp: Expand 'scoreFn' and 'record_dir' args.

Prevent first fragment from being played when MIDI player stops.
This commit is contained in:
kevin 2022-05-14 10:19:18 -04:00
parent 67078663be
commit 09517f2653

View File

@ -236,9 +236,6 @@ namespace cw
unsigned hpVel;
unsigned hpDurMs;
unsigned hpDnDelayMs;
} app_t;
rc_t _parseCfg(app_t* app, const object_t* cfg, const object_t*& params_cfgRef )
@ -265,6 +262,18 @@ namespace cw
rc = cwLogError(kSyntaxErrorRC,"Preset Select App configuration parse failed.");
}
if((app->scoreFn = filesys::expandPath( app->scoreFn )) == nullptr )
{
rc = cwLogError(kInvalidArgRC,"The score file name is invalid.");
goto errLabel;
}
if((app->record_dir = filesys::expandPath(app->record_dir)) == nullptr )
{
rc = cwLogError(kInvalidArgRC,"The record directory path is invalid.");
goto errLabel;
}
// verify that the output directory exists
if((rc = filesys::isDir(app->record_dir)) != kOkRC )
if((rc = filesys::makeDir(app->record_dir)) != kOkRC )
@ -312,6 +321,8 @@ namespace cw
rc_t _free( app_t& app )
{
mem::release((char*&)app.record_dir);
mem::release((char*&)app.scoreFn);
preset_sel::destroy(app.psH);
io_flow::destroy(app.ioFlowH);
midi_record_play::destroy(app.mrpH);
@ -404,6 +415,8 @@ namespace cw
printf("%s\n",buf);
}
if( midi_record_play::is_started(app->mrpH) )
{
const preset_sel::frag_t* f = nullptr;
if( preset_sel::track_timestamp( app->psH, timestamp, f ) )
{
@ -414,6 +427,7 @@ namespace cw
_do_select_frag( app, f->guiUuId );
}
}
}
// Find the closest locMap equal to or after 'loc'
loc_map_t* _find_loc( app_t* app, unsigned loc )
@ -1453,11 +1467,11 @@ 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");
//midi_record_play::save_csv(app->mrpH,"/home/kevin/temp/mrp_1.csv");
break;
case kSaveBtnId: