|
@@ -1109,6 +1109,38 @@ const cmMidiTrackMsg_t** cmMidiFileMsgArray( cmMidiFileH_t h )
|
1109
|
1109
|
return (const cmMidiTrackMsg_t**)mfp->msgV;
|
1110
|
1110
|
}
|
1111
|
1111
|
|
|
1112
|
+
|
|
1113
|
+cmMidiTrackMsg_t* _cmMidiFileUidToMsg( _cmMidiFile_t* mfp, unsigned uid )
|
|
1114
|
+{
|
|
1115
|
+ unsigned i;
|
|
1116
|
+
|
|
1117
|
+ for(i=0; i<mfp->msgN; ++i)
|
|
1118
|
+ if( mfp->msgV[i]->uid == uid )
|
|
1119
|
+ return mfp->msgV[i];
|
|
1120
|
+
|
|
1121
|
+ return NULL;
|
|
1122
|
+}
|
|
1123
|
+
|
|
1124
|
+cmMfRC_t cmMidiFileSetVelocity( cmMidiFileH_t h, unsigned uid, cmMidiByte_t vel )
|
|
1125
|
+{
|
|
1126
|
+ cmMidiTrackMsg_t* r;
|
|
1127
|
+ _cmMidiFile_t* mfp = _cmMidiFileHandleToPtr(h);
|
|
1128
|
+
|
|
1129
|
+ assert( mfp != NULL );
|
|
1130
|
+
|
|
1131
|
+ if((r = _cmMidiFileUidToMsg(mfp,uid)) == NULL )
|
|
1132
|
+ return cmErrMsg(&mfp->err,kUidNotFoundMfRC,"The MIDI file uid %i could not be found.",uid);
|
|
1133
|
+
|
|
1134
|
+ if( cmMidiIsNoteOn(r->status)==false && cmMidiIsNoteOff(r->status,0)==false )
|
|
1135
|
+ return cmErrMsg(&mfp->err,kUidNotANoteMsgMfRC,"Cannot set velocity on a non-Note-On/Off msg.");
|
|
1136
|
+
|
|
1137
|
+ cmMidiChMsg_t* chm = (cmMidiChMsg_t*)r->u.chMsgPtr;
|
|
1138
|
+
|
|
1139
|
+ chm->d1 = vel;
|
|
1140
|
+
|
|
1141
|
+ return kOkMfRC;
|
|
1142
|
+}
|
|
1143
|
+
|
1112
|
1144
|
unsigned cmMidiFileSeekUsecs( cmMidiFileH_t h, unsigned long long offsUSecs, unsigned* msgUsecsPtr, unsigned* microsPerTickPtr )
|
1113
|
1145
|
{
|
1114
|
1146
|
_cmMidiFile_t* p;
|