Przeglądaj źródła

cmXScore.c : Removed use of MIDI file event UID's.

master
kevin 8 lat temu
rodzic
commit
d14744ed4d
1 zmienionych plików z 11 dodań i 14 usunięć
  1. 11
    14
      app/cmXScore.c

+ 11
- 14
app/cmXScore.c Wyświetl plik

@@ -90,7 +90,6 @@ typedef struct cmXsNote_str
90 90
   unsigned                    locIdx;   // location index (chords share the same location index)
91 91
   double                      rvalue;   // 1/rvalue = rythmic value (1/0.5 double whole 1/1 whole 1/2 half 1/4=quarter note, 1/8=eighth note, ...)
92 92
   const cmChar_t*             tvalue;   // text value
93
-  unsigned                    mf_uid;   // MIDI file uid assigned to this event
94 93
 
95 94
   unsigned                    evenGroupId;   // eveness group id
96 95
   unsigned                    dynGroupId;    // dynamics group id
@@ -3092,8 +3091,8 @@ cmXsRC_t _cmXsWriteMidiFile( cmCtx_t* ctx, cmXsH_t h, const cmChar_t* dir, const
3092 3091
               if( np->tied_dur <= 0 )
3093 3092
                 cmErrWarnMsg(&p->err,kOkXsRC,"A zero length note was encountered bar:%i tick:%i %s",np->meas->number,np->tick,cmMidiToSciPitch(np->pitch,NULL,0));
3094 3093
               
3095
-              if( cmMidiFileInsertTrackChMsg(mfH, 1, np->tick,                kNoteOnMdId,  np->pitch, np->vel, &np->mf_uid ) != kOkMfRC
3096
-                ||cmMidiFileInsertTrackChMsg(mfH, 1, np->tick + np->tied_dur, kNoteOffMdId, np->pitch, 0, &np->mf_uid )       != kOkMfRC )
3094
+              if( cmMidiFileInsertTrackChMsg(mfH, 1, np->tick,                kNoteOnMdId,  np->pitch, np->vel ) != kOkMfRC
3095
+                ||cmMidiFileInsertTrackChMsg(mfH, 1, np->tick + np->tied_dur, kNoteOffMdId, np->pitch, 0 )       != kOkMfRC )
3097 3096
               {
3098 3097
                 rc = kMidiFailXsRC;
3099 3098
               }
@@ -3108,8 +3107,8 @@ cmXsRC_t _cmXsWriteMidiFile( cmCtx_t* ctx, cmXsH_t h, const cmChar_t* dir, const
3108 3107
                 cmErrWarnMsg(&p->err,kOkXsRC,"A zero length pedal event was encountered bar:%i tick:%i",np->meas->number,np->tick);
3109 3108
               
3110 3109
               cmMidiByte_t d0     = cmIsFlag(np->flags,kSostDnXsFl) ? kSostenutoCtlMdId : kSustainCtlMdId;              
3111
-              if( (cmMidiFileInsertTrackChMsg(mfH, 1, np->tick,                kCtlMdId, d0, 127, &np->mf_uid ) != kOkMfRC )
3112
-                ||(cmMidiFileInsertTrackChMsg(mfH, 1, np->tick + np->duration, kCtlMdId, d0,   0, &np->mf_uid ) != kOkMfRC ) )
3110
+              if( (cmMidiFileInsertTrackChMsg(mfH, 1, np->tick,                kCtlMdId, d0, 127 ) != kOkMfRC )
3111
+                ||(cmMidiFileInsertTrackChMsg(mfH, 1, np->tick + np->duration, kCtlMdId, d0,   0 ) != kOkMfRC ) )
3113 3112
               {
3114 3113
                 rc = kMidiFailXsRC;
3115 3114
               }
@@ -3117,7 +3116,7 @@ cmXsRC_t _cmXsWriteMidiFile( cmCtx_t* ctx, cmXsH_t h, const cmChar_t* dir, const
3117 3116
             break;
3118 3117
 
3119 3118
           case kMetronomeXsFl:
3120
-            if( cmMidFileInsertTrackTempoMsg(mfH, 0, np->tick, np->duration, &np->mf_uid ) != kOkMfRC )
3119
+            if( cmMidFileInsertTrackTempoMsg(mfH, 0, np->tick, np->duration ) != kOkMfRC )
3121 3120
               rc = kMidiFailXsRC;            
3122 3121
             break;
3123 3122
             
@@ -3164,7 +3163,6 @@ typedef struct cmXsSvgEvt_str
3164 3163
   unsigned         voice;     // score voice number
3165 3164
   unsigned         d0;        // MIDI d0   (barNumb)
3166 3165
   unsigned         d1;        // MIDI d1
3167
-  unsigned         mf_uid;
3168 3166
   struct cmXsSvgEvt_str* link;
3169 3167
 } cmXsSvgEvt_t;
3170 3168
 
@@ -3218,7 +3216,7 @@ cmXsRC_t _cmXsWriteMidiSvg( cmCtx_t* ctx, cmXScore_t* p, cmXsMidiFile_t* mf, con
3218 3216
             rc = kSvgFailXsRC;
3219 3217
           else
3220 3218
           {
3221
-            t0 = cmTsPrintfP(t0,"%s %i",cmMidiToSciPitch( e->d0, NULL, 0),e->mf_uid);
3219
+            t0 = cmTsPrintfP(t0,"%s",cmMidiToSciPitch( e->d0, NULL, 0));
3222 3220
             
3223 3221
             if( cmSvgWriterText(svgH, e->tick + e->durTicks/2, e->d0 * noteHeight + noteHeight/2, t0, "pitch") != kOkSvgRC )
3224 3222
               rc = kSvgFailXsRC;
@@ -3269,7 +3267,7 @@ cmXsRC_t _cmXsWriteMidiSvg( cmCtx_t* ctx, cmXScore_t* p, cmXsMidiFile_t* mf, con
3269 3267
 }
3270 3268
 
3271 3269
 
3272
-void _cmXsPushSvgEvent( cmXScore_t* p, cmXsMidiFile_t* mf, unsigned flags, unsigned tick, unsigned durTick, unsigned voice, unsigned d0, unsigned d1, unsigned mf_uid )
3270
+void _cmXsPushSvgEvent( cmXScore_t* p, cmXsMidiFile_t* mf, unsigned flags, unsigned tick, unsigned durTick, unsigned voice, unsigned d0, unsigned d1 )
3273 3271
 {
3274 3272
   cmXsSvgEvt_t* e = cmLhAllocZ(p->lhH,cmXsSvgEvt_t,1);
3275 3273
   e->flags    = flags;
@@ -3278,7 +3276,6 @@ void _cmXsPushSvgEvent( cmXScore_t* p, cmXsMidiFile_t* mf, unsigned flags, unsig
3278 3276
   e->voice    = voice;
3279 3277
   e->d0       = d0;       // note=pitch bar=number pedal=ctl# metronome=BPM 
3280 3278
   e->d1       = d1;
3281
-  e->mf_uid   = mf_uid;
3282 3279
   
3283 3280
   if( mf->eol != NULL )
3284 3281
     mf->eol->link = e;
@@ -3316,7 +3313,7 @@ cmXsRC_t _cmXScoreGenSvg( cmCtx_t* ctx, cmXsH_t h, const cmChar_t* dir, const cm
3316 3313
         if( cmIsFlag(note->flags,kMetronomeXsFl) )
3317 3314
         {
3318 3315
           // set BPM as d0
3319
-          _cmXsPushSvgEvent(p,&mf,note->flags,note->tick,0,0,note->duration,0,note->mf_uid);
3316
+          _cmXsPushSvgEvent(p,&mf,note->flags,note->tick,0,0,note->duration,0);
3320 3317
           continue;
3321 3318
           
3322 3319
         }
@@ -3332,14 +3329,14 @@ cmXsRC_t _cmXScoreGenSvg( cmCtx_t* ctx, cmXsH_t h, const cmChar_t* dir, const cm
3332 3329
             for(; tn!=NULL; tn=tn->tied)
3333 3330
               durTick += tn->tied_dur;
3334 3331
           }
3335
-          _cmXsPushSvgEvent(p,&mf,note->flags,note->tick,durTick,note->voice->id,d0,note->vel,note->mf_uid);
3332
+          _cmXsPushSvgEvent(p,&mf,note->flags,note->tick,durTick,note->voice->id,d0,note->vel);
3336 3333
           continue;
3337 3334
         }
3338 3335
 
3339 3336
         // if this is a bar event
3340 3337
         if( cmIsFlag(note->flags,kBarXsFl) )
3341 3338
         {
3342
-          _cmXsPushSvgEvent(p,&mf,note->flags,note->tick,0,0,note->meas->number,0, note->mf_uid);
3339
+          _cmXsPushSvgEvent(p,&mf,note->flags,note->tick,0,0,note->meas->number,0);
3343 3340
           continue;
3344 3341
         }
3345 3342
 
@@ -3347,7 +3344,7 @@ cmXsRC_t _cmXScoreGenSvg( cmCtx_t* ctx, cmXsH_t h, const cmChar_t* dir, const cm
3347 3344
         if( cmIsFlag(note->flags,kDampDnXsFl|kDampUpDnXsFl|kSostDnXsFl) )
3348 3345
         {
3349 3346
           unsigned d0 = cmIsFlag(note->flags,kSostDnXsFl) ? kSostenutoCtlMdId : kSustainCtlMdId;          
3350
-          _cmXsPushSvgEvent(p,&mf,note->flags,note->tick,note->duration,0,d0,127,note->mf_uid);
3347
+          _cmXsPushSvgEvent(p,&mf,note->flags,note->tick,note->duration,0,d0,127);
3351 3348
           continue;
3352 3349
         }
3353 3350
         

Ładowanie…
Anuluj
Zapisz