cwScoreFollowTest.cpp : Added JSON output from _score_follow_one_perf()
This commit is contained in:
parent
2b55eb9101
commit
acd22ff005
@ -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,
|
||||||
|
|
||||||
@ -133,17 +140,20 @@ namespace cw
|
|||||||
perf_meas::handle_t perfMeasH,
|
perf_meas::handle_t perfMeasH,
|
||||||
unsigned perf_idx )
|
unsigned perf_idx )
|
||||||
{
|
{
|
||||||
rc_t rc = kOkRC;
|
rc_t rc = kOkRC;
|
||||||
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* midi_fname = nullptr;
|
const char* player_name = nullptr;
|
||||||
char* out_dir = nullptr;
|
const char* perf_date = nullptr;
|
||||||
char* fname = nullptr;
|
unsigned perf_take_numb = kInvalidId;
|
||||||
unsigned start_loc = 0;
|
const char* midi_fname = nullptr;
|
||||||
const object_t* perf = nullptr;
|
char* out_dir = nullptr;
|
||||||
unsigned msgN = 0;
|
char* fname = nullptr;
|
||||||
const midi::file::trackMsg_t** msgA = nullptr;
|
unsigned start_loc = 0;
|
||||||
|
const object_t* perf = nullptr;
|
||||||
|
unsigned msgN = 0;
|
||||||
|
const midi::file::trackMsg_t** msgA = nullptr;
|
||||||
midi::file::handle_t mfH;
|
midi::file::handle_t mfH;
|
||||||
|
|
||||||
// get the perf. record
|
// get the perf. record
|
||||||
@ -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 )
|
||||||
|
Loading…
Reference in New Issue
Block a user