Переглянути джерело

cmXScore.c : Added 'silent' note dynamic category. Fixed bug in cmXScoreReorder() where last measure was not processed.

master
kevin 8 роки тому
джерело
коміт
1da843a380
1 змінених файлів з 37 додано та 29 видалено
  1. 37
    29
      app/cmXScore.c

+ 37
- 29
app/cmXScore.c Переглянути файл

@@ -76,7 +76,6 @@ typedef struct cmXsNote_str
76 76
   unsigned                    uid;      // unique id of this note record
77 77
   unsigned                    flags;    // See k???XsFl
78 78
   unsigned                    pitch;    // midi pitch
79
-  unsigned                    velocity; // midi velocity
80 79
   unsigned                    dynamics; // dynamic level 1=pppp 9=fff
81 80
   unsigned                    vel;      // score specified MIDI velocity 
82 81
   cmChar_t                    step;     // A-G
@@ -1931,30 +1930,31 @@ typedef struct _cmXScoreDynMark_str
1931 1930
 
1932 1931
 _cmXScoreDynMark_t _cmXScoreDynMarkArray[] =
1933 1932
 {
1934
-  {"pppp-", 1,  1, -1,   3},
1935
-  {"pppp",  2,  1,  0,  10},
1936
-  {"pppp+", 3,  1,  1,  22},
1937
-  {"ppp-",  3,  2, -1,  22},
1938
-  {"ppp",   4,  2,  0,  29},
1939
-  {"ppp+",  5,  2,  1,  36},
1940
-  {"pp-",   5,  3, -1,  36},
1941
-  {"pp",    6,  3,  0,  43},
1942
-  {"pp+",   7,  3,  1,  50},
1943
-  {"p-",    7,  4, -1,  50},
1944
-  {"p",     8,  4,  0,  57},
1945
-  {"p+",    9,  4,  1,  64},
1946
-  {"mp-",   9,  5, -1,  64},
1947
-  {"mp",   10,  5,  0,  71},
1948
-  {"mp+",  11,  5,  1,  78},
1949
-  {"mf-",  11,  6, -1,  78},
1950
-  {"mf",   12,  6,  0,  85},
1951
-  {"mf+",  13,  6,  1,  92},
1952
-  {"f-",   13,  7, -1,  92},
1953
-  {"f",    14,  7,  0,  99},
1954
-  {"f+",   15,  7,  1, 106}, 
1955
-  {"ff",   16,  8,  0, 113},
1956
-  {"ff+",  17,  8,  1, 120},
1957
-  {"fff",  18,  9,  0, 127},
1933
+  {"s",     1,  0,  0,   1}, // silent note
1934
+  {"pppp-", 2,  1, -1,   3},
1935
+  {"pppp",  3,  1,  0,  10},
1936
+  {"pppp+", 4,  1,  1,  22},
1937
+  {"ppp-",  4,  2, -1,  22},
1938
+  {"ppp",   5,  2,  0,  29},
1939
+  {"ppp+",  6,  2,  1,  36},
1940
+  {"pp-",   6,  3, -1,  36},
1941
+  {"pp",    7,  3,  0,  43},
1942
+  {"pp+",   8,  3,  1,  50},
1943
+  {"p-",    8,  4, -1,  50},
1944
+  {"p",     9,  4,  0,  57},
1945
+  {"p+",   10,  4,  1,  64},
1946
+  {"mp-",  10,  5, -1,  64},
1947
+  {"mp",   11,  5,  0,  71},
1948
+  {"mp+",  12,  5,  1,  78},
1949
+  {"mf-",  12,  6, -1,  78},
1950
+  {"mf",   13,  6,  0,  85},
1951
+  {"mf+",  14,  6,  1,  92},
1952
+  {"f-",   14,  7, -1,  92},
1953
+  {"f",    15,  7,  0,  99},
1954
+  {"f+",   16,  7,  1, 106}, 
1955
+  {"ff",   17,  8,  0, 113},
1956
+  {"ff+",  18,  8,  1, 120},
1957
+  {"fff",  19,  9,  0, 127},
1958 1958
   {NULL,0,0,0,0}
1959 1959
   
1960 1960
 };
@@ -2139,6 +2139,7 @@ cmXsRC_t _cmXScoreReorderParseDyn(cmXScore_t* p, const cmChar_t* b, unsigned lin
2139 2139
   {
2140 2140
     switch(s[i])
2141 2141
     {
2142
+      case 's':
2142 2143
       case 'm':
2143 2144
       case 'p':
2144 2145
       case 'f':
@@ -2478,6 +2479,12 @@ cmXsRC_t cmXScoreReorder( cmXsH_t h, const cmChar_t* fn )
2478 2479
 
2479 2480
   }
2480 2481
 
2482
+  // If reorder records remain to be processed
2483
+  if( ri > 0 )
2484
+    if((rc =  _cmXScoreReorderMeas(p, measNumb, rV, ri )) != kOkXsRC )
2485
+      goto errLabel;
2486
+    
2487
+  
2481 2488
   // the ticks may have changed so the 'secs' and 'dsecs' must be updated
2482 2489
   _cmXScoreSetAbsoluteTime( p );
2483 2490
 
@@ -3064,12 +3071,13 @@ cmXsRC_t _cmXsWriteMidiFile( cmCtx_t* ctx, cmXsH_t h, const cmChar_t* dir, const
3064 3071
         switch( np->flags & (kOnsetXsFl|kMetronomeXsFl|kDampDnXsFl|kDampUpDnXsFl|kSostDnXsFl) )
3065 3072
         {
3066 3073
           case kOnsetXsFl:
3067
-            if( cmMidiFileInsertTrackChMsg(mfH, 1, np->tick,                kNoteOnMdId,  np->pitch, np->vel ) != kOkMfRC
3068
-              ||cmMidiFileInsertTrackChMsg(mfH, 1, np->tick + np->duration, kNoteOffMdId, np->pitch, 0 ) != kOkMfRC )
3069 3074
             {
3070
-              rc = kMidiFailXsRC;
3075
+              if( cmMidiFileInsertTrackChMsg(mfH, 1, np->tick,                kNoteOnMdId,  np->pitch, np->vel ) != kOkMfRC
3076
+                ||cmMidiFileInsertTrackChMsg(mfH, 1, np->tick + np->duration, kNoteOffMdId, np->pitch, 0 )       != kOkMfRC )
3077
+              {
3078
+                rc = kMidiFailXsRC;
3079
+              }
3071 3080
             }
3072
-
3073 3081
             break;
3074 3082
             
3075 3083
           case kDampDnXsFl:

Завантаження…
Відмінити
Зберегти