Browse Source

cmScore.h: Added cmScStatusToOpString(). Replaced calls to cmMidiMetaStatusToLabel() and cmMidiStatusToLabel() with calls to cmScStatusToOpStr().

master
kevin 9 years ago
parent
commit
c7bf7a2c94
2 changed files with 37 additions and 18 deletions
  1. 36
    17
      app/cmScore.c
  2. 1
    1
      app/cmScore.h

+ 36
- 17
app/cmScore.c View File

133
 
133
 
134
 cmScEvtRef_t _cmScEvtRefArray[] = 
134
 cmScEvtRef_t _cmScEvtRefArray[] = 
135
 {
135
 {
136
-  { kTimeSigEvtScId, 0, "tsg" },
137
-  { kKeySigEvtScId, 0,  "ksg" },
138
-  { kTempoEvtScId, 0,   "tmp" },
139
-  { kTrackEvtScId, 0,   "trk" },
140
-  { kTextEvtScId, 0,    "txt" },
141
-  { kNameEvtScId, 0,    "nam" },
142
-  { kEOTrackEvtScId, 0, "eot" },
143
-  { kCopyEvtScId, 0,    "cpy" },
144
-  { kBlankEvtScId, 0,   "blk" },
145
-  { kBarEvtScId, 0,     "bar" },
146
-  { kPgmEvtScId, 0,     "pgm" },
147
-  { kCtlEvtScId, 0,     "ctl" },
148
-  { kNonEvtScId, 0,     "non" },
136
+  { kTimeSigEvtScId, kTimeSigMdId,  "tsg" },
137
+  { kKeySigEvtScId,  kKeySigMdId,   "ksg" },
138
+  { kTempoEvtScId,   kTempoMdId,    "tmp" },
139
+  { kTrackEvtScId,   kTrkNameMdId,  "trk" },
140
+  { kTextEvtScId,    kTextMdId,     "txt" },
141
+  { kNameEvtScId,    kInstrNameMdId,"nam" },
142
+  { kEOTrackEvtScId, kEndOfTrkMdId, "eot" },
143
+  { kCopyEvtScId,    kCopyMdId,     "cpy" },
144
+  { kBlankEvtScId,   0,             "blk" },
145
+  { kBarEvtScId,     0,             "bar" },
146
+  { kPgmEvtScId,     kPgmMdId,      "pgm" },
147
+  { kCtlEvtScId,     kCtlMdId,      "ctl" },
148
+  { kNonEvtScId,     kNoteOnMdId,   "non" },
149
   { kInvalidEvtScId, 0, "***" }
149
   { kInvalidEvtScId, 0, "***" }
150
 };
150
 };
151
 
151
 
196
   return NULL;
196
   return NULL;
197
 }
197
 }
198
 
198
 
199
+const cmChar_t* cmScStatusToOpString( unsigned id )
200
+{
201
+  if( id == 0 )
202
+    return "<unknown>";
203
+  
204
+  cmScEvtRef_t* r = _cmScEvtRefArray;
205
+  for(; r->id != kInvalidEvtScId; ++r )
206
+    if( r->flag == id )
207
+      return r->label;
208
+  return NULL;
209
+  
210
+}
211
+
212
+
199
 unsigned _cmScDynLabelToId( const cmChar_t* label )
213
 unsigned _cmScDynLabelToId( const cmChar_t* label )
200
 {
214
 {
201
   cmScEvtRef_t* r = _cmScDynRefArray;
215
   cmScEvtRef_t* r = _cmScDynRefArray;
2419
     goto errLabel;
2433
     goto errLabel;
2420
   }
2434
   }
2421
 
2435
 
2436
+    printf("secs:%f smps:%f\n",cmMidiFileDurSecs(mfH),cmMidiFileDurSecs(mfH)*96000);
2437
+  
2438
+
2422
   // Convert the track message 'dtick' field to delta-microseconds.
2439
   // Convert the track message 'dtick' field to delta-microseconds.
2423
   cmMidiFileTickToMicros(mfH);
2440
   cmMidiFileTickToMicros(mfH);
2424
 
2441
 
2456
     unsigned                midiCh = 0;
2473
     unsigned                midiCh = 0;
2457
     unsigned                d0     = 0;
2474
     unsigned                d0     = 0;
2458
     unsigned                d1     = 0;
2475
     unsigned                d1     = 0;
2459
-    unsigned metaId = 0;
2460
-    double   dsecs  = (double)tmp->dtick / 1000000.0;
2476
+    unsigned                metaId = 0;
2477
+    double                  dsecs  = (double)tmp->dtick / 1000000.0;
2461
 
2478
 
2462
     acc_secs += dsecs;
2479
     acc_secs += dsecs;
2463
 
2480
 
2464
     if( tmp->status == kMetaStId )
2481
     if( tmp->status == kMetaStId )
2465
     {
2482
     {
2466
-      opStr  = cmMidiMetaStatusToLabel(tmp->metaId);
2483
+      //opStr  = cmMidiMetaStatusToLabel(tmp->metaId);
2484
+      opStr  = cmScStatusToOpString(tmp->metaId);
2467
       metaId = tmp->metaId;
2485
       metaId = tmp->metaId;
2468
 
2486
 
2469
       switch( tmp->metaId )
2487
       switch( tmp->metaId )
2474
     }
2492
     }
2475
     else
2493
     else
2476
     {
2494
     {
2477
-      opStr = cmMidiStatusToLabel(tmp->status);
2495
+      //opStr = cmMidiStatusToLabel(tmp->status);
2496
+      opStr = cmScStatusToOpString(tmp->status);
2478
       if( cmMidiIsChStatus( tmp->status ) )
2497
       if( cmMidiIsChStatus( tmp->status ) )
2479
       {
2498
       {
2480
         midiCh = tmp->u.chMsgPtr->ch;
2499
         midiCh = tmp->u.chMsgPtr->ch;

+ 1
- 1
app/cmScore.h View File

157
 
157
 
158
   const cmChar_t* cmScEvtTypeIdToLabel( unsigned id );
158
   const cmChar_t* cmScEvtTypeIdToLabel( unsigned id );
159
   const cmChar_t* cmScDynIdToLabel( unsigned id );
159
   const cmChar_t* cmScDynIdToLabel( unsigned id );
160
-
160
+  const cmChar_t* cmScStatusToOpString( unsigned id );
161
 
161
 
162
   // Initialize a score object from a CSV File generated from a score spreadsheet.
162
   // Initialize a score object from a CSV File generated from a score spreadsheet.
163
   // The dynRefArray[dynRefCnt] and cbFunc(cbArg) are optional if these 
163
   // The dynRefArray[dynRefCnt] and cbFunc(cbArg) are optional if these 

Loading…
Cancel
Save