Browse Source

cmScore.h/c : Added csvEventId to hold the CSV file 'evt' column value.

master
kevin 8 years ago
parent
commit
63fff58dd8
2 changed files with 11 additions and 5 deletions
  1. 10
    5
      app/cmScore.c
  2. 1
    0
      app/cmScore.h

+ 10
- 5
app/cmScore.c View File

31
 
31
 
32
 enum
32
 enum
33
 {
33
 {
34
-  kMidiFileIdColScIdx= 0,  
34
+  kMidiFileIdColScIdx= 0,
35
+  kEventIdColScIdx   = 2,
35
   kTypeLabelColScIdx = 3,
36
   kTypeLabelColScIdx = 3,
36
   kDSecsColScIdx     = 4,
37
   kDSecsColScIdx     = 4,
37
   kSecsColScIdx      = 5,
38
   kSecsColScIdx      = 5,
723
   const cmChar_t* attr;
724
   const cmChar_t* attr;
724
   double          secs;
725
   double          secs;
725
   double          durSecs;
726
   double          durSecs;
727
+  unsigned        eventId;
726
   const cmCsvCell_t* cell;
728
   const cmCsvCell_t* cell;
727
 
729
 
728
   s += scoreIdx;
730
   s += scoreIdx;
729
 
731
 
732
+  eventId = cmCsvCellUInt(p->cH,rowIdx,kEventIdColScIdx);  
733
+
730
   // verify the scientific pitch cell was formatted correcly  
734
   // verify the scientific pitch cell was formatted correcly  
731
   if((cell = cmCsvCellPtr(p->cH,rowIdx,kPitchColScIdx)) == NULL || cell->lexTId != p->sciPitchLexTId )
735
   if((cell = cmCsvCellPtr(p->cH,rowIdx,kPitchColScIdx)) == NULL || cell->lexTId != p->sciPitchLexTId )
732
     return cmErrMsg(&p->err,kSyntaxErrScRC,"Pitch column format error.");
736
     return cmErrMsg(&p->err,kSyntaxErrScRC,"Pitch column format error.");
736
           
740
           
737
   if((midiPitch = cmSciPitchToMidi(sciPitch)) == kInvalidMidiPitch)
741
   if((midiPitch = cmSciPitchToMidi(sciPitch)) == kInvalidMidiPitch)
738
     return cmErrMsg(&p->err,kSyntaxErrScRC,"Unable to convert the scientific pitch '%s' to a MIDI value. ");
742
     return cmErrMsg(&p->err,kSyntaxErrScRC,"Unable to convert the scientific pitch '%s' to a MIDI value. ");
739
-
743
+  
740
   // get the sec's field - or DBL_MAX if it is not set
744
   // get the sec's field - or DBL_MAX if it is not set
741
   if((secs =  cmCsvCellDouble(p->cH, rowIdx, kSecsColScIdx )) == DBL_MAX) // Returns DBL_MAX on error.
745
   if((secs =  cmCsvCellDouble(p->cH, rowIdx, kSecsColScIdx )) == DBL_MAX) // Returns DBL_MAX on error.
742
     flags += kInvalidScFl;
746
     flags += kInvalidScFl;
812
   s->barNoteIdx = barNoteIdx;
816
   s->barNoteIdx = barNoteIdx;
813
   s->durSecs    = durSecs;
817
   s->durSecs    = durSecs;
814
   s->csvRowNumb = rowIdx+1;
818
   s->csvRowNumb = rowIdx+1;
819
+  s->csvEventId = eventId;
815
   return rc;
820
   return rc;
816
 }
821
 }
817
 
822
 
2451
 
2456
 
2452
   for(i=1; titles[i]!=NULL; ++i)
2457
   for(i=1; titles[i]!=NULL; ++i)
2453
   {
2458
   {
2454
-    if( cmCsvInsertTextColAfter(csvH, cp, &cp, titles[i], lexTId ) != kOkCsvRC )
2459
+    if( cmCsvInsertIdentColAfter(csvH, cp, &cp, titles[i], lexTId ) != kOkCsvRC )
2455
     {
2460
     {
2456
       cmErrMsg(&err,kCsvFailScRC,"Error inserting column index '%i' label in '%s'.",i,cmStringNullGuard(scoreFn));
2461
       cmErrMsg(&err,kCsvFailScRC,"Error inserting column index '%i' label in '%s'.",i,cmStringNullGuard(scoreFn));
2457
       goto errLabel;
2462
       goto errLabel;
2521
       goto errLabel;
2526
       goto errLabel;
2522
     }
2527
     }
2523
 
2528
 
2524
-    if( cmCsvInsertTextColAfter(csvH, cp, &cp, opStr, lexTId ) != kOkCsvRC )
2529
+    if( cmCsvInsertQTextColAfter(csvH, cp, &cp, opStr, lexTId ) != kOkCsvRC )
2525
     {
2530
     {
2526
       cmErrMsg(&err,kCsvFailScRC,"Error inserting 'opcode' column in '%s'.",cmStringNullGuard(scoreFn));
2531
       cmErrMsg(&err,kCsvFailScRC,"Error inserting 'opcode' column in '%s'.",cmStringNullGuard(scoreFn));
2527
       goto errLabel;
2532
       goto errLabel;
2572
     switch( tmp->status )
2577
     switch( tmp->status )
2573
     {
2578
     {
2574
       case kNoteOnMdId:
2579
       case kNoteOnMdId:
2575
-        if( cmCsvInsertTextColAfter(csvH, cp, &cp, cmMidiToSciPitch(tmp->u.chMsgPtr->d0,NULL,0), lexTId ) != kOkCsvRC )
2580
+        if( cmCsvInsertQTextColAfter(csvH, cp, &cp, cmMidiToSciPitch(tmp->u.chMsgPtr->d0,NULL,0), lexTId ) != kOkCsvRC )
2576
         {
2581
         {
2577
           cmErrMsg(&err,kCsvFailScRC,"Error inserting 'opcode' column in '%s'.",cmStringNullGuard(scoreFn));
2582
           cmErrMsg(&err,kCsvFailScRC,"Error inserting 'opcode' column in '%s'.",cmStringNullGuard(scoreFn));
2578
           goto errLabel;
2583
           goto errLabel;

+ 1
- 0
app/cmScore.h View File

96
     unsigned     perfVel;      // Velocity of the performed note or 0 if the note was not performed.
96
     unsigned     perfVel;      // Velocity of the performed note or 0 if the note was not performed.
97
     unsigned     perfDynLvl;   // Index into dynamic level ref. array assoc'd with perfVel  
97
     unsigned     perfDynLvl;   // Index into dynamic level ref. array assoc'd with perfVel  
98
     unsigned     line;         // Line number of this event in the score file.
98
     unsigned     line;         // Line number of this event in the score file.
99
+    unsigned     csvEventId;   // EventId from CSV 'evt' column.
99
   } cmScoreEvt_t;
100
   } cmScoreEvt_t;
100
 
101
 
101
   // A 'set' is a collection of events that are grouped in time and all marked with a given attribute.
102
   // A 'set' is a collection of events that are grouped in time and all marked with a given attribute.

Loading…
Cancel
Save