2021-11-01 14:28:44 +00:00
|
|
|
#ifndef cwPianoScore_h
|
|
|
|
#define cwPianoScore_h
|
|
|
|
|
|
|
|
namespace cw
|
|
|
|
{
|
|
|
|
namespace score
|
|
|
|
{
|
|
|
|
typedef handle<struct score_str> handle_t;
|
|
|
|
|
|
|
|
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
|
|
|
|
char sci_pitch[4]; // scientific pitch
|
|
|
|
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
|
|
|
|
unsigned section; // section number or 0
|
|
|
|
struct event_str* link; // list link
|
|
|
|
} event_t;
|
|
|
|
|
|
|
|
rc_t create( handle_t& hRef, const char* fn );
|
|
|
|
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 );
|
|
|
|
|
2023-05-25 20:04:19 +00:00
|
|
|
/*
|
2021-11-06 02:23:18 +00:00
|
|
|
unsigned loc_count( handle_t h );
|
|
|
|
bool is_loc_valid( handle_t h, unsigned locId );
|
2022-12-05 22:21:02 +00:00
|
|
|
unsigned loc_to_measure( handle_t h, unsigned locId );
|
|
|
|
unsigned loc_to_next_note_on_measure( handle_t h, unsigned locId );
|
2023-02-26 18:44:12 +00:00
|
|
|
double locs_to_diff_seconds( handle_t h, unsigned loc0Id, unsigned loc1Id );
|
2023-05-25 20:04:19 +00:00
|
|
|
*/
|
2023-02-26 18:44:12 +00:00
|
|
|
|
2022-05-06 20:05:49 +00:00
|
|
|
const event_t* uid_to_event( handle_t h, unsigned uid );
|
|
|
|
|
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
|