2022-11-11 18:13:35 +00:00
|
|
|
#ifndef cwScoreFollower_h
|
|
|
|
#define cwScoreFollower_h
|
|
|
|
|
|
|
|
namespace cw
|
|
|
|
{
|
|
|
|
namespace score_follower
|
|
|
|
{
|
|
|
|
typedef handle< struct score_follower_str > handle_t;
|
2023-09-13 00:24:50 +00:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
bool enableFl;
|
|
|
|
sfscore::handle_t scoreH;
|
|
|
|
unsigned scoreWndLocN; // size of the score search window
|
|
|
|
unsigned midiWndLocN; // count of MIDI locations to align inside the score search window
|
|
|
|
bool trackPrintFl;
|
|
|
|
bool trackResultsBacktrackFl;
|
|
|
|
|
|
|
|
} args_t;
|
|
|
|
|
|
|
|
rc_t create( handle_t& hRef, const args_t& args );
|
2022-11-11 18:13:35 +00:00
|
|
|
|
2023-09-13 00:24:50 +00:00
|
|
|
rc_t create( handle_t& hRef, const object_t* cfg, double srate );
|
2022-11-11 18:13:35 +00:00
|
|
|
|
|
|
|
rc_t destroy( handle_t& hRef );
|
|
|
|
|
2023-06-27 21:26:32 +00:00
|
|
|
bool is_enabled( handle_t h );
|
2023-11-26 20:32:11 +00:00
|
|
|
void enable( handle_t h, bool enable_fl );
|
2023-06-27 21:26:32 +00:00
|
|
|
|
2023-05-16 13:14:20 +00:00
|
|
|
// Set the starting search location and calls clear_match_id_array().
|
2022-11-11 18:13:35 +00:00
|
|
|
rc_t reset( handle_t h, unsigned loc );
|
2023-01-31 00:38:11 +00:00
|
|
|
|
|
|
|
// If 'new_match_fl_ref' is returned as true then there are new match id's in the current_match_id_array[]
|
2023-09-13 00:24:50 +00:00
|
|
|
rc_t exec( handle_t h,
|
|
|
|
double sec,
|
|
|
|
unsigned smpIdx,
|
|
|
|
unsigned muid,
|
|
|
|
unsigned status,
|
|
|
|
uint8_t d0,
|
|
|
|
uint8_t d1,
|
|
|
|
bool& new_match_fl_ref );
|
|
|
|
|
|
|
|
// Get the sftrack result_t indexes associated with the latest set of matches.
|
|
|
|
const unsigned* current_result_index_array( handle_t h, unsigned& cur_result_idx_array_cnt_ref );
|
2023-01-31 00:38:11 +00:00
|
|
|
|
2023-09-13 00:24:50 +00:00
|
|
|
// Clear the result index array. This should be done to empty the current_result_index_array()
|
|
|
|
void clear_result_index_array( handle_t h );
|
2023-01-31 00:38:11 +00:00
|
|
|
|
2023-05-25 20:11:34 +00:00
|
|
|
// Get the min and max cw loc values for the current score.
|
2023-09-13 00:24:50 +00:00
|
|
|
//rc_t cw_loc_range( handle_t h, unsigned& minLocRef, unsigned& maxLocRef );
|
|
|
|
//bool is_loc_in_range( handle_t h, unsigned loc );
|
2023-05-25 20:11:34 +00:00
|
|
|
|
2023-05-21 16:41:50 +00:00
|
|
|
unsigned has_stored_performance( handle_t h );
|
|
|
|
|
2023-05-25 20:11:34 +00:00
|
|
|
// Set the 'loc' field on the stored performance from the stored score following info.
|
|
|
|
rc_t sync_perf_to_score( handle_t h );
|
|
|
|
|
2023-09-13 00:24:50 +00:00
|
|
|
|
|
|
|
unsigned track_result_count( handle_t h );
|
|
|
|
const sftrack::result_t* track_result( handle_t h );
|
|
|
|
|
|
|
|
|
2023-05-25 20:11:34 +00:00
|
|
|
// Return the count of stored performance records in the performance array.
|
|
|
|
unsigned perf_count( handle_t h );
|
|
|
|
|
|
|
|
// Return the base of the stored performance array.
|
|
|
|
const score_follower::ssf_note_on_t* perf_base( handle_t h );
|
|
|
|
|
2023-05-13 11:55:34 +00:00
|
|
|
// Write an SVG file containing a graphic view of the score following results since the last call to reset().
|
2023-05-16 13:14:20 +00:00
|
|
|
// Set show_muid_fl to true to display the 'muid' of the performed notes in the
|
|
|
|
// SVG rendering, otherwise the performed note sequence (order of arrival) id is shown.
|
|
|
|
rc_t write_svg_file( handle_t h, const char* out_fname, bool show_muid_fl=false );
|
2023-05-13 11:55:34 +00:00
|
|
|
|
|
|
|
// Write the score to 'out_fname'.
|
|
|
|
void score_report( handle_t h, const char* out_fname );
|
|
|
|
|
|
|
|
// Use the stored MIDI data received since the last call to reset to generate a report
|
|
|
|
// using midi_state::report_events().
|
|
|
|
rc_t midi_state_rt_report( handle_t h, const char* out_fname );
|
|
|
|
|
2023-11-26 20:32:11 +00:00
|
|
|
rc_t write_sync_perf_csv( handle_t h, const char* out_fname, const midi::file::trackMsg_t** msgA, unsigned msgN );
|
|
|
|
|
|
|
|
|
2022-11-11 18:13:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|