2024-12-01 19:35:24 +00:00
|
|
|
//| Copyright: (C) 2020-2024 Kevin Larke <contact AT larke DOT org>
|
|
|
|
//| License: GNU GPL version 3.0 or above. See the accompanying LICENSE file.
|
2021-11-01 14:28:44 +00:00
|
|
|
#ifndef cwPianoScore_h
|
|
|
|
#define cwPianoScore_h
|
|
|
|
|
|
|
|
namespace cw
|
|
|
|
{
|
2023-09-13 00:27:56 +00:00
|
|
|
namespace perf_score
|
2021-11-01 14:28:44 +00:00
|
|
|
{
|
|
|
|
typedef handle<struct score_str> handle_t;
|
|
|
|
|
2024-02-08 16:03:36 +00:00
|
|
|
typedef struct stats_str
|
|
|
|
{
|
|
|
|
unsigned id; // see: perf_meas::k???VarIdx
|
|
|
|
double min;
|
|
|
|
double max;
|
|
|
|
double mean;
|
|
|
|
double std;
|
|
|
|
} stats_t;
|
|
|
|
|
2021-11-01 14:28:44 +00:00
|
|
|
typedef struct event_str
|
|
|
|
{
|
|
|
|
unsigned uid; // unique id for this event
|
|
|
|
unsigned meas; // measure number
|
|
|
|
unsigned voice; // score number
|
|
|
|
unsigned loc; // score location
|
|
|
|
unsigned tick; // event tick location
|
|
|
|
double sec; // event absolute time in seconds
|
|
|
|
double rval; // event rythmic value 2=1/2 1/4 .5=2 or 0
|
2023-11-26 20:26:17 +00:00
|
|
|
char sci_pitch[5]; // scientific pitch
|
2021-11-01 14:28:44 +00:00
|
|
|
char dmark[6]; // dynamic mark (e.g. "pp","mf","fff")
|
|
|
|
unsigned dlevel; // dynamic level as an integer associated with dyn. mark
|
|
|
|
unsigned status; // MIDI status < type | channel > or 0
|
|
|
|
unsigned d0; // MIDI d0 or 0
|
|
|
|
unsigned d1; // MIDI d1 or 0
|
|
|
|
unsigned bpm; // tempo BPM or 0
|
|
|
|
char grace_mark[4]; // grace mark or 0
|
|
|
|
unsigned bar; // bar number or 0
|
2023-11-26 20:26:17 +00:00
|
|
|
unsigned barPitchIdx; // bar pitch index or 0
|
2021-11-01 14:28:44 +00:00
|
|
|
unsigned section; // section number or 0
|
2023-11-26 20:26:17 +00:00
|
|
|
|
2024-02-08 16:03:36 +00:00
|
|
|
bool valid_stats_fl; // is statsA valid in this record[]
|
|
|
|
stats_t statsA[ perf_meas::kValCnt ];
|
|
|
|
|
2023-11-26 20:26:17 +00:00
|
|
|
double even;
|
|
|
|
double dyn;
|
|
|
|
double tempo;
|
|
|
|
double cost;
|
2024-02-08 16:03:36 +00:00
|
|
|
|
|
|
|
double featV[ perf_meas::kValCnt ];
|
|
|
|
double featMinV[ perf_meas::kValCnt ];
|
|
|
|
double featMaxV[ perf_meas::kValCnt ];
|
2023-11-26 20:26:17 +00:00
|
|
|
|
2021-11-01 14:28:44 +00:00
|
|
|
struct event_str* link; // list link
|
|
|
|
} event_t;
|
|
|
|
|
2023-11-26 20:26:17 +00:00
|
|
|
rc_t create( handle_t& hRef, const char* csv_fname );
|
2021-11-01 14:28:44 +00:00
|
|
|
rc_t create( handle_t& hRef, const object_t* cfg );
|
2023-05-25 20:04:19 +00:00
|
|
|
|
|
|
|
// Read a CSV as written by cwIoMidiRecordPlay.save_csv().
|
|
|
|
// In this case event.loc == event.muid.
|
|
|
|
rc_t create_from_midi_csv( handle_t& hRef, const char* fn );
|
2021-11-01 14:28:44 +00:00
|
|
|
rc_t destroy( handle_t& hRef );
|
|
|
|
|
2023-05-25 20:04:19 +00:00
|
|
|
|
|
|
|
bool has_loc_info_flag( handle_t h );
|
2021-11-06 02:23:18 +00:00
|
|
|
|
2021-11-01 14:28:44 +00:00
|
|
|
unsigned event_count( handle_t h );
|
|
|
|
const event_t* base_event( handle_t h );
|
2021-11-06 02:23:18 +00:00
|
|
|
|
2023-02-26 18:44:12 +00:00
|
|
|
const event_t* loc_to_event( handle_t h, unsigned loc );
|
2022-12-05 22:21:02 +00:00
|
|
|
|
2021-11-06 02:23:18 +00:00
|
|
|
// Format the event as a string for printing.
|
2021-11-01 14:28:44 +00:00
|
|
|
rc_t event_to_string( handle_t h, unsigned uid, char* buf, unsigned buf_byte_cnt );
|
|
|
|
|
2021-12-26 03:12:56 +00:00
|
|
|
rc_t test( const object_t* cfg );
|
2021-11-01 14:28:44 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|