Przeglądaj źródła

cmScore.h/c:Added score file line number to cmScoreEvt_t.

master
kpl 11 lat temu
rodzic
commit
e54b4da348
2 zmienionych plików z 16 dodań i 6 usunięć
  1. 15
    4
      app/cmScore.c
  2. 1
    2
      app/cmScore.h

+ 15
- 4
app/cmScore.c Wyświetl plik

@@ -980,6 +980,9 @@ cmScRC_t _cmScParseFile( cmSc_t* p, cmCtx_t* ctx, const cmChar_t* fn )
980 980
       break;
981 981
     }
982 982
 
983
+    // set the score file line number
984
+    p->array[j].line = i + 1;
985
+
983 986
     secs = DBL_MAX;
984 987
 
985 988
     switch(tid)
@@ -1236,7 +1239,7 @@ cmScoreEvt_t* cmScoreBarEvt( cmScH_t h, unsigned barNumb )
1236 1239
   cmSc_t* p = _cmScHandleToPtr(h);
1237 1240
   unsigned i = 0;
1238 1241
   for(; i<p->cnt; ++i)
1239
-    if( p->array[i].typeId==kBarEvtScId && p->array[i].barNumb==barNumb )
1242
+    if( p->array[i].type==kBarEvtScId && p->array[i].barNumb==barNumb )
1240 1243
       return p->array + i;
1241 1244
 
1242 1245
   return NULL;
@@ -1905,18 +1908,26 @@ void cmScorePrint( cmScH_t h, cmRpt_t* rpt )
1905 1908
 {
1906 1909
   cmSc_t* p = _cmScHandleToPtr(h);
1907 1910
   unsigned i;
1908
-  for(i=0; i<20 /*p->cnt*/; ++i)
1911
+  for(i=0; i<p->cnt; ++i)
1909 1912
   {
1910 1913
     cmScoreEvt_t* r = p->array + i;
1911 1914
     switch(r->type)
1912 1915
     {
1916
+      case kBarEvtScId:
1917
+        cmRptPrintf(rpt,"%5i %5i %3i bar\n",
1918
+          i,
1919
+          r->line,
1920
+          r->barNumb );
1921
+        break;
1922
+
1913 1923
       case kNonEvtScId:
1914
-        cmRptPrintf(rpt,"%5i %3i %3i %s 0x%2x %c%c%c %s\n",
1924
+        cmRptPrintf(rpt,"%5i %5i %3i %3i %s %5s %c%c%c %s\n",
1915 1925
           i,
1926
+          r->line,
1916 1927
           r->barNumb,
1917 1928
           r->barNoteIdx,
1918 1929
           cmScEvtTypeIdToLabel(r->type),
1919
-          r->pitch,
1930
+          cmMidiToSciPitch(r->pitch,NULL,0),
1920 1931
           cmIsFlag(r->flags,kEvenScFl)  ? 'e' : ' ',
1921 1932
           cmIsFlag(r->flags,kTempoScFl) ? 't' : ' ',
1922 1933
           cmIsFlag(r->flags,kDynScFl)   ? 'd' : ' ',

+ 1
- 2
app/cmScore.h Wyświetl plik

@@ -87,6 +87,7 @@ extern "C" {
87 87
     unsigned     perfSmpIdx;   // Time this event was performed or cmInvalidIdx if the event was not performed.
88 88
     unsigned     perfVel;      // Velocity of the performed note or 0 if the note was not performed.
89 89
     unsigned     perfDynLvl;   // Index into dynamic level ref. array assoc'd with perfVel  
90
+    unsigned     line;         // Line number of this event in the score file.
90 91
   } cmScoreEvt_t;
91 92
 
92 93
   typedef struct cmScoreSet_str
@@ -175,7 +176,6 @@ extern "C" {
175 176
   // cmScMsg_t record.
176 177
   cmScRC_t      cmScoreSeqNotify( cmScH_t h );
177 178
 
178
-  /*
179 179
   void          cmScoreClearPerfInfo( cmScH_t h );
180 180
 
181 181
   // Assign 'smpIdx' and 'vel'  to the event matching 'pitch' at 'locIdx'
@@ -193,7 +193,6 @@ extern "C" {
193 193
   
194 194
   // Set the performed dynamic level of a score event.
195 195
   void          cmScoreSetPerfDynLevel( cmScH_t h, unsigned evtIdx, unsigned dynLvl );
196
-  */
197 196
   
198 197
   typedef enum
199 198
   {

Ładowanie…
Anuluj
Zapisz