Browse Source

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

master
kevin 8 years ago
parent
commit
d14744ed4d
1 changed files with 11 additions and 14 deletions
  1. 11
    14
      app/cmXScore.c

+ 11
- 14
app/cmXScore.c View File

90
   unsigned                    locIdx;   // location index (chords share the same location index)
90
   unsigned                    locIdx;   // location index (chords share the same location index)
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, ...)
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
   const cmChar_t*             tvalue;   // text value
92
   const cmChar_t*             tvalue;   // text value
93
-  unsigned                    mf_uid;   // MIDI file uid assigned to this event
94
 
93
 
95
   unsigned                    evenGroupId;   // eveness group id
94
   unsigned                    evenGroupId;   // eveness group id
96
   unsigned                    dynGroupId;    // dynamics group id
95
   unsigned                    dynGroupId;    // dynamics group id
3092
               if( np->tied_dur <= 0 )
3091
               if( np->tied_dur <= 0 )
3093
                 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));
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
                 rc = kMidiFailXsRC;
3097
                 rc = kMidiFailXsRC;
3099
               }
3098
               }
3108
                 cmErrWarnMsg(&p->err,kOkXsRC,"A zero length pedal event was encountered bar:%i tick:%i",np->meas->number,np->tick);
3107
                 cmErrWarnMsg(&p->err,kOkXsRC,"A zero length pedal event was encountered bar:%i tick:%i",np->meas->number,np->tick);
3109
               
3108
               
3110
               cmMidiByte_t d0     = cmIsFlag(np->flags,kSostDnXsFl) ? kSostenutoCtlMdId : kSustainCtlMdId;              
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
                 rc = kMidiFailXsRC;
3113
                 rc = kMidiFailXsRC;
3115
               }
3114
               }
3117
             break;
3116
             break;
3118
 
3117
 
3119
           case kMetronomeXsFl:
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
               rc = kMidiFailXsRC;            
3120
               rc = kMidiFailXsRC;            
3122
             break;
3121
             break;
3123
             
3122
             
3164
   unsigned         voice;     // score voice number
3163
   unsigned         voice;     // score voice number
3165
   unsigned         d0;        // MIDI d0   (barNumb)
3164
   unsigned         d0;        // MIDI d0   (barNumb)
3166
   unsigned         d1;        // MIDI d1
3165
   unsigned         d1;        // MIDI d1
3167
-  unsigned         mf_uid;
3168
   struct cmXsSvgEvt_str* link;
3166
   struct cmXsSvgEvt_str* link;
3169
 } cmXsSvgEvt_t;
3167
 } cmXsSvgEvt_t;
3170
 
3168
 
3218
             rc = kSvgFailXsRC;
3216
             rc = kSvgFailXsRC;
3219
           else
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
             if( cmSvgWriterText(svgH, e->tick + e->durTicks/2, e->d0 * noteHeight + noteHeight/2, t0, "pitch") != kOkSvgRC )
3221
             if( cmSvgWriterText(svgH, e->tick + e->durTicks/2, e->d0 * noteHeight + noteHeight/2, t0, "pitch") != kOkSvgRC )
3224
               rc = kSvgFailXsRC;
3222
               rc = kSvgFailXsRC;
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
   cmXsSvgEvt_t* e = cmLhAllocZ(p->lhH,cmXsSvgEvt_t,1);
3272
   cmXsSvgEvt_t* e = cmLhAllocZ(p->lhH,cmXsSvgEvt_t,1);
3275
   e->flags    = flags;
3273
   e->flags    = flags;
3278
   e->voice    = voice;
3276
   e->voice    = voice;
3279
   e->d0       = d0;       // note=pitch bar=number pedal=ctl# metronome=BPM 
3277
   e->d0       = d0;       // note=pitch bar=number pedal=ctl# metronome=BPM 
3280
   e->d1       = d1;
3278
   e->d1       = d1;
3281
-  e->mf_uid   = mf_uid;
3282
   
3279
   
3283
   if( mf->eol != NULL )
3280
   if( mf->eol != NULL )
3284
     mf->eol->link = e;
3281
     mf->eol->link = e;
3316
         if( cmIsFlag(note->flags,kMetronomeXsFl) )
3313
         if( cmIsFlag(note->flags,kMetronomeXsFl) )
3317
         {
3314
         {
3318
           // set BPM as d0
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
           continue;
3317
           continue;
3321
           
3318
           
3322
         }
3319
         }
3332
             for(; tn!=NULL; tn=tn->tied)
3329
             for(; tn!=NULL; tn=tn->tied)
3333
               durTick += tn->tied_dur;
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
           continue;
3333
           continue;
3337
         }
3334
         }
3338
 
3335
 
3339
         // if this is a bar event
3336
         // if this is a bar event
3340
         if( cmIsFlag(note->flags,kBarXsFl) )
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
           continue;
3340
           continue;
3344
         }
3341
         }
3345
 
3342
 
3347
         if( cmIsFlag(note->flags,kDampDnXsFl|kDampUpDnXsFl|kSostDnXsFl) )
3344
         if( cmIsFlag(note->flags,kDampDnXsFl|kDampUpDnXsFl|kSostDnXsFl) )
3348
         {
3345
         {
3349
           unsigned d0 = cmIsFlag(note->flags,kSostDnXsFl) ? kSostenutoCtlMdId : kSustainCtlMdId;          
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
           continue;
3348
           continue;
3352
         }
3349
         }
3353
         
3350
         

Loading…
Cancel
Save