cmScore.h: Added cmScStatusToOpString(). Replaced calls to cmMidiMetaStatusToLabel() and cmMidiStatusToLabel() with calls to cmScStatusToOpStr().
This commit is contained in:
parent
176073874f
commit
c7bf7a2c94
@ -133,19 +133,19 @@ typedef struct
|
|||||||
|
|
||||||
cmScEvtRef_t _cmScEvtRefArray[] =
|
cmScEvtRef_t _cmScEvtRefArray[] =
|
||||||
{
|
{
|
||||||
{ kTimeSigEvtScId, 0, "tsg" },
|
{ kTimeSigEvtScId, kTimeSigMdId, "tsg" },
|
||||||
{ kKeySigEvtScId, 0, "ksg" },
|
{ kKeySigEvtScId, kKeySigMdId, "ksg" },
|
||||||
{ kTempoEvtScId, 0, "tmp" },
|
{ kTempoEvtScId, kTempoMdId, "tmp" },
|
||||||
{ kTrackEvtScId, 0, "trk" },
|
{ kTrackEvtScId, kTrkNameMdId, "trk" },
|
||||||
{ kTextEvtScId, 0, "txt" },
|
{ kTextEvtScId, kTextMdId, "txt" },
|
||||||
{ kNameEvtScId, 0, "nam" },
|
{ kNameEvtScId, kInstrNameMdId,"nam" },
|
||||||
{ kEOTrackEvtScId, 0, "eot" },
|
{ kEOTrackEvtScId, kEndOfTrkMdId, "eot" },
|
||||||
{ kCopyEvtScId, 0, "cpy" },
|
{ kCopyEvtScId, kCopyMdId, "cpy" },
|
||||||
{ kBlankEvtScId, 0, "blk" },
|
{ kBlankEvtScId, 0, "blk" },
|
||||||
{ kBarEvtScId, 0, "bar" },
|
{ kBarEvtScId, 0, "bar" },
|
||||||
{ kPgmEvtScId, 0, "pgm" },
|
{ kPgmEvtScId, kPgmMdId, "pgm" },
|
||||||
{ kCtlEvtScId, 0, "ctl" },
|
{ kCtlEvtScId, kCtlMdId, "ctl" },
|
||||||
{ kNonEvtScId, 0, "non" },
|
{ kNonEvtScId, kNoteOnMdId, "non" },
|
||||||
{ kInvalidEvtScId, 0, "***" }
|
{ kInvalidEvtScId, 0, "***" }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -196,6 +196,20 @@ const cmChar_t* cmScEvtTypeIdToLabel( unsigned id )
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const cmChar_t* cmScStatusToOpString( unsigned id )
|
||||||
|
{
|
||||||
|
if( id == 0 )
|
||||||
|
return "<unknown>";
|
||||||
|
|
||||||
|
cmScEvtRef_t* r = _cmScEvtRefArray;
|
||||||
|
for(; r->id != kInvalidEvtScId; ++r )
|
||||||
|
if( r->flag == id )
|
||||||
|
return r->label;
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
unsigned _cmScDynLabelToId( const cmChar_t* label )
|
unsigned _cmScDynLabelToId( const cmChar_t* label )
|
||||||
{
|
{
|
||||||
cmScEvtRef_t* r = _cmScDynRefArray;
|
cmScEvtRef_t* r = _cmScDynRefArray;
|
||||||
@ -2419,6 +2433,9 @@ cmScRC_t cmScoreFileFromMidi( cmCtx_t* ctx, const cmChar_t* midiFn, const c
|
|||||||
goto errLabel;
|
goto errLabel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
printf("secs:%f smps:%f\n",cmMidiFileDurSecs(mfH),cmMidiFileDurSecs(mfH)*96000);
|
||||||
|
|
||||||
|
|
||||||
// Convert the track message 'dtick' field to delta-microseconds.
|
// Convert the track message 'dtick' field to delta-microseconds.
|
||||||
cmMidiFileTickToMicros(mfH);
|
cmMidiFileTickToMicros(mfH);
|
||||||
|
|
||||||
@ -2463,7 +2480,8 @@ cmScRC_t cmScoreFileFromMidi( cmCtx_t* ctx, const cmChar_t* midiFn, const c
|
|||||||
|
|
||||||
if( tmp->status == kMetaStId )
|
if( tmp->status == kMetaStId )
|
||||||
{
|
{
|
||||||
opStr = cmMidiMetaStatusToLabel(tmp->metaId);
|
//opStr = cmMidiMetaStatusToLabel(tmp->metaId);
|
||||||
|
opStr = cmScStatusToOpString(tmp->metaId);
|
||||||
metaId = tmp->metaId;
|
metaId = tmp->metaId;
|
||||||
|
|
||||||
switch( tmp->metaId )
|
switch( tmp->metaId )
|
||||||
@ -2474,7 +2492,8 @@ cmScRC_t cmScoreFileFromMidi( cmCtx_t* ctx, const cmChar_t* midiFn, const c
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
opStr = cmMidiStatusToLabel(tmp->status);
|
//opStr = cmMidiStatusToLabel(tmp->status);
|
||||||
|
opStr = cmScStatusToOpString(tmp->status);
|
||||||
if( cmMidiIsChStatus( tmp->status ) )
|
if( cmMidiIsChStatus( tmp->status ) )
|
||||||
{
|
{
|
||||||
midiCh = tmp->u.chMsgPtr->ch;
|
midiCh = tmp->u.chMsgPtr->ch;
|
||||||
|
@ -157,7 +157,7 @@ extern "C" {
|
|||||||
|
|
||||||
const cmChar_t* cmScEvtTypeIdToLabel( unsigned id );
|
const cmChar_t* cmScEvtTypeIdToLabel( unsigned id );
|
||||||
const cmChar_t* cmScDynIdToLabel( unsigned id );
|
const cmChar_t* cmScDynIdToLabel( unsigned id );
|
||||||
|
const cmChar_t* cmScStatusToOpString( unsigned id );
|
||||||
|
|
||||||
// Initialize a score object from a CSV File generated from a score spreadsheet.
|
// Initialize a score object from a CSV File generated from a score spreadsheet.
|
||||||
// The dynRefArray[dynRefCnt] and cbFunc(cbArg) are optional if these
|
// The dynRefArray[dynRefCnt] and cbFunc(cbArg) are optional if these
|
||||||
|
Loading…
Reference in New Issue
Block a user