2012-10-30 03:52:39 +00:00
|
|
|
#ifndef cmScore_h
|
|
|
|
#define cmScore_h
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
kOkScRC = cmOkRC,
|
|
|
|
kCsvFailScRC,
|
|
|
|
kSyntaxErrScRC,
|
|
|
|
kInvalidIdxScRC,
|
|
|
|
kTimeLineFailScRC
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
kInvalidEvtScId = 0,
|
|
|
|
kTimeSigEvtScId,
|
|
|
|
kKeySigEvtScId,
|
|
|
|
kTempoEvtScId,
|
|
|
|
kTrackEvtScId,
|
|
|
|
kTextEvtScId,
|
|
|
|
kEOTrackEvtScId,
|
|
|
|
kCopyEvtScId,
|
|
|
|
kBlankEvtScId,
|
|
|
|
kBarEvtScId,
|
|
|
|
kPgmEvtScId,
|
|
|
|
kCtlEvtScId,
|
|
|
|
kNonEvtScId
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
kEvenScFl = 0x01, // This note is marked for evenness measurement
|
|
|
|
kDynScFl = 0x02, // This note is marked for dynamics measurement
|
|
|
|
kTempoScFl = 0x03, // This note is marked for tempo measurement
|
|
|
|
kSkipScFl = 0x04 // this isn't a real event (e.g. tied note) skip over it
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
unsigned type; // Event type
|
|
|
|
double dsecs; //
|
|
|
|
cmMidiByte_t pitch; // MIDI pitch of this note
|
|
|
|
unsigned flags; // Attribute flags for this event
|
|
|
|
unsigned dynVal; // Dynamcis value pppp to ffff (1 to 11) for this note.
|
|
|
|
unsigned barNumb; // bar number of this event
|
|
|
|
unsigned barNoteIdx; // index of this note in this bar
|
|
|
|
} cmScoreEvt_t;
|
|
|
|
|
2012-11-03 02:06:34 +00:00
|
|
|
typedef void (*cmScCb_t)( void* arg, const void* data, unsigned byteCnt );
|
2012-10-30 03:52:39 +00:00
|
|
|
|
|
|
|
typedef cmRC_t cmScRC_t;
|
|
|
|
typedef cmHandle_t cmScH_t;
|
2012-11-03 02:06:34 +00:00
|
|
|
|
|
|
|
typedef void (*cmScCb_t)( void* arg, const void* data, unsigned byteCnt );
|
2012-10-30 03:52:39 +00:00
|
|
|
|
|
|
|
extern cmScH_t cmScNullHandle;
|
|
|
|
|
2012-11-03 02:06:34 +00:00
|
|
|
const cmChar_t* cmScEvtTypeIdToLabel( unsigned id );
|
|
|
|
const cmChar_t* cmScDynIdToLabel( unsigned id );
|
|
|
|
|
|
|
|
|
2012-10-30 03:52:39 +00:00
|
|
|
// Initialize a score object from a CSV File generated from a score spreadsheet.
|
2012-11-03 02:06:34 +00:00
|
|
|
cmScRC_t cmScoreInitialize( cmCtx_t* ctx, cmScH_t* hp, const cmChar_t* fn, cmScCb_t cbFunc, void* cbArg );
|
|
|
|
cmScRC_t cmScoreFinalize( cmScH_t* hp );
|
|
|
|
|
|
|
|
// Filename of last successfuly loaded score file.
|
|
|
|
const cmChar_t* cmScoreFileName( cmScH_t h );
|
2012-10-30 03:52:39 +00:00
|
|
|
|
|
|
|
bool cmScoreIsValid( cmScH_t h );
|
|
|
|
|
|
|
|
// Access the score data.
|
|
|
|
unsigned cmScoreEvtCount( cmScH_t h );
|
|
|
|
cmScoreEvt_t* cmScoreEvt( cmScH_t h, unsigned idx );
|
|
|
|
|
2012-11-03 02:06:34 +00:00
|
|
|
|
|
|
|
cmScRC_t cmScoreSeqNotify( cmScH_t h );
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
kInvalidMsgScId,
|
|
|
|
kBeginMsgScId,
|
|
|
|
kEventMsgScId,
|
|
|
|
kEndMsgScId
|
|
|
|
} cmScMsgTypeId_t;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
cmScMsgTypeId_t typeId;
|
|
|
|
cmScoreEvt_t evt; // only used when typeId == kEventMsgScId
|
|
|
|
} cmScMsg_t;
|
|
|
|
|
|
|
|
cmScRC_t cmScoreDecode( const void* msg, unsigned msgByteCnt, cmScMsg_t* );
|
|
|
|
|
2012-10-30 03:52:39 +00:00
|
|
|
void cmScorePrint( cmScH_t h, cmRpt_t* rpt );
|
|
|
|
|
|
|
|
cmScRC_t cmScoreSyncTimeLine( cmScH_t scH, cmTlH_t tlH, unsigned editDistWndCnt, cmReal_t maxNoteOffsetSecs );
|
|
|
|
|
|
|
|
cmScRC_t cmScoreSyncTimeLineTest( cmCtx_t* ctx, const cmChar_t* timeLineJsFn, const cmChar_t* scoreCsvFn );
|
|
|
|
|
2012-11-03 02:06:34 +00:00
|
|
|
void cmScoreTest( cmCtx_t* ctx, const cmChar_t* fn );
|
2012-10-30 03:52:39 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif
|