cwIoPresetSelApp.cpp : beg_loc,end_loc is now applied to midi player from meta.cfg on file load.

This commit is contained in:
kevin 2024-03-30 18:01:08 -04:00
parent d5f75f961c
commit 97da536504

View File

@ -293,7 +293,7 @@ namespace cw
const char* record_fn_ext; const char* record_fn_ext;
const char* record_backup_dir; const char* record_backup_dir;
const char* scoreFn; //const char* scoreFn;
const object_t* perfDirL; const object_t* perfDirL;
const char* velTableFname; const char* velTableFname;
const char* velTableBackupDir; const char* velTableBackupDir;
@ -388,13 +388,13 @@ namespace cw
app->record_fn = argv[i+1]; app->record_fn = argv[i+1];
goto found_fl; goto found_fl;
} }
/*
if( textCompare(argv[i],"score_fn") == 0 ) if( textCompare(argv[i],"score_fn") == 0 )
{ {
app->scoreFn = argv[i+1]; app->scoreFn = argv[i+1];
goto found_fl; goto found_fl;
} }
*/
if( textCompare(argv[i],"beg_play_loc") == 0 ) if( textCompare(argv[i],"beg_play_loc") == 0 )
{ {
string_to_number( argv[i+1], app->beg_play_loc ); string_to_number( argv[i+1], app->beg_play_loc );
@ -436,7 +436,7 @@ namespace cw
if((rc = params_cfgRef->getv( "record_dir", app->record_dir, if((rc = params_cfgRef->getv( "record_dir", app->record_dir,
"record_fn", app->record_fn, "record_fn", app->record_fn,
"record_fn_ext", app->record_fn_ext, "record_fn_ext", app->record_fn_ext,
"score_fn", app->scoreFn, //"score_fn", app->scoreFn,
"perfDirL", app->perfDirL, "perfDirL", app->perfDirL,
"flow_proc_dict_fn", flow_proc_dict_fn, "flow_proc_dict_fn", flow_proc_dict_fn,
"midi_play_record", app->midi_play_record_cfg, "midi_play_record", app->midi_play_record_cfg,
@ -470,11 +470,13 @@ namespace cw
_apply_command_line_args(app,argc,argv); _apply_command_line_args(app,argc,argv);
/*
if((app->scoreFn = filesys::expandPath( app->scoreFn )) == nullptr ) if((app->scoreFn = filesys::expandPath( app->scoreFn )) == nullptr )
{ {
rc = cwLogError(kInvalidArgRC,"The score file name is invalid."); rc = cwLogError(kInvalidArgRC,"The score file name is invalid.");
goto errLabel; goto errLabel;
} }
*/
if((app->record_dir = filesys::expandPath(app->record_dir)) == nullptr ) if((app->record_dir = filesys::expandPath(app->record_dir)) == nullptr )
{ {
@ -587,7 +589,7 @@ namespace cw
mem::release((char*&)app.record_backup_dir); mem::release((char*&)app.record_backup_dir);
mem::release((char*&)app.record_dir); mem::release((char*&)app.record_dir);
mem::release((char*&)app.scoreFn); //mem::release((char*&)app.scoreFn);
mem::release(app.midiRecordDir); mem::release(app.midiRecordDir);
mem::release(app.midiLoadFname); mem::release(app.midiLoadFname);
vtbl::destroy(app.vtH); vtbl::destroy(app.vtH);
@ -1135,7 +1137,6 @@ namespace cw
{ {
if( preset_sel::track_loc( app->psH, loc, f ) ) if( preset_sel::track_loc( app->psH, loc, f ) )
{ {
_apply_preset( app, loc, (const perf_score::event_t*)msg_arg, f ); _apply_preset( app, loc, (const perf_score::event_t*)msg_arg, f );
if( f != nullptr ) if( f != nullptr )
@ -2131,7 +2132,7 @@ rc_t _on_ui_play_loc(app_t* app, unsigned appId, unsigned loc);
m[i].id = e->uid; m[i].id = e->uid;
m[i].loc = e->loc; m[i].loc = e->loc;
m[i].arg = e; m[i].arg = e;
app->locMap[i].loc = e->loc; app->locMap[i].loc = e->loc;
app->locMap[i].timestamp = m[i].timestamp; app->locMap[i].timestamp = m[i].timestamp;
@ -2222,7 +2223,7 @@ rc_t _on_ui_play_loc(app_t* app, unsigned appId, unsigned loc);
return rc; return rc;
} }
rc_t _do_load_perf_score( app_t* app, const char* perf_fn, const vel_tbl_t* vtA=nullptr, unsigned vtN=0 ) rc_t _do_load_perf_score( app_t* app, const char* perf_fn, const vel_tbl_t* vtA=nullptr, unsigned vtN=0, unsigned beg_loc=score_parse::kInvalidLocId, unsigned end_loc=score_parse::kInvalidLocId )
{ {
rc_t rc = kOkRC; rc_t rc = kOkRC;
unsigned midiEventN = 0; unsigned midiEventN = 0;
@ -2267,8 +2268,8 @@ rc_t _on_ui_play_loc(app_t* app, unsigned appId, unsigned loc);
// set the UI begin/end play to the locations of the newly loaded performance // set the UI begin/end play to the locations of the newly loaded performance
if( !lockLoctnFl ) if( !lockLoctnFl )
{ {
app->end_play_loc = app->maxPerfLoc; app->end_play_loc = end_loc==score_parse::kInvalidLocId ? app->maxPerfLoc : end_loc;
app->beg_play_loc = app->minPerfLoc; app->beg_play_loc = beg_loc==score_parse::kInvalidLocId ? app->minPerfLoc : beg_loc;
} }
// Update the master range of the play beg/end number widgets // Update the master range of the play beg/end number widgets
@ -2334,7 +2335,7 @@ rc_t _on_ui_play_loc(app_t* app, unsigned appId, unsigned loc);
printf("Loading:%s\n",prp->fname ); printf("Loading:%s\n",prp->fname );
// load the requested performance // load the requested performance
if((rc = _do_load_perf_score(app,prp->fname,prp->vel_tblA, prp->vel_tblN)) != kOkRC ) if((rc = _do_load_perf_score(app,prp->fname,prp->vel_tblA, prp->vel_tblN, prp->beg_loc, prp->end_loc)) != kOkRC )
{ {
rc = cwLogError(kSyntaxErrorRC,"The performance load failed."); rc = cwLogError(kSyntaxErrorRC,"The performance load failed.");
goto errLabel; goto errLabel;