cwScoreFollowTest.cpp : Added JSON output from _score_follow_one_perf()

This commit is contained in:
kevin 2023-10-21 10:05:14 -04:00
parent 2b55eb9101
commit acd22ff005

View File

@ -48,6 +48,9 @@ namespace cw
char* out_dir; char* out_dir;
bool write_perf_meas_json_fl;
const char* out_perf_meas_json_fname;
bool write_svg_file_fl; bool write_svg_file_fl;
const char* out_svg_fname; const char* out_svg_fname;
@ -93,6 +96,10 @@ namespace cw
"meas_setup_report_fl", p->meas_setup_report_fl, "meas_setup_report_fl", p->meas_setup_report_fl,
"out_dir", out_dir, "out_dir", out_dir,
"write_perf_meas_json_fl", p->write_perf_meas_json_fl,
"out_perf_meas_json_fname", p->out_perf_meas_json_fname,
"write_svg_file_fl", p->write_svg_file_fl, "write_svg_file_fl", p->write_svg_file_fl,
"out_svg_fname", p->out_svg_fname, "out_svg_fname", p->out_svg_fname,
@ -137,6 +144,9 @@ namespace cw
bool pre_test_fl = p->pre_test_fl; bool pre_test_fl = p->pre_test_fl;
bool enable_fl = true; bool enable_fl = true;
const char* perf_label = nullptr; const char* perf_label = nullptr;
const char* player_name = nullptr;
const char* perf_date = nullptr;
unsigned perf_take_numb = kInvalidId;
const char* midi_fname = nullptr; const char* midi_fname = nullptr;
char* out_dir = nullptr; char* out_dir = nullptr;
char* fname = nullptr; char* fname = nullptr;
@ -156,6 +166,9 @@ namespace cw
// parse the performance record // parse the performance record
if((rc = perf->getv("label",perf_label, if((rc = perf->getv("label",perf_label,
"enable_fl",enable_fl, "enable_fl",enable_fl,
"player",player_name,
"perf_date",perf_date,
"take",perf_take_numb,
"start_loc", start_loc, "start_loc", start_loc,
"midi_fname", midi_fname)) != kOkRC ) "midi_fname", midi_fname)) != kOkRC )
{ {
@ -236,7 +249,7 @@ namespace cw
pre_test_fl = false; pre_test_fl = false;
} }
printf("%f %li %5i %3x %3i %3i\n",sec, smpIdx, m->uid, m->status, m->u.chMsgPtr->d0, m->u.chMsgPtr->d1); //printf("%f %li %5i %3x %3i %3i\n",sec, smpIdx, m->uid, m->status, m->u.chMsgPtr->d0, m->u.chMsgPtr->d1);
// send the note-on to the score follower // send the note-on to the score follower
if((rc = exec(sfH, sec, smpIdx, m->uid, m->status, m->u.chMsgPtr->d0, m->u.chMsgPtr->d1, newMatchFl )) != kOkRC ) if((rc = exec(sfH, sec, smpIdx, m->uid, m->status, m->u.chMsgPtr->d0, m->u.chMsgPtr->d1, newMatchFl )) != kOkRC )
@ -293,6 +306,27 @@ namespace cw
} }
} }
if( p->write_perf_meas_json_fl )
{
// create the JSON output filename
if((fname = filesys::makeFn(out_dir,p->out_perf_meas_json_fname,nullptr,nullptr)) == nullptr )
{
cwLogError(kOpFailRC,"The output perf. meas. filename formation failed.");
goto errLabel;
}
cwLogInfo("Writing JSON score-follow perf. meas. result to:%s",cwStringNullGuard(fname));
if((rc = write_result_json(perfMeasH,player_name,perf_date,perf_take_numb,fname)) != kOkRC )
{
rc = cwLogError(rc,"Perf. meas. report file create failed.");
goto errLabel;
}
mem::release(fname);
}
// write the score following result SVG // write the score following result SVG
if( p->write_svg_file_fl ) if( p->write_svg_file_fl )