7 Commits

Author SHA1 Message Date
  kevin 99c7c96c3d cmDspPgmKrTimeLineLite.c : Initial changes to support Spirio. 3 years ago
  kevin a5b38e78af cmDspPgm.c : Changed _cmDspSysPgm_Stereo_Through() to support Focusrite interface. 3 years ago
  kevin c79d67c7bf cmXScore.c : Added _cmXScoreValidateDynamicForks() and _cmXScoreAssignGraceGroupId(). 3 years ago
  kevin e29b975677 cmXml.c : Allow attributes to be wrapped in single or double quotes. 3 years ago
  kevin 75067f1304 cmVectOpstemplateCode.h : Fix possibly uninitialized value in GaussCovariance(). 3 years ago
  kevin a4e3c2e550 cmDspBuiltIn.c : Changed _cmDspMidOutRecv() to not sleep between all-note-off transmissions 3 years ago
  kevin bfcb91b276 Fix LICENSE text. 3 years ago
7 changed files with 192 additions and 242 deletions
  1. 3
    3
      LICENSE
  2. 144
    219
      src/app/cmXScore.c
  3. 8
    5
      src/cmXml.c
  4. 4
    1
      src/dsp/cmDspBuiltIn.c
  5. 2
    2
      src/dsp/cmDspPgm.c
  6. 30
    11
      src/dsp/cmDspPgmKrTimeLineLite.c
  7. 1
    1
      src/vop/cmVectOpsTemplateCode.h

+ 3
- 3
LICENSE View File

@@ -1,7 +1,7 @@
1 1
 This library is free software: you can redistribute it and/or modify
2 2
 it under the terms of the GNU General Public License as published by
3
-the Free Software Foundation, either version 3 of the License, or (at
4
-your option) any later version.
3
+the Free Software Foundation, either version 3 of the License, or
4
+any later version.
5 5
 
6 6
 This library is distributed in the hope that it will be useful, but
7 7
 WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -9,4 +9,4 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
9 9
 General Public License for more details.
10 10
 
11 11
 You should have received a copy of the GNU General Public License
12
-along with this program.  If not, see <https://www.gnu.org/licenses/>.
12
+along with this library.  If not, see <https://www.gnu.org/licenses/>.

+ 144
- 219
src/app/cmXScore.c View File

@@ -569,41 +569,41 @@ cmXsRC_t  _cmXScoreParseColor( cmXScore_t* p, const cmXmlNode_t* nnp, cmXsNote_t
569 569
 
570 570
   map_t mapV[] =
571 571
   {
572
-    { kEvenXsFl,                                       "#0000FF" },  // blue (even)
573
-    { kEvenXsFl  | kEvenEndXsFl,                       "#0000FE" },  // blue (even end)
574
-    { kEvenXsFl  | kEvenEndXsFl,                       "#0000FD" },  // blue (even end)
575
-    { kTempoXsFl,                                      "#00FF00" },  // green (tempo)
576
-    { kTempoXsFl | kTempoEndXsFl,                      "#00FE00" },  // green (tempo end)
577
-    { kDynXsFl,                                        "#FF0000" },  // red   (dynamics)
578
-    { kDynXsFl   | kDynEndXsFl,                        "#FE0000" },  // red   (dynamics end)
579
-    { kDynXsFl   | kDynEndXsFl,                        "#FD0000" },  // red   (dynamics end)
580
-    { kTempoXsFl | kEvenXsFl,                          "#00FFFF" },  // green + blue (turquoise)
581
-    { kTempoXsFl | kEvenXsFl | kEvenEndXsFl,           "#00FFFE" },  // green + blue (turquoise) (end)    
582
-    { kDynXsFl   | kEvenXsFl,                          "#FF00FF" },  // red   + blue
583
-    { kDynXsFl   | kEvenXsFl | kEvenEndXsFl,           "#FF00FE" },  // red   + blue (end)
584
-    { kDynXsFl   | kEvenXsFl | kEvenEndXsFl,           "#FF00FD" },  // red   + blue (end)    
585
-    { kDynXsFl   | kEvenXsFl,                          "#FF0CF7" },  // magenta (even+dyn)
586
-    { kDynXsFl   | kTempoXsFl,                         "#FF7F00" },  // red   + green (brown)
587
-    { kDynXsFl   | kTempoXsFl,                         "#FE7F00" },  // red   + green (brown)    (end)
588
-    { kDynXsFl   | kTempoXsFl,                         "#FD7F00" },  // red   + green (brown)    (end)
589
-    { kDynXsFl   | kTempoXsFl | kTempoEndXsFl,         "#FF7E00" },  //
590
-    { kDynXsFl   | kDynEndXsFl | kEvenXsFl | kEvenEndXsFl, "#FE00FE" }, //
591
-    { kDynXsFl   | kDynEndXsFl | kEvenXsFl,            "#FE00FF" },
592
-    { kTempoXsFl | kEvenXsFl | kDynXsFl,               "#996633" },  // (purple)
593
-    { kTempoXsFl | kEvenXsFl | kDynXsFl | kDynEndXsFl, "#996632" },  // (purple)
594
-    { kDynXsFl,                                        "#FF6A03" },  //   176 orange  (dynamics)
595
-    { kEvenXsFl,                                       "#2F00E8" },  //  1001 blue (even)
596
-    { kTempoXsFl,                                      "#01CD1F" },  //  1196 green   (tempo)
597
-    { kEvenXsFl,                                       "#3600E8" },  //  1627 blue (even)
598
-    { kDynXsFl | kTempoXsFl,                           "#9E8F15" },  //  8827 brown (dyn + tempo)
599
-    { kEvenXsFl,                                       "#2E00E6" },  //  5393 blue (even)
600
-    { kEvenXsFl,                                       "#2C00DD" },  //  5895 blue (even)
601
-    { kDynXsFl,                                        "#FF5B03" },  //  6498 orange (dyn)
602
-    { kDynXsFl,                                        "#FF6104" },  //  6896 orange
603
-    { kEvenXsFl,                                       "#2A00E6" },  //  7781 blue
604
-    { kEvenXsFl,                                       "#2300DD" },  //  8300 blue (even)
605
-    { kTempoXsFl,                                      "#03CD22" },  // 10820 green (tempo)
606
-    { kEvenXsFl,                                       "#3400DB" },  // 11627 blue (dyn)
572
+    { kEvenXsFl,                                       "#FF0000FF" },  // blue (even)
573
+    { kEvenXsFl  | kEvenEndXsFl,                       "#FF0000FE" },  // blue (even end)
574
+    { kEvenXsFl  | kEvenEndXsFl,                       "#FF0000FD" },  // blue (even end)
575
+    { kTempoXsFl,                                      "#FF00FF00" },  // green (tempo)
576
+    { kTempoXsFl | kTempoEndXsFl,                      "#FF00FE00" },  // green (tempo end)
577
+    { kDynXsFl,                                        "#FFFF0000" },  // red   (dynamics)
578
+    { kDynXsFl   | kDynEndXsFl,                        "#FFFE0000" },  // red   (dynamics end)
579
+    { kDynXsFl   | kDynEndXsFl,                        "#FFFD0000" },  // red   (dynamics end)
580
+    { kTempoXsFl | kEvenXsFl,                          "#FF00FFFF" },  // green + blue (turquoise)
581
+    { kTempoXsFl | kEvenXsFl | kEvenEndXsFl,           "#FF00FFFE" },  // green + blue (turquoise) (end)    
582
+    { kDynXsFl   | kEvenXsFl,                          "#FFFF00FF" },  // red   + blue
583
+    { kDynXsFl   | kEvenXsFl | kEvenEndXsFl,           "#FFFF00FE" },  // red   + blue (end)
584
+    { kDynXsFl   | kEvenXsFl | kEvenEndXsFl,           "#FFFF00FD" },  // red   + blue (end)    
585
+    { kDynXsFl   | kEvenXsFl,                          "#FFFF0CF7" },  // magenta (even+dyn)
586
+    { kDynXsFl   | kTempoXsFl,                         "#FFFF7F00" },  // red   + green (brown)
587
+    { kDynXsFl   | kTempoXsFl,                         "#FFFE7F00" },  // red   + green (brown)    (end)
588
+    { kDynXsFl   | kTempoXsFl,                         "#FFFD7F00" },  // red   + green (brown)    (end)
589
+    { kDynXsFl   | kTempoXsFl | kTempoEndXsFl,         "#FFFF7E00" },  //
590
+    { kDynXsFl   | kDynEndXsFl | kEvenXsFl | kEvenEndXsFl, "#FFFE00FE" }, //
591
+    { kDynXsFl   | kDynEndXsFl | kEvenXsFl,            "#FFFE00FF" },
592
+    { kTempoXsFl | kEvenXsFl | kDynXsFl,               "#FF996633" },  // (purple)
593
+    { kTempoXsFl | kEvenXsFl | kDynXsFl | kDynEndXsFl, "#FF996632" },  // (purple)
594
+    { kDynXsFl,                                        "#FFFF6A03" },  //   176 orange  (dynamics)
595
+    { kEvenXsFl,                                       "#FF2F00E8" },  //  1001 blue (even)
596
+    { kTempoXsFl,                                      "#FF01CD1F" },  //  1196 green   (tempo)
597
+    { kEvenXsFl,                                       "#FF3600E8" },  //  1627 blue (even)
598
+    { kDynXsFl | kTempoXsFl,                           "#FF9E8F15" },  //  8827 brown (dyn + tempo)
599
+    { kEvenXsFl,                                       "#FF2E00E6" },  //  5393 blue (even)
600
+    { kEvenXsFl,                                       "#FF2C00DD" },  //  5895 blue (even)
601
+    { kDynXsFl,                                        "#FFFF5B03" },  //  6498 orange (dyn)
602
+    { kDynXsFl,                                        "#FFFF6104" },  //  6896 orange
603
+    { kEvenXsFl,                                       "#FF2A00E6" },  //  7781 blue
604
+    { kEvenXsFl,                                       "#FF2300DD" },  //  8300 blue (even)
605
+    { kTempoXsFl,                                      "#FF03CD22" },  // 10820 green (tempo)
606
+    { kEvenXsFl,                                       "#FF3400DB" },  // 11627 blue (dyn)
607 607
     { -1, "" }
608 608
   };
609 609
 
@@ -792,12 +792,14 @@ cmXsRC_t  _cmXScoreParseDirection(cmXScore_t* p, cmXsMeas_t* meas, const cmXmlNo
792 792
   {
793 793
 
794 794
     if( cmXmlNodeUInt(np,&duration,"per-minute",NULL) != kOkXmlRC )
795
-      return cmErrMsg(&p->err,kSyntaxErrorXsRC,"The 'per-minute' metronome value is missing on line %i.",np->line);
796
-
797
-    if((rc = _cmXScoreParseNoteRValue(p,np,"beat-unit",&rvalue)) != kOkXsRC )
798
-      return rc;
795
+      cmErrWarnMsg(&p->err,kSyntaxErrorXsRC,"The 'per-minute' metronome value is missing on line %i.",np->line);
796
+    else
797
+    {
798
+      if((rc = _cmXScoreParseNoteRValue(p,np,"beat-unit",&rvalue)) != kOkXsRC )
799
+        return rc;
799 800
 
800
-    flags = kMetronomeXsFl;
801
+      flags = kMetronomeXsFl;
802
+    }
801 803
   }
802 804
   else
803 805
 
@@ -1803,17 +1805,77 @@ void _cmXScoreGraceInsertSoonAfterFirst( cmXScore_t* p, unsigned graceGroupId, c
1803 1805
   _cmXScoreGraceInsertTimeBase( p, graceGroupId,aV,aN, aV[0]->tick + aV[1]->duration ); 
1804 1806
 }
1805 1807
 
1808
+cmXsRC_t _cmXScorAssignGraceGroupId( cmXScore_t* p, unsigned* nextGraceGroupIdRef )
1809
+{
1810
+  enum { kBeforeGroupState, kInGroupState };
1811
+  
1812
+  cmXsRC_t    rc         = kOkXsRC;
1813
+  unsigned    curGroupId = 1;
1814
+  unsigned    state      = kBeforeGroupState;
1815
+  cmXsPart_t* pp         = p->partL;
1816
+    
1817
+  for(; pp!=NULL; pp=pp->link)
1818
+  {
1819
+    cmXsMeas_t* mp = pp->measL;
1820
+    for(; mp!=NULL; mp=mp->link)
1821
+    {
1822
+      cmXsNote_t* np = mp->noteL;        
1823
+      for(; np!=NULL; np=np->slink )
1824
+      {
1825
+        switch( state )
1826
+        {
1827
+          case kBeforeGroupState:
1828
+            if( cmIsFlag(np->flags,kBegGraceXsFl) )
1829
+            {
1830
+              state            = kInGroupState;
1831
+              np->graceGroupId = curGroupId;
1832
+
1833
+              printf("b: %i %i %i %s\n",curGroupId,np->meas->number,np->locIdx,cmMidiToSciPitch(np->pitch,NULL,0));
1834
+              
1835
+            }
1836
+            break;
1837
+
1838
+          case kInGroupState:
1839
+            if( np->graceGroupId > 0 )
1840
+            {
1841
+              np->graceGroupId = curGroupId;
1842
+
1843
+              printf("%s: %i %i %i %s\n",cmIsFlag(np->flags,kEndGraceXsFl ) ? "e":"g",curGroupId,np->meas->number,np->locIdx,cmMidiToSciPitch(np->pitch,NULL,0));
1844
+              
1845
+              if( cmIsFlag(np->flags,kEndGraceXsFl ) )
1846
+              {
1847
+                curGroupId+=1;
1848
+                state = kBeforeGroupState;
1849
+              }
1850
+            }
1851
+        }
1852
+      }
1853
+    }
1854
+  }
1855
+
1856
+  if( state != kBeforeGroupState )
1857
+    rc = cmErrMsg(&p->err,kSyntaxErrorXsRC,"There is a missing grace note group begin or end indicator." );
1858
+  else
1859
+    *nextGraceGroupIdRef = curGroupId;
1860
+  return rc;
1861
+}
1862
+
1806 1863
 
1807 1864
 // Adjust the locations of grace notes. Note that this must be done
1808 1865
 // after reordering so that we can be sure that the order in time of
1809 1866
 // the notes in each group has been set prior to building the
1810 1867
 // grace note groups - which must be in reverse time order.
1811
-cmXsRC_t _cmXScoreProcessGraceNotes( cmXScore_t* p, unsigned nextGraceGroupId )
1868
+cmXsRC_t _cmXScoreProcessGraceNotes( cmXScore_t* p )
1812 1869
 {
1813 1870
   cmXsRC_t rc           = kOkXsRC;
1814 1871
   unsigned graceGroupId = 1;
1815 1872
   double   graceDurSec  = 1.0/15.0;  // duration of all grace notes in seconds
1816
-
1873
+  unsigned nextGraceGroupId = 1;
1874
+  
1875
+  // Reassign the grace note group id's
1876
+  if((rc = _cmXScorAssignGraceGroupId(p,&nextGraceGroupId)) != kOkXsRC )
1877
+    return rc;
1878
+  
1817 1879
   for(; graceGroupId<nextGraceGroupId; ++graceGroupId)
1818 1880
   {
1819 1881
     cmXsNote_t* gn0p        = NULL;      // first note in the grace group
@@ -1873,7 +1935,7 @@ cmXsRC_t _cmXScoreProcessGraceNotes( cmXScore_t* p, unsigned nextGraceGroupId )
1873 1935
     // grace note groups must have at least 3 members
1874 1936
     if( gN < 3 )
1875 1937
     {
1876
-      rc = cmErrMsg(&p->err,kSyntaxErrorXsRC,"The grace note group (groupid=%i) ending in meas %i has fewer than 3 (%i) members.", gn1p->graceGroupId, gn1p->meas->number, gN );
1938
+      rc = cmErrMsg(&p->err,kSyntaxErrorXsRC,"The grace note group (groupid=%i) ending in meas %i loc:%i has fewer than 3 (%i) members.", gn1p->graceGroupId, gn1p->meas->number, gn1p->locIdx, gN );
1877 1939
       break;
1878 1940
     }
1879 1941
     
@@ -2040,12 +2102,41 @@ cmXsRC_t _cmXScoreProcessDynamicFork( cmXScore_t* p, cmXsNote_t* bnp )
2040 2102
   return kOkXsRC;
2041 2103
 }
2042 2104
 
2105
+cmXsRC_t _cmXScoreValidateDynamicForks( cmXScore_t* p )
2106
+{
2107
+  cmXsRC_t    rc = kOkXsRC;
2108
+  cmXsPart_t* pp = p->partL;
2109
+
2110
+  for(; pp!=NULL; pp=pp->link)
2111
+  {
2112
+    cmXsMeas_t* mp = pp->measL;
2113
+    for(; mp!=NULL; mp=mp->link)
2114
+      {
2115
+        cmXsNote_t* np = mp->noteL;        
2116
+        for(; np!=NULL; np=np->slink )
2117
+        {
2118
+          if( cmIsFlag(np->flags,kDynBegForkXsFl) )
2119
+            printf("Beg: %5i loc:%i\n",np->meas->number,np->locIdx);
2120
+              
2121
+          if( cmIsFlag(np->flags,kDynEndForkXsFl) )
2122
+            printf("     %5i loc::%i\n",np->meas->number,np->locIdx);
2123
+          
2124
+        }
2125
+      }
2126
+  }
2127
+  
2128
+  return rc;
2129
+  
2130
+}
2131
+
2043 2132
 
2044 2133
 cmXsRC_t _cmXScoreProcessDynamicForks( cmXScore_t* p )
2045 2134
 {
2046 2135
   cmXsRC_t    rc = kOkXsRC;
2047 2136
   cmXsPart_t* pp = p->partL;
2048 2137
 
2138
+  _cmXScoreValidateDynamicForks(p);
2139
+  
2049 2140
   for(; pp!=NULL; pp=pp->link)
2050 2141
   {
2051 2142
     cmXsMeas_t* mp = pp->measL;
@@ -2704,7 +2795,7 @@ cmXsRC_t  _cmXScoreReorderParseTick(cmXScore_t* p, const cmChar_t* b, unsigned l
2704 2795
   return rc;
2705 2796
 }
2706 2797
 
2707
-cmXsRC_t  _cmXScoreReorderParseGrace(cmXScore_t* p, const cmChar_t* b, unsigned line, char** s0, cmXsReorder_t* r, unsigned* graceGroupIdRef )
2798
+cmXsRC_t  _cmXScoreReorderParseGrace(cmXScore_t* p, const cmChar_t* b, unsigned line, char** s0, cmXsReorder_t* r )
2708 2799
 {
2709 2800
   cmXsRC_t  rc = kOkXsRC;
2710 2801
   cmChar_t* s;
@@ -2717,7 +2808,7 @@ cmXsRC_t  _cmXScoreReorderParseGrace(cmXScore_t* p, const cmChar_t* b, unsigned
2717 2808
   
2718 2809
   ++s;
2719 2810
 
2720
-  r->graceGroupId = *graceGroupIdRef;
2811
+  r->graceGroupId = 1; // mark this as belong to a grace note group
2721 2812
   
2722 2813
   while(1)
2723 2814
   {
@@ -2730,14 +2821,14 @@ cmXsRC_t  _cmXScoreReorderParseGrace(cmXScore_t* p, const cmChar_t* b, unsigned
2730 2821
       case 'n': r->graceFlags |= kNFirstGraceXsFl| kEndGraceXsFl; break;
2731 2822
       case 'g': break;
2732 2823
         
2733
-      case '1':
2734
-        r->graceGroupId += 1;
2824
+      case '1':  // TODO: what is this doing?
2825
+        r->graceGroupId += 1;  
2735 2826
         ++s;
2736 2827
         continue;
2737 2828
         
2738 2829
 
2739 2830
       case '%':
2740
-        *graceGroupIdRef += 1;
2831
+        //*graceGroupIdRef += 1;
2741 2832
         ++s;
2742 2833
         continue;
2743 2834
         
@@ -2803,7 +2894,7 @@ cmXsRC_t  _cmXScoreReorderParsePitch(cmXScore_t* p, const cmChar_t* b, unsigned
2803 2894
   return rc;  
2804 2895
 }
2805 2896
 
2806
-cmXsRC_t _cmXsReadEditFile( cmXScore_t* p, const cmChar_t* fn, unsigned* graceGroupIdPtr, cmXsReorderFile_t* rfp )
2897
+cmXsRC_t _cmXsReadEditFile( cmXScore_t* p, const cmChar_t* fn, cmXsReorderFile_t* rfp )
2807 2898
 {
2808 2899
   typedef enum { kFindMeasStId, kFindEventStId, kReadEventStId } stateId_t;
2809 2900
 
@@ -2815,8 +2906,6 @@ cmXsRC_t _cmXsReadEditFile( cmXScore_t* p, const cmChar_t* fn, unsigned* graceGr
2815 2906
   stateId_t          stateId      = kFindMeasStId;
2816 2907
   cmXsReorderMeas_t* curMeas      = NULL;
2817 2908
   
2818
-  *graceGroupIdPtr = 1;
2819
-  
2820 2909
   if( cmFileOpen(&fH,fn,kReadFileFl,p->err.rpt) != kOkFileRC )
2821 2910
   {
2822 2911
     rc = cmErrMsg(&p->err,kFileFailXsRC,"The reordering file '%s' could not be opened.",cmStringNullGuard(fn));
@@ -2887,7 +2976,7 @@ cmXsRC_t _cmXsReadEditFile( cmXScore_t* p, const cmChar_t* fn, unsigned* graceGr
2887 2976
               goto errLabel;
2888 2977
 
2889 2978
             // parse the %grace note marker
2890
-            if((rc = _cmXScoreReorderParseGrace(p, b, ln+1, &s0, r, graceGroupIdPtr)) != kOkXsRC )
2979
+            if((rc = _cmXScoreReorderParseGrace(p, b, ln+1, &s0, r)) != kOkXsRC )
2891 2980
               goto errLabel;
2892 2981
 
2893 2982
             // parse the $pitch marker
@@ -2931,12 +3020,11 @@ cmXsRC_t _cmXsReadEditFile( cmXScore_t* p, const cmChar_t* fn, unsigned* graceGr
2931 3020
 cmXsRC_t _cmXsApplyEditFile( cmXScore_t* p, const cmChar_t* fn )
2932 3021
 {
2933 3022
   cmXsRC_t           rc           = kOkXsRC;
2934
-  unsigned           graceGroupId = 1;
2935 3023
   cmXsReorderFile_t  rf;
2936 3024
   cmXsReorderMeas_t* m;
2937 3025
   memset(&rf,0,sizeof(rf));
2938 3026
   
2939
-  if((rc = _cmXsReadEditFile( p, fn, &graceGroupId, &rf )) != kOkXsRC )
3027
+  if((rc = _cmXsReadEditFile( p, fn, &rf )) != kOkXsRC )
2940 3028
     return rc;
2941 3029
 
2942 3030
   // reorder each measure
@@ -2954,7 +3042,7 @@ cmXsRC_t _cmXsApplyEditFile( cmXScore_t* p, const cmChar_t* fn )
2954 3042
   _cmXScoreSort(p);
2955 3043
 
2956 3044
   // process the grace notes.
2957
-  _cmXScoreProcessGraceNotes( p, graceGroupId );
3045
+  _cmXScoreProcessGraceNotes( p );
2958 3046
 
2959 3047
   // inserting grace notes may have left the score unsorted
2960 3048
   _cmXScoreSort(p);
@@ -2973,12 +3061,11 @@ cmXsRC_t _cmXsApplyEditFile( cmXScore_t* p, const cmChar_t* fn )
2973 3061
 cmXsRC_t _cmXsMergeEditFiles( cmXScore_t* p, unsigned measNumb0, const cmChar_t* keyEditFn, unsigned keyMeasNumb, const cmChar_t* outFn )
2974 3062
 {
2975 3063
   cmXsRC_t           rc            = kOkXsRC;
2976
-  unsigned           graceGroup1Id = 1;
2977 3064
   unsigned           measNumb1     = keyMeasNumb;
2978 3065
   cmXsReorderFile_t  rf1;
2979 3066
   memset(&rf1,0,sizeof(rf1));
2980 3067
 
2981
-  if((rc = _cmXsReadEditFile( p, keyEditFn, &graceGroup1Id, &rf1 )) != kOkXsRC )
3068
+  if((rc = _cmXsReadEditFile( p, keyEditFn, &rf1 )) != kOkXsRC )
2982 3069
     return rc;
2983 3070
 
2984 3071
   while(1)
@@ -3028,168 +3115,6 @@ cmXsRC_t _cmXsMergeEditFiles( cmXScore_t* p, unsigned measNumb0, const cmChar_t*
3028 3115
 
3029 3116
 
3030 3117
 
3031
-cmXsRC_t _cmXsApplyEditFile0( cmXScore_t* p, const cmChar_t* fn )
3032
-{
3033
-  typedef enum { kFindMeasStId, kFindEventStId, kReadEventStId } stateId_t;
3034
-
3035
-  cmXsRC_t      rc       = kOkXsRC;
3036
-  cmFileH_t     fH       = cmFileNullHandle;
3037
-  cmChar_t*     b        = NULL;
3038
-  unsigned      bN       = 0;
3039
-  unsigned      ln       = 0;
3040
-  stateId_t     stateId  = kFindMeasStId;
3041
-  unsigned      rN       = 1024;
3042
-  unsigned      ri       = 0;
3043
-  unsigned      measNumb = 0;
3044
-  unsigned      graceGroupId = 1;
3045
-  cmXsReorder_t rV[ rN ];
3046
-  
3047
-  if( cmFileOpen(&fH,fn,kReadFileFl,p->err.rpt) != kOkFileRC )
3048
-  {
3049
-    rc = cmErrMsg(&p->err,kFileFailXsRC,"The reordering file '%s' could not be opened.",cmStringNullGuard(fn));
3050
-    return rc;
3051
-  }
3052
-
3053
-  for(; cmFileGetLineAuto(fH,&b,&bN)==kOkFileRC; ++ln)
3054
-  {
3055
-    switch( stateId )
3056
-    {
3057
-      case kFindEventStId:  // scanning past labels to an event line
3058
-        {
3059
-          unsigned voice,loc;
3060
-          if( sscanf(b,"%i %i",&voice,&loc) != 2 )
3061
-            continue;
3062
-
3063
-          stateId = kReadEventStId;
3064
-        }
3065
-        // fall through
3066
-
3067
-      case kReadEventStId:
3068
-        {
3069
-          cmXsReorder_t r;
3070
-          char     pitchStr[4];
3071
-          char* s0 = NULL;
3072
-
3073
-          memset(&r,0,sizeof(r));
3074
-          
3075
-          // parse an event line
3076
-          if( sscanf(b,"%i %i %i %i %i %f",&r.idx,&r.voice,&r.locIdx,&r.tick,&r.durtn,&r.rval) == 6 )
3077
-          {
3078
-            assert( strlen(b)>=52);
3079
-            int PC = 39; // text file column where first pitch char occurs
3080
-            
3081
-            if( b[PC] == ' ')
3082
-              r.midi = kInvalidMidiPitch;
3083
-            else
3084
-            {
3085
-              pitchStr[0] = b[PC+0];
3086
-              pitchStr[1] = b[PC+1];
3087
-              pitchStr[2] = b[PC+2];              
3088
-              pitchStr[3] = 0;
3089
-              
3090
-              if( !isdigit(pitchStr[2]) )
3091
-                r.midi = kInvalidMidiPitch;
3092
-              else
3093
-              {
3094
-                if( pitchStr[1] == ' ')
3095
-                {
3096
-                  pitchStr[1] = pitchStr[2];
3097
-                  pitchStr[2] = 0;
3098
-                }
3099
-
3100
-                r.midi = cmSciPitchToMidi(pitchStr);
3101
-              }
3102
-
3103
-            }
3104
-
3105
-            
3106
-            // parse the flag edits following a '~'
3107
-            if((rc = _cmXScoreReorderParseFlags(p,b,ln+1, &s0, &r.newFlags)) != kOkXsRC )
3108
-              goto errLabel;
3109
-
3110
-            // parse the dynamic marking following a '!'
3111
-            if((rc = _cmXScoreReorderParseDyn(p,b,ln+1,&s0, &r.dynIdx, &r.newFlags, measNumb)) != kOkXsRC )
3112
-              goto errLabel;
3113
-                        
3114
-            // parse the @newtick marker
3115
-            if((rc = _cmXScoreReorderParseTick(p, b, ln+1, &s0, &r.newTick)) != kOkXsRC )
3116
-              goto errLabel;
3117
-
3118
-            // parse the %grace note marker
3119
-            if((rc = _cmXScoreReorderParseGrace(p, b, ln+1, &s0, &r, &graceGroupId)) != kOkXsRC )
3120
-              goto errLabel;
3121
-
3122
-            // parse the $pitch marker
3123
-            if((rc =  _cmXScoreReorderParsePitch(p, b, ln+1, &s0, &r.pitch )) != kOkXsRC )
3124
-              goto errLabel;
3125
-            
3126
-            // store the record
3127
-            assert( ri < rN );
3128
-
3129
-            rV[ri++] = r;
3130
-
3131
-            continue;
3132
-          }
3133
-
3134
-          // the end of the measure was encountered -
3135
-          // reorder the measure based on the cmXsReorder_t in rV[ri]
3136
-          if((rc =  _cmXScoreReorderMeas0(p, measNumb, rV, ri )) != kOkXsRC )
3137
-            goto errLabel;
3138
-
3139
-          ri = 0;
3140
-
3141
-          stateId = kFindMeasStId;
3142
-          // fall through
3143
-        }
3144
-
3145
-      case kFindMeasStId:  // scanning for a bar-line
3146
-        {
3147
-          char colon;
3148
-          if( sscanf(b,"%i %c",&measNumb,&colon) == 2 && colon == ':' )
3149
-          {
3150
-            //printf("meas: %i \n",measNumb);
3151
-            stateId = kFindEventStId;
3152
-
3153
-          }
3154
-        }
3155
-        break;
3156
-    }
3157
-
3158
-  }
3159
-
3160
-  // If reorder records remain to be processed
3161
-  if( ri > 0 )
3162
-    if((rc =  _cmXScoreReorderMeas0(p, measNumb, rV, ri )) != kOkXsRC )
3163
-      goto errLabel;
3164
-    
3165
-  
3166
-  // the ticks may have changed so the 'secs' and 'dsecs' must be updated
3167
-  _cmXScoreSetAbsoluteTime( p );
3168
-
3169
-  // the bar lines should be the first event in the measure
3170
-  _cmXScoreFixBarLines(p);
3171
-
3172
-  // resort to force the links to be correct 
3173
-  _cmXScoreSort(p);
3174
-
3175
-  // process the grace notes.
3176
-  _cmXScoreProcessGraceNotes( p, graceGroupId );
3177
-
3178
-  // inserting grace notes may have left the score unsorted
3179
-  _cmXScoreSort(p);
3180
-  
3181
-  // process the dynamic forks
3182
-  _cmXScoreProcessDynamicForks(p);
3183
-
3184
-  //_cmXScoreReport(p, NULL, true );
3185
-
3186
-
3187
- errLabel:
3188
-  cmFileClose(&fH);
3189
-  cmMemFree(b);
3190
-  return rc;
3191
-}
3192
-
3193 3118
 
3194 3119
 cmXsRC_t cmXScoreAlloc( cmCtx_t* ctx, cmXsH_t* hp )
3195 3120
 {

+ 8
- 5
src/cmXml.c View File

@@ -332,14 +332,17 @@ cmXmlRC_t  _cmXmlParseAttr( cmXml_t* p, cmChar_t endChar,  cmXmlNode_t* np )
332 332
   if((v0 = _cmXmlAdvanceToNextNonWhite(p)) == NULL )
333 333
     return _cmXmlSyntaxError(p);
334 334
 
335
+  char begChar = *p->c;
336
+  
335 337
   // the first character in the value must be a single quote
336
-  if( *p->c == '\'' )
338
+  if( begChar == '\'' || begChar == '"' )
337 339
   {
338 340
     if((v0 = _cmXmlAdvanceOne(p)) == NULL )
339 341
       return _cmXmlSyntaxError(p);
340
-    
342
+
343
+    char endStr[] = { begChar, 0 };
341 344
     // advance to the next single quote
342
-    v1 = _cmXmlAdvanceToNext(p,"'");
345
+    v1 = _cmXmlAdvanceToNext(p,endStr);
343 346
   }
344 347
   else
345 348
   {
@@ -350,7 +353,7 @@ cmXmlRC_t  _cmXmlParseAttr( cmXml_t* p, cmChar_t endChar,  cmXmlNode_t* np )
350 353
     return _cmXmlSyntaxError(p);
351 354
 
352 355
   
353
-  // advance past the ending single quote
356
+  // advance past the ending  quote
354 357
   if( *p->c != endChar )
355 358
     if( _cmXmlAdvanceOne(p) == NULL )
356 359
       return _cmXmlSyntaxError(p);
@@ -359,7 +362,7 @@ cmXmlRC_t  _cmXmlParseAttr( cmXml_t* p, cmChar_t endChar,  cmXmlNode_t* np )
359 362
   _cmXmlAttrAlloc(p, np, l0, l1-l0, v0, v1-v0 );
360 363
   
361 364
 
362
-  // p->c now points just past the ending single quote
365
+  // p->c now points just past the ending quote
363 366
   return rc;
364 367
 }
365 368
 

+ 4
- 1
src/dsp/cmDspBuiltIn.c View File

@@ -911,7 +911,10 @@ cmDspRC_t _cmDspMidiOutRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t
911 911
           {          
912 912
             cmMpDeviceSend(p->devIdx,p->portIdx,kCtlMdId+i,121,0); // reset all controllers
913 913
             cmMpDeviceSend(p->devIdx,p->portIdx,kCtlMdId+i,123,0); // turn all notes off
914
-            cmSleepMs(15);
914
+            //cmSleepMs(15);  this delay was causing audio to glitch badly
915
+            // if a delay is necessary make it shorter and only send it on channels where
916
+            // previous note-ons were issued.
917
+            
915 918
           }
916 919
       }
917 920
       break;

+ 2
- 2
src/dsp/cmDspPgm.c View File

@@ -386,8 +386,8 @@ cmDspRC_t _cmDspSysPgm_Stereo_Through( cmDspSysH_t h, void** userPtrPtr )
386 386
   cmDspInst_t* ai1p = cmDspSysAllocInst(h,"AudioIn", NULL,   1, 3 );
387 387
    
388 388
   // MOTU Traveler: Use channels 2&3 (out plugs:3&4) because 0&1 do not show up on plugs 1&2.
389
-  cmDspInst_t* ao0p = cmDspSysAllocInst(h,"AudioOut",NULL,   1, 2 );
390
-  cmDspInst_t* ao1p = cmDspSysAllocInst(h,"AudioOut",NULL,   1, 3 );
389
+  cmDspInst_t* ao0p = cmDspSysAllocInst(h,"AudioOut",NULL,   1, 0 );
390
+  cmDspInst_t* ao1p = cmDspSysAllocInst(h,"AudioOut",NULL,   1, 1 );
391 391
 
392 392
   cmDspInst_t* im0p = cmDspSysAllocInst(h,"AMeter","In 0",  0);
393 393
   cmDspInst_t* im1p = cmDspSysAllocInst(h,"AMeter","In 1", 0);

+ 30
- 11
src/dsp/cmDspPgmKrTimeLineLite.c View File

@@ -75,11 +75,15 @@ cmDspRC_t _cmDspSysPgm_TimeLineLite(cmDspSysH_t h, void** userPtrPtr )
75 75
 
76 76
   cmDspInst_t* mfp  = cmDspSysAllocInst(h,"MidiFilePlay",NULL,  0 );
77 77
   cmDspInst_t* nmp  = cmDspSysAllocInst(h,"NanoMap",     NULL,  0 );
78
-  cmDspInst_t* pic  = cmDspSysAllocInst(h,"Picadae",     NULL,  0 );
79
-  //cmDspInst_t* mop  = cmDspSysAllocInst(h,"MidiOut",     NULL,  2, "Scarlett 18i20 USB","Scarlett 18i20 USB MIDI 1");
78
+  cmDspInst_t* mdly_st = cmDspSysAllocInst(h,"MsgDelay",    NULL,  2, 1024, 500.0 );
79
+  cmDspInst_t* mdly_d0 = cmDspSysAllocInst(h,"MsgDelay",    NULL,  2, 1024, 500.0 );
80
+  cmDspInst_t* mdly_d1 = cmDspSysAllocInst(h,"MsgDelay",    NULL,  2, 1024, 500.0 );
81
+  
82
+  //cmDspInst_t* pic  = cmDspSysAllocInst(h,"Picadae",     NULL,  0 );
80 83
   cmDspInst_t* mop  = cmDspSysAllocInst(h,"MidiOut",     NULL,  2, "Fastlane","Fastlane MIDI A" );
81 84
   //cmDspInst_t* mo2p = cmDspSysAllocInst(h,"MidiOut",     NULL,  2, "picadae","picadae MIDI 1");
82
-  cmDspInst_t* mo2p = cmDspSysAllocInst(h,"MidiOut",     NULL,  2, "Fastlane","Fastlane MIDI B");
85
+  cmDspInst_t* mo2p  = cmDspSysAllocInst(h,"MidiOut",     NULL,  2, "Scarlett 18i20 USB","Scarlett 18i20 USB MIDI 1");
86
+  //cmDspInst_t* mo2p = cmDspSysAllocInst(h,"MidiOut",     NULL,  2, "Fastlane","Fastlane MIDI A");
83 87
   cmDspInst_t* sfp  = cmDspSysAllocInst(h,"ScFol",       NULL,  5, r.scFn, sfBufCnt, sfMaxWndCnt, sfMinVel, sfEnaMeasFl );
84 88
   cmDspInst_t* amp  = cmDspSysAllocInst(h,"ActiveMeas",  NULL,  1, 100 );
85 89
   cmDspInst_t* modp = cmDspSysAllocInst(h,"ScMod",       NULL,  2, r.modFn, "m1" );
@@ -102,7 +106,7 @@ cmDspRC_t _cmDspSysPgm_TimeLineLite(cmDspSysH_t h, void** userPtrPtr )
102 106
   cmDspInst_t* ao3 = cmDspSysAllocInst(h,"AudioOut",    NULL,   1, baseAudioOutCh+1 ); // 3          2
103 107
 
104 108
   cmDspSysNewPage(h,"Main");
105
-  cmDspInst_t* notesOffb= cmDspSysAllocInst(h,"Button", "notesOff",   2, kButtonDuiId, 1.0 );
109
+  //cmDspInst_t* notesOffb= cmDspSysAllocInst(h,"Button", "notesOff",   2, kButtonDuiId, 1.0 );
106 110
   cmDspInst_t* onb     = cmDspSysAllocInst(h,"Button", "start",   2, kButtonDuiId, 1.0 );
107 111
   cmDspInst_t* offb    = cmDspSysAllocInst(h,"Button", "stop",    2, kButtonDuiId, 1.0 );
108 112
   cmDspInst_t* mod_sel = cmDspSysAllocMsgList(h, NULL, "mod_sel", 1 );
@@ -135,6 +139,11 @@ cmDspRC_t _cmDspSysPgm_TimeLineLite(cmDspSysH_t h, void** userPtrPtr )
135 139
   cmDspInst_t* mi0p    = cmDspSysAllocInst(h,"AMeter","In 0",  0);
136 140
   cmDspInst_t* mi1p    = cmDspSysAllocInst(h,"AMeter","In 1",  0);
137 141
 
142
+  cmDspInst_t* msgDly    = cmDspSysAllocInst(h,"Scalar", "Delay", 5, kNumberDuiId, 1.0,   1000.0,1.0,   500.0 );  
143
+  cmDspSysInstallCb( h, msgDly, "val", mdly_st, "delay", NULL);
144
+  cmDspSysInstallCb( h, msgDly, "val", mdly_d0, "delay", NULL);
145
+  cmDspSysInstallCb( h, msgDly, "val", mdly_d1, "delay", NULL);
146
+ 
138 147
   cmDspInst_t* meas    = cmDspSysAllocInst(h,"Scalar", "Meas",    5, kNumberDuiId, 1.0,   59.0,1.0,   1.0 );  
139 148
   cmDspSysInstallCb( h, meas, "val", scp, "meas", NULL);
140 149
   cmDspSysInstallCb( h, meas, "val", tlp, "meas", NULL);
@@ -241,7 +250,7 @@ cmDspRC_t _cmDspSysPgm_TimeLineLite(cmDspSysH_t h, void** userPtrPtr )
241 250
 
242 251
   cmDspSysInstallCb(h, prePath, "out", tlp, "path", NULL );
243 252
 
244
-  cmDspSysInstallCb(h, notesOffb,  "sym",    pic, "alloff",  NULL );
253
+  //cmDspSysInstallCb(h, notesOffb,  "sym",    pic, "alloff",  NULL );
245 254
   
246 255
   // start connections
247 256
   cmDspSysInstallCb(h, onb,  "sym",    tlRt, "s-in",  NULL );
@@ -265,6 +274,9 @@ cmDspRC_t _cmDspSysPgm_TimeLineLite(cmDspSysH_t h, void** userPtrPtr )
265 274
   cmDspSysInstallCb(h, pts,  "off", modp,"cmd",   NULL );
266 275
   cmDspSysInstallCb(h, offb, "sym", mop, "reset", NULL );
267 276
   cmDspSysInstallCb(h, offb, "sym", mo2p,"reset", NULL );
277
+  cmDspSysInstallCb(h, offb, "sym", mdly_st,"clear", NULL );
278
+  cmDspSysInstallCb(h, offb, "sym", mdly_d0,"clear", NULL );
279
+  cmDspSysInstallCb(h, offb, "sym", mdly_d1,"clear", NULL );
268 280
 
269 281
 
270 282
   // time-line to MIDI file player selection
@@ -286,20 +298,27 @@ cmDspRC_t _cmDspSysPgm_TimeLineLite(cmDspSysH_t h, void** userPtrPtr )
286 298
   cmDspSysInstallCb(h, msrc,   "d1",     sfp,  "d1",    NULL );
287 299
   cmDspSysInstallCb(h, msrc,   "d1",     nmp,  "d1",    NULL );
288 300
   cmDspSysInstallCb(h, nmp,   "d1",     mop,  "d1",    NULL );
289
-  cmDspSysInstallCb(h, nmp,   "d1",     pic, "d1",    NULL );
290
-  cmDspSysInstallCb(h, pic,   "d1",     mo2p, "d1",    NULL );
301
+  //cmDspSysInstallCb(h, nmp,   "d1",     mdly_d1, "in",    NULL );  
302
+  //cmDspSysInstallCb(h, mdly_d1, "out",  mo2p, "d1",    NULL );
303
+  //cmDspSysInstallCb(h, pic,   "d1",     mo2p, "d1",    NULL );
304
+  cmDspSysInstallCb(h, nmp, "d1",  mo2p, "d1",    NULL );
291 305
 
292 306
   cmDspSysInstallCb(h, msrc,  "d0",      sfp,  "d0",   NULL );
293 307
   cmDspSysInstallCb(h, msrc,  "d0",      nmp,  "d0",   NULL );
294 308
   cmDspSysInstallCb(h, nmp,  "d0",      mop,  "d0",   NULL );
295
-  cmDspSysInstallCb(h, nmp,  "d0",      pic, "d0",   NULL );
296
-  cmDspSysInstallCb(h, pic,   "d0",     mo2p, "d0",    NULL );
309
+  //cmDspSysInstallCb(h, nmp,   "d0",     mdly_d0, "in",    NULL );  
310
+  //cmDspSysInstallCb(h, mdly_d0, "out",  mo2p, "d0",    NULL );
311
+  //cmDspSysInstallCb(h, pic,   "d0",     mo2p, "d0",    NULL );
312
+  cmDspSysInstallCb(h, nmp, "d0",  mo2p, "d0",    NULL );
297 313
 
298 314
   cmDspSysInstallCb(h, msrc,  "status",  sfp,  "status",NULL );
299 315
   cmDspSysInstallCb(h, msrc,  "status",  nmp,  "status",NULL );
300 316
   cmDspSysInstallCb(h, nmp,  "status",  mop,  "status",NULL );
301
-  cmDspSysInstallCb(h, nmp,  "status",  pic, "status",NULL );
302
-  cmDspSysInstallCb(h, pic,   "status",  mo2p, "status",    NULL );
317
+  //cmDspSysInstallCb(h, nmp,   "status", mdly_st, "in",    NULL );  
318
+  //cmDspSysInstallCb(h, mdly_st, "out",  mo2p, "status",    NULL );
319
+  cmDspSysInstallCb(h, nmp, "status",  mo2p, "status",    NULL );
320
+  
321
+  //cmDspSysInstallCb(h, pic,   "status",  mo2p, "status",    NULL );
303 322
 
304 323
 
305 324
   // score follower to recd_play,modulator and printers

+ 1
- 1
src/vop/cmVectOpsTemplateCode.h View File

@@ -414,7 +414,7 @@ void  VECT_OP_FUNC(GaussCovariance)(VECT_OP_TYPE* yM, unsigned D, const VECT_OP_
414 414
 
415 415
 void  VECT_OP_FUNC(GaussCovariance2)(VECT_OP_TYPE* yM, unsigned D, const VECT_OP_TYPE* (*srcFunc)(void* userPtr, unsigned idx), unsigned xN, void* userPtr, const VECT_OP_TYPE* uV, const unsigned* selIdxV, unsigned selKey )
416 416
 {
417
-  unsigned i,j,k = 0,n;
417
+  unsigned i,j,k = 0,n=0;
418 418
   VECT_OP_TYPE tV[ D ];
419 419
   const VECT_OP_TYPE* sp;
420 420
   

Loading…
Cancel
Save