Selaa lähdekoodia

Many changes to add score/performance feedback to GUI

master
kevin 11 vuotta sitten
vanhempi
commit
e9c4d0edd2
8 muutettua tiedostoa jossa 830 lisäystä ja 400 poistoa
  1. 540
    336
      app/cmScore.c
  2. 82
    20
      app/cmScore.h
  3. 44
    3
      cmGrPlot.c
  4. 1
    0
      cmGrPlot.h
  5. 2
    5
      dsp/cmDspClass.h
  6. 126
    25
      dsp/cmDspKr.c
  7. 24
    9
      dsp/cmDspPgmKr.c
  8. 11
    2
      dsp/cmDspUi.c

+ 540
- 336
app/cmScore.c
File diff suppressed because it is too large
Näytä tiedosto


+ 82
- 20
app/cmScore.h Näytä tiedosto

11
     kCsvFailScRC,
11
     kCsvFailScRC,
12
     kSyntaxErrScRC,
12
     kSyntaxErrScRC,
13
     kInvalidIdxScRC,
13
     kInvalidIdxScRC,
14
-    kTimeLineFailScRC
14
+    kTimeLineFailScRC,
15
+    kInvalidDynRefCntScRC
15
   
16
   
16
   };
17
   };
17
 
18
 
32
     kNonEvtScId
33
     kNonEvtScId
33
   };
34
   };
34
 
35
 
36
+  // Flags used by cmScoreEvt_t.flags
35
   enum
37
   enum
36
   {
38
   {
37
     kEvenScFl    = 0x01,        // This note is marked for evenness measurement
39
     kEvenScFl    = 0x01,        // This note is marked for evenness measurement
41
     kInvalidScFl = 0x10         // This note has a calculated time
43
     kInvalidScFl = 0x10         // This note has a calculated time
42
   };
44
   };
43
 
45
 
46
+
47
+  // Id's used by cmScoreSet_t.varId and as indexes into
48
+  // cmScoreSection_t.vars[].
49
+  enum
50
+  {
51
+    kEvenVarScId,
52
+    kDynVarScId,
53
+    kTempoVarScId,
54
+    kScVarCnt
55
+  };
56
+
57
+
44
   struct cmScoreLoc_str;
58
   struct cmScoreLoc_str;
59
+  struct cmScoreSet_str;
45
 
60
 
46
   // The score can be divided into arbitrary non-overlapping sections.
61
   // The score can be divided into arbitrary non-overlapping sections.
47
   typedef struct
62
   typedef struct
48
   {
63
   {
49
-    const cmChar_t*        label;      // section label
50
-    struct cmScoreLoc_str* locPtr;     // location where this section starts
51
-    unsigned               begIndex;   // score element index where this section starts
52
-    double                 evenCoeff;  // 
53
-    double                 dynCoeff;   //
54
-    double                 tempoCeoff; //
64
+    const cmChar_t*         label;      // section label
65
+    unsigned                index;      // index of this record in the internal section array
66
+    struct cmScoreLoc_str*  locPtr;     // location where this section starts
67
+    unsigned                begEvtIndex;   // score element index where this section starts    
68
+    unsigned                setCnt;     // Count of elements in setArray[]
69
+    struct cmScoreSet_str** setArray;   // Ptrs to sets which are applied to this section.
70
+    double                  vars[ kScVarCnt ]; // Set to DBL_MAX by default.
55
   } cmScoreSection_t;
71
   } cmScoreSection_t;
56
 
72
 
57
   typedef struct
73
   typedef struct
60
     double       secs;         // Time location in seconds 
76
     double       secs;         // Time location in seconds 
61
     double       durSecs;      // Duration in seconds
77
     double       durSecs;      // Duration in seconds
62
     unsigned     index;        // Index of this event in the event array.
78
     unsigned     index;        // Index of this event in the event array.
79
+    unsigned     locIdx;       // Index of the location containing this event
63
     cmMidiByte_t pitch;        // MIDI pitch of this note
80
     cmMidiByte_t pitch;        // MIDI pitch of this note
64
     unsigned     flags;        // Attribute flags for this event
81
     unsigned     flags;        // Attribute flags for this event
65
     unsigned     dynVal;       // Dynamcis value pppp to ffff (1 to 11) for this note.
82
     unsigned     dynVal;       // Dynamcis value pppp to ffff (1 to 11) for this note.
68
     unsigned     csvRowNumb;   // File row number (not index) from which this record originated
85
     unsigned     csvRowNumb;   // File row number (not index) from which this record originated
69
     unsigned     perfSmpIdx;   // Time this event was performed or cmInvalidIdx if the event was not performed.
86
     unsigned     perfSmpIdx;   // Time this event was performed or cmInvalidIdx if the event was not performed.
70
     unsigned     perfVel;      // Velocity of the performed note or 0 if the note was not performed.
87
     unsigned     perfVel;      // Velocity of the performed note or 0 if the note was not performed.
88
+    unsigned     perfDynLvl;   // Index into dynamic level ref. array assoc'd with perfVel  
71
   } cmScoreEvt_t;
89
   } cmScoreEvt_t;
72
 
90
 
73
   typedef struct cmScoreSet_str
91
   typedef struct cmScoreSet_str
74
   {
92
   {
75
-    unsigned           typeFl;     // See kXXXScFl flags above
76
-    cmScoreEvt_t**     eleArray;   // Events that make up this set in time order
77
-    unsigned           eleCnt;     // 
78
-    cmScoreSection_t** sectArray;  // Array of pointers to sections to apply this set to
79
-    unsigned           sectCnt;    //
80
-    struct cmScoreSet_str* link;   // cmScoreLoc_t setList link
93
+    unsigned               varId;      // See kXXXVarScId flags above
94
+    cmScoreEvt_t**         eleArray;   // Events that make up this set in time order
95
+    unsigned               eleCnt;     // 
96
+    bool                   doneFl;
97
+    double                 value;
98
+    struct cmScoreSet_str* llink;      // cmScoreLoc_t setList link
81
   } cmScoreSet_t;
99
   } cmScoreSet_t;
82
   
100
   
83
 
101
 
84
   // All events which are simultaneous are collected into a single
102
   // All events which are simultaneous are collected into a single
85
   // cmScoreLoc_t record.
103
   // cmScoreLoc_t record.
86
   typedef struct cmScoreLoc_str
104
   typedef struct cmScoreLoc_str
87
-  {
105
+  {    
106
+    unsigned          index;         // index of this location record
88
     double            secs;          // Time of this location
107
     double            secs;          // Time of this location
89
     unsigned          evtCnt;        // Count of events in evtArray[].
108
     unsigned          evtCnt;        // Count of events in evtArray[].
90
     cmScoreEvt_t**    evtArray;      // Events which occur at this time.
109
     cmScoreEvt_t**    evtArray;      // Events which occur at this time.
91
     unsigned          barNumb;       // Bar number this event is contained by.                            
110
     unsigned          barNumb;       // Bar number this event is contained by.                            
92
-    cmScoreSet_t*     setList;       // Set's which end on this time location
111
+    cmScoreSet_t*     setList;       // Set's which end on this time location (linked through cmScoreSet_t.llink)
93
     cmScoreSection_t* begSectPtr;    // NULL if this location does not start a section
112
     cmScoreSection_t* begSectPtr;    // NULL if this location does not start a section
94
   } cmScoreLoc_t;
113
   } cmScoreLoc_t;
95
 
114
 
107
 
126
 
108
 
127
 
109
   // Initialize a score object from a CSV File generated from a score spreadsheet.
128
   // Initialize a score object from a CSV File generated from a score spreadsheet.
110
-  cmScRC_t      cmScoreInitialize( cmCtx_t* ctx, cmScH_t* hp, const cmChar_t* fn, cmScCb_t cbFunc, void* cbArg );
129
+  // The dynRefArray[dynRefCnt] and cbFunc(cbArg) are optional if these 
130
+  // features are not used.
131
+  // If provided the dynRefArray[] is copied into an internal array.
132
+  // The physical array passed here therefore does not need to remain valid.
133
+  cmScRC_t      cmScoreInitialize( cmCtx_t* ctx, cmScH_t* hp, const cmChar_t* fn, const unsigned* dynRefArray, unsigned dynRefCnt, cmScCb_t cbFunc, void* cbArg );
111
   cmScRC_t      cmScoreFinalize(   cmScH_t* hp );
134
   cmScRC_t      cmScoreFinalize(   cmScH_t* hp );
112
 
135
 
113
   // Filename of last successfuly loaded score file.
136
   // Filename of last successfuly loaded score file.
120
   unsigned      cmScoreEvtCount( cmScH_t h );
143
   unsigned      cmScoreEvtCount( cmScH_t h );
121
   cmScoreEvt_t* cmScoreEvt( cmScH_t h, unsigned idx );
144
   cmScoreEvt_t* cmScoreEvt( cmScH_t h, unsigned idx );
122
 
145
 
146
+  // Access section records
147
+  unsigned      cmScoreSectionCount( cmScH_t h );
148
+  cmScoreSection_t* cmScoreSection( cmScH_t h, unsigned idx );
149
+
123
   // Access the score location data
150
   // Access the score location data
124
   unsigned      cmScoreLocCount( cmScH_t h );
151
   unsigned      cmScoreLocCount( cmScH_t h );
125
   cmScoreLoc_t* cmScoreLoc( cmScH_t h, unsigned idx );
152
   cmScoreLoc_t* cmScoreLoc( cmScH_t h, unsigned idx );
132
   cmScRC_t      cmScoreSeqNotify( cmScH_t h );
159
   cmScRC_t      cmScoreSeqNotify( cmScH_t h );
133
 
160
 
134
   void          cmScoreClearPerfInfo( cmScH_t h );
161
   void          cmScoreClearPerfInfo( cmScH_t h );
135
-  void          cmScoreSetPerfEvent( cmScH_t h, unsigned locIdx, unsigned smpIdx, unsigned pitch, unsigned vel );
136
-  
162
+
163
+  // Assign 'smpIdx' and 'vel'  to the event matching 'pitch' at 'locIdx'
164
+  // but do not trigger any variable calculations. Return true if as a
165
+  // result of this call all events assigned to 'locIdx' have been received
166
+  // otherwise return false.
167
+  bool          cmScoreSetPerfEvent(  cmScH_t h, unsigned locIdx, unsigned smpIdx, unsigned pitch, unsigned vel );
168
+
169
+  // Assign 'smpIdx' and 'vel'  to the event matching 'pitch' at 'locIdx'
170
+  // but and trigger any variable calculations which may happen on, or before, 'locIdx'.
171
+  void          cmScoreExecPerfEvent( cmScH_t h, unsigned locIdx, unsigned smpIdx, unsigned pitch, unsigned vel );
172
+
173
+  // Assign 'value' to the section at, or before, 'locIdx'.
174
+  void          cmScoreSetPerfValue(  cmScH_t h, unsigned locIdx, unsigned varId, double value );
137
   
175
   
176
+  // Set the performed dynamic level of a score event.
177
+  void          cmScoreSetPerfDynLevel( cmScH_t h, unsigned evtIdx, unsigned dynLvl );
178
+
138
   typedef enum
179
   typedef enum
139
   {
180
   {
140
     kInvalidMsgScId,
181
     kInvalidMsgScId,
141
     kBeginMsgScId,
182
     kBeginMsgScId,
142
     kEventMsgScId,
183
     kEventMsgScId,
143
-    kEndMsgScId
184
+    kSectionMsgScId,
185
+    kEndMsgScId,
186
+    kVarMsgScId,
187
+    kDynMsgScId
144
   } cmScMsgTypeId_t;
188
   } cmScMsgTypeId_t;
145
 
189
 
146
   typedef struct
190
   typedef struct
147
   {
191
   {
192
+    unsigned varId;  // see kXXXVarScId from cmScoreSet_t.varId
193
+    double   value;   // value of a variable
194
+  } cmScMeas_t;
195
+
196
+  typedef struct
197
+  {
198
+    unsigned evtIdx;
199
+    unsigned dynLvl;
200
+  } cmScDyn_t;
201
+
202
+  typedef struct
203
+  {
148
     cmScMsgTypeId_t typeId;
204
     cmScMsgTypeId_t typeId;
149
-    cmScoreEvt_t    evt;    // only used when typeId == kEventMsgScId
205
+    union
206
+    {
207
+      cmScoreEvt_t     evt;      // only used when typeId == kEventMsgScId
208
+      cmScMeas_t       meas;     // only used when typeId == kVarMsgScId 
209
+      cmScoreSection_t sect;     // only used when typeId == kSectionMsgScId
210
+      cmScDyn_t        dyn;      // only used when typeId == kDynLvlMsgScId
211
+    } u;
150
   } cmScMsg_t;
212
   } cmScMsg_t;
151
 
213
 
152
   // Decode a serialized cmScMsg_t from a byte stream as passed to the 
214
   // Decode a serialized cmScMsg_t from a byte stream as passed to the 

+ 44
- 3
cmGrPlot.c Näytä tiedosto

47
   unsigned          fontSize;
47
   unsigned          fontSize;
48
   unsigned          fontStyle;
48
   unsigned          fontStyle;
49
   void*             userPtr;
49
   void*             userPtr;
50
+  unsigned          userByteCnt; // 0 if userPtr does not need to be realease on object destruction
50
   cmGrPlotCbFunc_t  cbFunc;
51
   cmGrPlotCbFunc_t  cbFunc;
51
   void*             cbArg;
52
   void*             cbArg;
52
 
53
 
102
   if( cmGrObjDestroy( op->grH, &op->grObjH ) != kOkGrRC )
103
   if( cmGrObjDestroy( op->grH, &op->grObjH ) != kOkGrRC )
103
     return cmErrMsg( &p->err, kGrFailGrPlRC, "Delete failed on the object label='%s' id=%i\n",cmStringNullGuard( op->label ), cmGrObjId(op->grObjH) );
104
     return cmErrMsg( &p->err, kGrFailGrPlRC, "Delete failed on the object label='%s' id=%i\n",cmStringNullGuard( op->label ), cmGrObjId(op->grObjH) );
104
  
105
  
106
+  if( op->userByteCnt != 0 )
107
+  {
108
+    cmMemFree(op->userPtr);
109
+    op->userByteCnt = 0;
110
+  }
111
+
105
   return kOkGrPlRC;
112
   return kOkGrPlRC;
106
 }
113
 }
107
 
114
 
424
   // expand the ext's according to the physical offsets
431
   // expand the ext's according to the physical offsets
425
   cmGrPExtExpand(&pext,op->loffs,op->toffs,op->roffs,op->boffs);
432
   cmGrPExtExpand(&pext,op->loffs,op->toffs,op->roffs,op->boffs);
426
 
433
 
434
+
427
   switch( op->typeId )
435
   switch( op->typeId )
428
   {
436
   {
429
     case kLineGrPlId:
437
     case kLineGrPlId:
430
-      cmGrDcSetColor(    dcH, _cmGrPlotColor(op,op->drawColors) );
431
-      cmGrDcDrawLine(    dcH, cmGrPExtL(&pext), cmGrPExtT(&pext), cmGrPExtR(&pext), cmGrPExtB(&pext) );
432
-      break;
438
+      //cmGrDcSetColor(    dcH, _cmGrPlotColor(op,op->drawColors) );
439
+      //cmGrDcDrawLine(    dcH, cmGrPExtL(&pext), cmGrPExtT(&pext), cmGrPExtR(&pext), cmGrPExtB(&pext) );
440
+      //break;
433
 
441
 
434
     case kStarGrPlId:
442
     case kStarGrPlId:
435
     case kCrossGrPlId:
443
     case kCrossGrPlId:
476
               cmGrDcFillRect( dcH, pext.loc.x, pext.loc.y, pext.sz.w, pext.sz.h);
484
               cmGrDcFillRect( dcH, pext.loc.x, pext.loc.y, pext.sz.w, pext.sz.h);
477
               break;
485
               break;
478
 
486
 
487
+            case kLineGrPlId:
488
+              break;
489
+
479
             default:
490
             default:
480
               { assert(0); }
491
               { assert(0); }
481
           }
492
           }
522
               cmGrDcDrawLine( dcH, cmGrPExtL(&pext),                       cmGrPExtT(&pext) + cmGrPExtH(&pext)/2, cmGrPExtR(&pext),                       cmGrPExtT(&pext) + cmGrPExtH(&pext)/2);
533
               cmGrDcDrawLine( dcH, cmGrPExtL(&pext),                       cmGrPExtT(&pext) + cmGrPExtH(&pext)/2, cmGrPExtR(&pext),                       cmGrPExtT(&pext) + cmGrPExtH(&pext)/2);
523
               break;
534
               break;
524
 
535
 
536
+            case kLineGrPlId:
537
+              cmGrDcDrawLine(    dcH, cmGrPExtL(&pext), cmGrPExtT(&pext), cmGrPExtR(&pext), cmGrPExtB(&pext) );
538
+              break;
525
 
539
 
526
             case kRectGrPlId:
540
             case kRectGrPlId:
527
             case kHLineGrPlId:
541
             case kHLineGrPlId:
884
 void            cmGrPlotObjSetUserPtr(  cmGrPlObjH_t oh, void* userPtr )
898
 void            cmGrPlotObjSetUserPtr(  cmGrPlObjH_t oh, void* userPtr )
885
 {
899
 {
886
   cmGrPlotObj_t* op = _cmGrPlObjHandleToPtr(oh);
900
   cmGrPlotObj_t* op = _cmGrPlObjHandleToPtr(oh);
901
+  if( op->userByteCnt != 0 )
902
+  {
903
+    cmMemFree(op->userPtr);
904
+    op->userByteCnt = 0;
905
+  }
906
+
887
   op->userPtr = userPtr;
907
   op->userPtr = userPtr;
888
 }
908
 }
909
+
910
+void            cmGrPlotObjAllocUser( cmGrPlObjH_t oh, const void* data, unsigned byteCnt )
911
+{
912
+  cmGrPlotObj_t* op = _cmGrPlObjHandleToPtr(oh);
913
+
914
+  if( op->userByteCnt != byteCnt )
915
+  {
916
+    if( op->userByteCnt != 0  )
917
+    {
918
+      cmMemFree(op->userPtr);
919
+      op->userByteCnt = 0;
920
+    }
921
+
922
+    op->userPtr     = cmMemAlloc(char,byteCnt);
923
+    op->userByteCnt = byteCnt;
924
+  }
925
+
926
+  memcpy(op->userPtr,data,byteCnt);
927
+  
928
+}
929
+
889
 void*           cmGrPlotObjUserPtr( cmGrPlObjH_t oh )
930
 void*           cmGrPlotObjUserPtr( cmGrPlObjH_t oh )
890
 {
931
 {
891
   cmGrPlotObj_t* op = _cmGrPlObjHandleToPtr(oh);
932
   cmGrPlotObj_t* op = _cmGrPlObjHandleToPtr(oh);

+ 1
- 0
cmGrPlot.h Näytä tiedosto

148
   unsigned          cmGrPlotObjId(            cmGrPlObjH_t oh );
148
   unsigned          cmGrPlotObjId(            cmGrPlObjH_t oh );
149
 
149
 
150
   void              cmGrPlotObjSetUserPtr(    cmGrPlObjH_t oh, void* userPtr );
150
   void              cmGrPlotObjSetUserPtr(    cmGrPlObjH_t oh, void* userPtr );
151
+  void              cmGrPlotObjAllocUser(     cmGrPlObjH_t oh, const void* data, unsigned byteCnt );
151
   void*             cmGrPlotObjUserPtr(       cmGrPlObjH_t oh );
152
   void*             cmGrPlotObjUserPtr(       cmGrPlObjH_t oh );
152
 
153
 
153
   void              cmGrPlotObjSetLabel(      cmGrPlObjH_t oh, const cmChar_t* label );
154
   void              cmGrPlotObjSetLabel(      cmGrPlObjH_t oh, const cmChar_t* label );

+ 2
- 5
dsp/cmDspClass.h Näytä tiedosto

31
     kInstMsgRcvFailDspRC,
31
     kInstMsgRcvFailDspRC,
32
     kNetSendAllocFailDspRC,
32
     kNetSendAllocFailDspRC,
33
 
33
 
34
-
35
     kClassNotFoundDspRC,
34
     kClassNotFoundDspRC,
36
     kInstNotFoundDspRC,
35
     kInstNotFoundDspRC,
37
     kDuplInstSymIdDspRC,
36
     kDuplInstSymIdDspRC,
60
 
59
 
61
     kSerializeUiMsgFailDspRC,
60
     kSerializeUiMsgFailDspRC,
62
 
61
 
63
-
64
     kSendToHostFailDspRC,
62
     kSendToHostFailDspRC,
65
     kUiEleCreateFailDspRC,
63
     kUiEleCreateFailDspRC,
66
 
64
 
75
 
73
 
76
     kInvalidPgmIdxDspRC,
74
     kInvalidPgmIdxDspRC,
77
     kPgmCfgFailDspRC
75
     kPgmCfgFailDspRC
78
-
79
   };
76
   };
80
 
77
 
81
 
78
 
287
   // Possible values for cmDspSetXXX()
284
   // Possible values for cmDspSetXXX()
288
   enum
285
   enum
289
   {
286
   {
290
-    kUpdateUiDspFl   = 0x00,  
287
+    kUpdateUiDspFl   = 0x00,  // 
291
     kNoUpdateUiDspFl = 0x01,  // don't callback the UI
288
     kNoUpdateUiDspFl = 0x01,  // don't callback the UI
292
     kNoAllocDspFl    = 0x02,  // the caller is handling memory mgmt for the incoming value don't allocate space for it internally
289
     kNoAllocDspFl    = 0x02,  // the caller is handling memory mgmt for the incoming value don't allocate space for it internally
293
     kSetDefaultDspFl = 0x04,  // set the var default value rather than the current value
290
     kSetDefaultDspFl = 0x04,  // set the var default value rather than the current value
393
   cmDspRC_t  cmDspUiButtonCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned typeDuiId, unsigned outVarId, unsigned lblVarId );
390
   cmDspRC_t  cmDspUiButtonCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned typeDuiId, unsigned outVarId, unsigned lblVarId );
394
   cmDspRC_t  cmDspUiLabelCreate(  cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned lblVarId,  unsigned alignVarId );
391
   cmDspRC_t  cmDspUiLabelCreate(  cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned lblVarId,  unsigned alignVarId );
395
   cmDspRC_t  cmDspUiTimeLineCreate(cmDspCtx_t* ctx,cmDspInst_t* inst, unsigned tlFileVarId,  unsigned audPathVarId, unsigned selVarId, unsigned cursVarId );
392
   cmDspRC_t  cmDspUiTimeLineCreate(cmDspCtx_t* ctx,cmDspInst_t* inst, unsigned tlFileVarId,  unsigned audPathVarId, unsigned selVarId, unsigned cursVarId );
396
-  cmDspRC_t  cmDspUiScoreCreate(   cmDspCtx_t* ctx,cmDspInst_t* inst, unsigned scFileVarId,  unsigned selVarId );
393
+  cmDspRC_t  cmDspUiScoreCreate(   cmDspCtx_t* ctx,cmDspInst_t* inst, unsigned scFileVarId,  unsigned selVarId, unsigned smpIdxVarId, unsigned pitchVarId, unsigned velVarId, unsigned locIdxVarIdx, unsigned evtIdxVarIdx, unsigned dynLvlVarIdx, unsigned valTypeVarIdx, unsigned valueVarIdx );
397
 
394
 
398
   cmDspRC_t  cmDspUiNewColumn(        cmDspCtx_t* ctx, unsigned colW );
395
   cmDspRC_t  cmDspUiNewColumn(        cmDspCtx_t* ctx, unsigned colW );
399
   cmDspRC_t  cmDspUiInsertHorzBorder( cmDspCtx_t* ctx );
396
   cmDspRC_t  cmDspUiInsertHorzBorder( cmDspCtx_t* ctx );

+ 126
- 25
dsp/cmDspKr.c Näytä tiedosto

21
 #include "cmDspCtx.h"
21
 #include "cmDspCtx.h"
22
 #include "cmDspClass.h"
22
 #include "cmDspClass.h"
23
 #include "cmDspUi.h"
23
 #include "cmDspUi.h"
24
+#include "cmDspSys.h"
24
 #include "cmMath.h"
25
 #include "cmMath.h"
25
 
26
 
26
 
27
 
404
 {
405
 {
405
   kFnScId,
406
   kFnScId,
406
   kSelScId,
407
   kSelScId,
407
-  kSendScId
408
+  kSendScId,
409
+  kStatusScId,
410
+  kD0ScId,
411
+  kD1ScId,
412
+  kSmpIdxScId,
413
+  kLocIdxScId,
414
+  kEvtIdxScId,
415
+  kDynScId,
416
+  kValTypeScId,
417
+  kValueScId
408
 };
418
 };
409
 
419
 
410
 cmDspClass_t _cmScoreDC;
420
 cmDspClass_t _cmScoreDC;
413
 {
423
 {
414
   cmDspInst_t inst;
424
   cmDspInst_t inst;
415
   cmScH_t     scH;
425
   cmScH_t     scH;
426
+  cmDspCtx_t* ctx;   // temporary ctx ptr used during cmScore callback in _cmDspScoreRecv()
416
 } cmDspScore_t;
427
 } cmDspScore_t;
417
 
428
 
418
 cmDspInst_t*  _cmDspScoreAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned storeSymId, unsigned instSymId, unsigned id, unsigned va_cnt, va_list vl )
429
 cmDspInst_t*  _cmDspScoreAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned storeSymId, unsigned instSymId, unsigned id, unsigned va_cnt, va_list vl )
419
 {
430
 {
420
   cmDspVarArg_t args[] =
431
   cmDspVarArg_t args[] =
421
   {
432
   {
422
-    { "fn",      kFnScId,             0, 0, kInDsvFl   | kStrzDsvFl | kReqArgDsvFl, "Score file." },
423
-    { "sel",     kSelScId,            0, 0, kInDsvFl   |  kOutDsvFl | kUIntDsvFl,   "Selected score element index."},
424
-    { "send",    kSendScId,           0, 0, kInDsvFl   | kTypeDsvMask,              "Resend last selected score element."},
433
+    { "fn",      kFnScId,     0, 0, kInDsvFl  | kStrzDsvFl | kReqArgDsvFl, "Score file." },
434
+    { "sel",     kSelScId,    0, 0, kInDsvFl  | kOutDsvFl  | kUIntDsvFl,   "Selected score element index input."},
435
+    { "send",    kSendScId,   0, 0, kInDsvFl  | kTypeDsvMask,              "Resend last selected score element."},
436
+    { "status",  kStatusScId, 0, 0, kInDsvFl  | kIntDsvFl,                 "Performed MIDI status value output" },
437
+    { "d0",      kD0ScId,     0, 0, kInDsvFl  | kUIntDsvFl,                "Performed MIDI msg data byte 0" },
438
+    { "d1",      kD1ScId,     0, 0, kInDsvFl  | kUIntDsvFl,                "Performed MIDI msg data byte 1" },
439
+    { "smpidx",  kSmpIdxScId, 0, 0, kInDsvFl  | kUIntDsvFl,                "Performed MIDi msg time tag as a sample index." }, 
440
+    { "loc",     kLocIdxScId, 0, 0, kInDsvFl  | kUIntDsvFl,                "Performance score location."},
441
+    { "evtidx",  kEvtIdxScId, 0, 0, kOutDsvFl | kUIntDsvFl,                "Performed event index of following dynamcis level."},
442
+    { "dyn",     kDynScId,    0, 0, kOutDsvFl | kUIntDsvFl,                "Dynamic level of previous event index."},
443
+    { "type",    kValTypeScId,0, 0, kOutDsvFl | kUIntDsvFl,                "Output variable type."},
444
+    { "value",   kValueScId,  0, 0, kOutDsvFl | kDoubleDsvFl,              "Output variable value."},
425
     { NULL, 0, 0, 0, 0 }
445
     { NULL, 0, 0, 0, 0 }
426
   };
446
   };
427
 
447
 
430
   cmDspSetDefaultUInt( ctx, &p->inst,  kSelScId,           0, cmInvalidId);
450
   cmDspSetDefaultUInt( ctx, &p->inst,  kSelScId,           0, cmInvalidId);
431
 
451
 
432
   // create the UI control
452
   // create the UI control
433
-  cmDspUiScoreCreate(ctx,&p->inst,kFnScId,kSelScId);
453
+  cmDspUiScoreCreate(ctx,&p->inst,kFnScId,kSelScId,kSmpIdxScId,kD0ScId,kD1ScId,kLocIdxScId,kEvtIdxScId,kDynScId,kValTypeScId,kValueScId);
434
 
454
 
435
   p->scH = cmScNullHandle;
455
   p->scH = cmScNullHandle;
436
 
456
 
448
   return rc;
468
   return rc;
449
 }
469
 }
450
 
470
 
471
+// Callback from cmScore triggered from _cmDspScoreRecv() during call to cmScoreSetPerfEvent().
472
+void _cmDspScoreCb( void* arg, const void* data, unsigned byteCnt )
473
+{
474
+  cmDspInst_t*  inst = (cmDspInst_t*)arg;
475
+  cmDspScore_t* p    = (cmDspScore_t*)inst;
476
+  cmScMsg_t m;
477
+  if( cmScoreDecode(data,byteCnt,&m) == kOkScRC )
478
+  {
479
+    switch( m.typeId )
480
+    {
481
+      case kDynMsgScId:
482
+        cmDspSetUInt( p->ctx,inst, kEvtIdxScId, m.u.dyn.evtIdx );
483
+        cmDspSetUInt( p->ctx,inst, kDynScId,    m.u.dyn.dynLvl );
484
+        break;
485
+
486
+      case kVarMsgScId:
487
+        cmDspSetUInt(  p->ctx,inst, kValTypeScId, m.u.meas.varId);
488
+        cmDspSetDouble(p->ctx,inst, kValueScId,   m.u.meas.value);
489
+        break;
490
+
491
+      default:
492
+        { assert(0); }
493
+    }
494
+  }
495
+}
451
 
496
 
452
 cmDspRC_t _cmDspScoreReset(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt )
497
 cmDspRC_t _cmDspScoreReset(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt )
453
 {
498
 {
454
-  cmDspRC_t        rc = kOkDspRC;
455
-  cmDspScore_t* p  = (cmDspScore_t*)inst;
499
+  cmDspRC_t       rc          = kOkDspRC;
500
+  cmDspScore_t*   p           = (cmDspScore_t*)inst;
501
+  const cmChar_t* tlFn        = NULL;
502
+  unsigned*       dynRefArray = NULL;
503
+  unsigned        dynRefCnt   = 0;
456
 
504
 
457
   cmDspApplyAllDefaults(ctx,inst);
505
   cmDspApplyAllDefaults(ctx,inst);
458
 
506
 
459
-  const cmChar_t* tlFn;
507
+
508
+  if( cmDspRsrcUIntArray(ctx->dspH, &dynRefCnt, &dynRefArray, "dynRef", NULL ) != kOkDspRC )
509
+  {
510
+    rc = cmErrMsg(&inst->classPtr->err, kRsrcNotFoundDspRC, "The dynamics reference array resource was not found.");
511
+    goto errLabel;
512
+  }
513
+
460
   if((tlFn =  cmDspStrcz(inst, kFnScId )) !=  NULL )
514
   if((tlFn =  cmDspStrcz(inst, kFnScId )) !=  NULL )
461
-    if( cmScoreInitialize(ctx->cmCtx, &p->scH, tlFn, NULL, NULL ) != kOkTlRC )
515
+    if( cmScoreInitialize(ctx->cmCtx, &p->scH, tlFn, dynRefArray, dynRefCnt, _cmDspScoreCb, p ) != kOkTlRC )
462
       rc = cmErrMsg(&inst->classPtr->err, kInstResetFailDspRC, "Score file open failed.");
516
       rc = cmErrMsg(&inst->classPtr->err, kInstResetFailDspRC, "Score file open failed.");
463
 
517
 
518
+ errLabel:
464
   return rc;
519
   return rc;
465
 }
520
 }
466
 
521
 
467
 cmDspRC_t _cmDspScoreRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt )
522
 cmDspRC_t _cmDspScoreRecv(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt )
468
 {
523
 {
524
+  cmDspScore_t* p  = (cmDspScore_t*)inst;
525
+
526
+  if( evt->dstVarId == kSendScId )
527
+  {
528
+    unsigned selIdx;
529
+    if((selIdx = cmDspUInt(inst,kSelScId)) != cmInvalidIdx )
530
+    {
531
+      cmDspSetUInt(ctx,inst,kSelScId, selIdx );
532
+      cmScoreClearPerfInfo(p->scH);
533
+    }
534
+    return kOkDspRC;
535
+  }
536
+
537
+  cmDspSetEvent(ctx,inst,evt);
538
+
469
   switch( evt->dstVarId )
539
   switch( evt->dstVarId )
470
   {
540
   {
471
     case kSelScId:
541
     case kSelScId:
472
-      cmDspSetEvent(ctx,inst,evt);
542
+      cmScoreClearPerfInfo(p->scH);
473
       break;
543
       break;
474
 
544
 
475
-    case kSendScId:
545
+    case kStatusScId:
546
+      //printf("st:%x\n",cmDspUInt(inst,kStatusScId));
547
+      break;
548
+
549
+    case kLocIdxScId:
476
       {
550
       {
477
-        unsigned selIdx;
478
-        if((selIdx = cmDspUInt(inst,kSelScId)) != cmInvalidIdx )
479
-          cmDspSetUInt(ctx,inst,kSelScId, selIdx );
551
+        assert( cmDspUInt(inst,kStatusScId ) == kNoteOnMdId );
552
+        p->ctx = ctx; // setup p->ctx for use in _cmDspScoreCb()
553
+
554
+        // this call may result in callbacks to _cmDspScoreCb()
555
+        cmScoreExecPerfEvent(p->scH, cmDspUInt(inst,kLocIdxScId), cmDspUInt(inst,kSmpIdxScId), cmDspUInt(inst,kD0ScId), cmDspUInt(inst,kD1ScId) );      
480
       }
556
       }
481
       break;
557
       break;
482
 
558
 
483
-    default:
484
-      {assert(0);}
485
   }
559
   }
486
 
560
 
487
   return kOkDspRC;
561
   return kOkDspRC;
619
 
693
 
620
     // convert midi msg times to absolute time in samples
694
     // convert midi msg times to absolute time in samples
621
     cmMidiFileTickToSamples(p->mfH,cmDspSampleRate(ctx),true);
695
     cmMidiFileTickToSamples(p->mfH,cmDspSampleRate(ctx),true);
696
+
622
   }
697
   }
623
   return rc;
698
   return rc;
624
 }
699
 }
716
   kD0SfId,
791
   kD0SfId,
717
   kD1SfId,
792
   kD1SfId,
718
   kSmpIdxSfId,
793
   kSmpIdxSfId,
794
+  kCmdSfId,
719
   kOutSfId
795
   kOutSfId
720
 };
796
 };
721
 
797
 
724
 typedef struct
800
 typedef struct
725
 {
801
 {
726
   cmDspInst_t inst;
802
   cmDspInst_t inst;
727
-  cmScFol*    sfp;
803
+  cmScTrk*    sfp;
728
   cmScH_t     scH;
804
   cmScH_t     scH;
805
+  unsigned    printSymId;
806
+  unsigned    quietSymId;
729
 } cmDspScFol_t;
807
 } cmDspScFol_t;
730
 
808
 
731
 cmDspInst_t*  _cmDspScFolAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned storeSymId, unsigned instSymId, unsigned id, unsigned va_cnt, va_list vl )
809
 cmDspInst_t*  _cmDspScFolAlloc(cmDspCtx_t* ctx, cmDspClass_t* classPtr, unsigned storeSymId, unsigned instSymId, unsigned id, unsigned va_cnt, va_list vl )
742
     { "d0",    kD0SfId,       0, 0, kInDsvFl | kUIntDsvFl,                    "MIDI data byte 0"},
820
     { "d0",    kD0SfId,       0, 0, kInDsvFl | kUIntDsvFl,                    "MIDI data byte 0"},
743
     { "d1",    kD1SfId,       0, 0, kInDsvFl | kUIntDsvFl,                    "MIDI data byte 1"},
821
     { "d1",    kD1SfId,       0, 0, kInDsvFl | kUIntDsvFl,                    "MIDI data byte 1"},
744
     { "smpidx",kSmpIdxSfId,   0, 0, kInDsvFl | kUIntDsvFl,                    "MIDI time tag as a sample index"},
822
     { "smpidx",kSmpIdxSfId,   0, 0, kInDsvFl | kUIntDsvFl,                    "MIDI time tag as a sample index"},
823
+    { "cmd",   kCmdSfId,      0, 0, kInDsvFl | kSymDsvFl,                     "Command input: print | quiet"},
745
     { "out",   kOutSfId,      0, 0, kOutDsvFl| kUIntDsvFl,                    "Current score index."},
824
     { "out",   kOutSfId,      0, 0, kOutDsvFl| kUIntDsvFl,                    "Current score index."},
746
     { NULL,    0,             0, 0, 0, NULL }
825
     { NULL,    0,             0, 0, 0, NULL }
747
   };
826
   };
752
     return NULL;
831
     return NULL;
753
   
832
   
754
 
833
 
755
-  p->sfp = cmScFolAlloc(ctx->cmProcCtx, NULL, 0, cmScNullHandle, 0, 0, 0, 0 );
834
+  p->sfp = cmScTrkAlloc(ctx->cmProcCtx, NULL, 0, cmScNullHandle, 0, 0, 0, 0 );
835
+  p->printSymId = cmSymTblRegisterStaticSymbol(ctx->stH,"print");
836
+  p->quietSymId = cmSymTblRegisterStaticSymbol(ctx->stH,"quiet");
756
 
837
 
757
   cmDspSetDefaultUInt( ctx, &p->inst,  kBufCntSfId,     0,     7);
838
   cmDspSetDefaultUInt( ctx, &p->inst,  kBufCntSfId,     0,     7);
758
   cmDspSetDefaultUInt( ctx, &p->inst,  kMinLkAhdSfId,   0,    10);
839
   cmDspSetDefaultUInt( ctx, &p->inst,  kMinLkAhdSfId,   0,    10);
760
   cmDspSetDefaultUInt( ctx, &p->inst,  kMinVelSfId,     0,     5);
841
   cmDspSetDefaultUInt( ctx, &p->inst,  kMinVelSfId,     0,     5);
761
   cmDspSetDefaultUInt( ctx, &p->inst,  kIndexSfId,      0,     0);  
842
   cmDspSetDefaultUInt( ctx, &p->inst,  kIndexSfId,      0,     0);  
762
   cmDspSetDefaultUInt( ctx, &p->inst,  kOutSfId,        0,     0);
843
   cmDspSetDefaultUInt( ctx, &p->inst,  kOutSfId,        0,     0);
844
+  cmDspSetDefaultSymbol(ctx,&p->inst,  kCmdSfId,         p->quietSymId );
763
 
845
 
764
   return &p->inst;
846
   return &p->inst;
765
 }
847
 }
767
 cmDspRC_t _cmDspScFolFree(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt )
849
 cmDspRC_t _cmDspScFolFree(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt )
768
 {
850
 {
769
   cmDspScFol_t* p = (cmDspScFol_t*)inst;
851
   cmDspScFol_t* p = (cmDspScFol_t*)inst;
770
-  cmScFolFree(&p->sfp);
852
+  cmScTrkFree(&p->sfp);
771
   cmScoreFinalize(&p->scH);
853
   cmScoreFinalize(&p->scH);
772
   return kOkDspRC;
854
   return kOkDspRC;
773
 }
855
 }
774
 
856
 
775
 cmDspRC_t _cmDspScFolOpenScore( cmDspCtx_t* ctx, cmDspInst_t* inst )
857
 cmDspRC_t _cmDspScFolOpenScore( cmDspCtx_t* ctx, cmDspInst_t* inst )
776
 {
858
 {
859
+  cmDspRC_t       rc          = kOkDspRC;
860
+  cmDspScFol_t*   p           = (cmDspScFol_t*)inst;
861
+  unsigned*       dynRefArray = NULL;
862
+  unsigned        dynRefCnt   = 0;
777
   const cmChar_t* fn;
863
   const cmChar_t* fn;
778
-  cmDspScFol_t* p  = (cmDspScFol_t*)inst;
779
 
864
 
780
   if((fn = cmDspStrcz(inst,kFnSfId)) == NULL || strlen(fn)==0 )
865
   if((fn = cmDspStrcz(inst,kFnSfId)) == NULL || strlen(fn)==0 )
781
     return cmErrMsg(&inst->classPtr->err, kInvalidArgDspRC, "No score file name supplied.");
866
     return cmErrMsg(&inst->classPtr->err, kInvalidArgDspRC, "No score file name supplied.");
782
 
867
 
783
-  if( cmScoreInitialize(ctx->cmCtx, &p->scH, fn, NULL, NULL ) != kOkScRC )
868
+  if( cmDspRsrcUIntArray(ctx->dspH, &dynRefCnt, &dynRefArray, "dynRef", NULL ) != kOkDspRC )
869
+  {
870
+    rc = cmErrMsg(&inst->classPtr->err, kRsrcNotFoundDspRC, "The dynamics reference array resource was not found.");
871
+    goto errLabel;
872
+  }
873
+
874
+  if( cmScoreInitialize(ctx->cmCtx, &p->scH, fn, NULL, 0, NULL, NULL ) != kOkScRC )
784
     return cmErrMsg(&inst->classPtr->err, kSubSysFailDspRC, "Unable to open the score '%s'.",fn);
875
     return cmErrMsg(&inst->classPtr->err, kSubSysFailDspRC, "Unable to open the score '%s'.",fn);
785
 
876
 
786
-  return kOkDspRC;
877
+ errLabel:
878
+  return rc;
787
 }
879
 }
788
 
880
 
789
 cmDspRC_t _cmDspScFolReset(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt )
881
 cmDspRC_t _cmDspScFolReset(cmDspCtx_t* ctx, cmDspInst_t* inst, const cmDspEvt_t* evt )
796
     return rc;
888
     return rc;
797
 
889
 
798
   if( cmScoreIsValid(p->scH) )
890
   if( cmScoreIsValid(p->scH) )
799
-    if( cmScFolInit(p->sfp, cmDspSampleRate(ctx),  p->scH, cmDspUInt(inst,kBufCntSfId), cmDspUInt(inst,kMinLkAhdSfId), cmDspUInt(inst,kMaxWndCntSfId), cmDspUInt(inst,kMinVelSfId) ) != cmOkRC )
891
+    if( cmScTrkInit(p->sfp, cmDspSampleRate(ctx),  p->scH, cmDspUInt(inst,kBufCntSfId), cmDspUInt(inst,kMinLkAhdSfId), cmDspUInt(inst,kMaxWndCntSfId), cmDspUInt(inst,kMinVelSfId) ) != cmOkRC )
800
       rc = cmErrMsg(&inst->classPtr->err, kSubSysFailDspRC, "Internal score follower allocation failed.");
892
       rc = cmErrMsg(&inst->classPtr->err, kSubSysFailDspRC, "Internal score follower allocation failed.");
801
 
893
 
802
   return rc;  
894
   return rc;  
814
     {
906
     {
815
       case kIndexSfId:
907
       case kIndexSfId:
816
         if( cmScoreIsValid(p->scH) )
908
         if( cmScoreIsValid(p->scH) )
817
-          if( cmScFolReset( p->sfp, cmDspUInt(inst,kIndexSfId) ) != cmOkRC )
909
+          if( cmScTrkReset( p->sfp, cmDspUInt(inst,kIndexSfId) ) != cmOkRC )
818
             cmErrMsg(&inst->classPtr->err, kSubSysFailDspRC, "Score follower reset to score index '%i' failed.");
910
             cmErrMsg(&inst->classPtr->err, kSubSysFailDspRC, "Score follower reset to score index '%i' failed.");
819
         break;
911
         break;
820
 
912
 
821
       case kStatusSfId:
913
       case kStatusSfId:
822
         if( cmScoreIsValid(p->scH))
914
         if( cmScoreIsValid(p->scH))
823
         {
915
         {
824
-          unsigned idx = cmScFolExec(p->sfp, ctx->cycleCnt, cmDspUInt(inst,kStatusSfId), cmDspUInt(inst,kD0SfId), cmDspUInt(inst,kD1SfId));
916
+          unsigned idx = cmScTrkExec(p->sfp, ctx->cycleCnt, cmDspUInt(inst,kStatusSfId), cmDspUInt(inst,kD0SfId), cmDspUInt(inst,kD1SfId));
825
           if( idx != cmInvalidIdx )
917
           if( idx != cmInvalidIdx )
826
             cmDspSetUInt(ctx,inst,kOutSfId,idx);
918
             cmDspSetUInt(ctx,inst,kOutSfId,idx);
827
         }
919
         }
830
       case kFnSfId:
922
       case kFnSfId:
831
         _cmDspScFolOpenScore(ctx,inst);
923
         _cmDspScFolOpenScore(ctx,inst);
832
         break;
924
         break;
925
+
926
+      case kCmdSfId:
927
+        if( cmDspSymbol(inst,kCmdSfId) == p->printSymId )
928
+          p->sfp->printFl = true;
929
+        else
930
+          if( cmDspSymbol(inst,kCmdSfId) == p->quietSymId )
931
+            p->sfp->printFl = false;
932
+
933
+        break;
833
     }
934
     }
834
   }
935
   }
835
 
936
 

+ 24
- 9
dsp/cmDspPgmKr.c Näytä tiedosto

86
   cmDspSysNewPage(h,"Controls");
86
   cmDspSysNewPage(h,"Controls");
87
   cmDspInst_t* onb  = cmDspSysAllocInst(h,"Button", "start",  2, kButtonDuiId, 1.0 );
87
   cmDspInst_t* onb  = cmDspSysAllocInst(h,"Button", "start",  2, kButtonDuiId, 1.0 );
88
   cmDspInst_t* offb = cmDspSysAllocInst(h,"Button", "stop",   2, kButtonDuiId, 1.0 );
88
   cmDspInst_t* offb = cmDspSysAllocInst(h,"Button", "stop",   2, kButtonDuiId, 1.0 );
89
+  cmDspInst_t* prtb = cmDspSysAllocInst(h,"Button", "print",  2, kButtonDuiId, 1.0 );
90
+  cmDspInst_t* qtb  = cmDspSysAllocInst(h,"Button", "quiet",  2, kButtonDuiId, 1.0 );
91
+  cmDspInst_t* prp  = cmDspSysAllocInst(h,"Printer", NULL,   1, ">" );
92
+  //cmDspInst_t* prd  = cmDspSysAllocInst(h,"Printer", NULL,   1, "DYN:" );
93
+  //cmDspInst_t* pre  = cmDspSysAllocInst(h,"Printer", NULL,   1, "EVEN:" );
89
 
94
 
90
-
91
-
92
-  cmDspInst_t* prp = cmDspSysAllocInst(h,"Printer", NULL,   1, ">" );
93
-  
94
   if((rc = cmDspSysLastRC(h)) != kOkDspRC )
95
   if((rc = cmDspSysLastRC(h)) != kOkDspRC )
95
     return rc;
96
     return rc;
96
 
97
 
125
   cmDspSysInstallCb(h, tlp, "mesi", mfp, "esi",   NULL );
126
   cmDspSysInstallCb(h, tlp, "mesi", mfp, "esi",   NULL );
126
   cmDspSysInstallCb(h, tlp, "mfn",  mfp, "fn",    NULL );
127
   cmDspSysInstallCb(h, tlp, "mfn",  mfp, "fn",    NULL );
127
 
128
 
128
-  // score to score follower
129
+  // score to score follower - to set initial search location
129
   cmDspSysInstallCb(h, scp, "sel",    sfp, "index",  NULL );
130
   cmDspSysInstallCb(h, scp, "sel",    sfp, "index",  NULL );
131
+  
130
 
132
 
131
-
132
-  // MIDI file player to score-follower
133
-  cmDspSysInstallCb(h, mfp, "status", sfp, "status", NULL );
134
-  cmDspSysInstallCb(h, mfp, "d0",     sfp, "d0",     NULL );
133
+  // MIDI file player to score-follower and score - the order of connections is the same
134
+  // as the msg transmision order from MFP
135
+  cmDspSysInstallCb(h, mfp, "smpidx", scp, "smpidx", NULL );
136
+  cmDspSysInstallCb(h, mfp, "d1",     scp, "d1",     NULL );
135
   cmDspSysInstallCb(h, mfp, "d1",     sfp, "d1",     NULL );
137
   cmDspSysInstallCb(h, mfp, "d1",     sfp, "d1",     NULL );
138
+  cmDspSysInstallCb(h, mfp, "d0",     scp, "d0",     NULL );
139
+  cmDspSysInstallCb(h, mfp, "d0",     sfp, "d0",     NULL );
140
+  cmDspSysInstallCb(h, mfp, "status", scp, "status", NULL );
141
+  cmDspSysInstallCb(h, mfp, "status", sfp, "status", NULL );
142
+
143
+
144
+  // score follower to score
145
+  cmDspSysInstallCb(h, sfp, "out",  scp, "loc", NULL );
136
 
146
 
137
 
147
 
138
   // Printer connections
148
   // Printer connections
141
   cmDspSysInstallCb(h, tlp, "sel",  prp, "in",  NULL );
151
   cmDspSysInstallCb(h, tlp, "sel",  prp, "in",  NULL );
142
   //cmDspSysInstallCb(h, sfp, "out",  prp, "in",     NULL );
152
   //cmDspSysInstallCb(h, sfp, "out",  prp, "in",     NULL );
143
 
153
 
154
+  //cmDspSysInstallCb(h, scp, "even", pre, "in", NULL );
155
+  //cmDspSysInstallCb(h, scp, "dyn",  prd, "in", NULL );
156
+
157
+  cmDspSysInstallCb(h, prtb, "sym", sfp, "cmd", NULL );
158
+  cmDspSysInstallCb(h, qtb,  "sym", sfp, "cmd", NULL );
144
 
159
 
145
   return rc;
160
   return rc;
146
 }
161
 }

+ 11
- 2
dsp/cmDspUi.c Näytä tiedosto

386
   return rc;
386
   return rc;
387
 }
387
 }
388
 
388
 
389
-cmDspRC_t  cmDspUiScoreCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned scFileVarId, unsigned selVarId )
389
+cmDspRC_t  cmDspUiScoreCreate( cmDspCtx_t* ctx, cmDspInst_t* inst, unsigned scFileVarId, unsigned selVarId, unsigned smpIdxVarId, unsigned pitchVarId, unsigned velVarId, unsigned locIdxVarId, unsigned evtIdxVarId, unsigned dynVarId, unsigned valTypeVarId, unsigned valueVarId )
390
 {
390
 {
391
   cmDspRC_t    rc;
391
   cmDspRC_t    rc;
392
-  unsigned     arr[] = { scFileVarId, selVarId  };
392
+  unsigned     arr[] = { scFileVarId, selVarId, smpIdxVarId, pitchVarId, velVarId, locIdxVarId, evtIdxVarId, dynVarId, valTypeVarId, valueVarId };
393
   cmDspValue_t v;
393
   cmDspValue_t v;
394
   unsigned     vn    = sizeof(arr)/sizeof(arr[0]);
394
   unsigned     vn    = sizeof(arr)/sizeof(arr[0]);
395
   cmDsvSetUIntMtx(&v,arr,vn,1);
395
   cmDsvSetUIntMtx(&v,arr,vn,1);
402
   // Setting this flag will cause their values to be sent to the UI whenever they change.
402
   // Setting this flag will cause their values to be sent to the UI whenever they change.
403
   cmDspInstVarSetFlags( ctx, inst, scFileVarId,  kUiDsvFl );
403
   cmDspInstVarSetFlags( ctx, inst, scFileVarId,  kUiDsvFl );
404
   cmDspInstVarSetFlags( ctx, inst, selVarId,     kUiDsvFl );
404
   cmDspInstVarSetFlags( ctx, inst, selVarId,     kUiDsvFl );
405
+  cmDspInstVarSetFlags( ctx, inst, smpIdxVarId,  kUiDsvFl );
406
+  cmDspInstVarSetFlags( ctx, inst, pitchVarId,   kUiDsvFl );
407
+  cmDspInstVarSetFlags( ctx, inst, velVarId,     kUiDsvFl );
408
+  cmDspInstVarSetFlags( ctx, inst, locIdxVarId,  kUiDsvFl );
409
+  cmDspInstVarSetFlags( ctx, inst, evtIdxVarId,  kUiDsvFl );
410
+  cmDspInstVarSetFlags( ctx, inst, dynVarId,     kUiDsvFl );
411
+  cmDspInstVarSetFlags( ctx, inst, valTypeVarId, kUiDsvFl );
412
+  cmDspInstVarSetFlags( ctx, inst, valueVarId,   kUiDsvFl );
413
+
405
   return rc;
414
   return rc;
406
 }
415
 }
407
 
416
 

Loading…
Peruuta
Tallenna