Sfoglia il codice sorgente

cmScore.h/c Major changes and additions to implement score attribute sets and score sections.

master
kevin 11 anni fa
parent
commit
d45fd52660
2 ha cambiato i file con 849 aggiunte e 85 eliminazioni
  1. 793
    63
      app/cmScore.c
  2. 56
    22
      app/cmScore.h

+ 793
- 63
app/cmScore.c
File diff soppresso perché troppo grande
Vedi File


+ 56
- 22
app/cmScore.h Vedi File

34
 
34
 
35
   enum
35
   enum
36
   {
36
   {
37
-    kEvenScFl  = 0x01,   // This note is marked for evenness measurement
38
-    kDynScFl   = 0x02,   // This note is marked for dynamics measurement
39
-    kTempoScFl = 0x03,   // This note is marked for tempo measurement
40
-    kSkipScFl  = 0x04,   // This isn't a real event (e.g. tied note) skip over it
41
-    kInvalidScFl = 0x08  // This note has a calculated time
37
+    kEvenScFl    = 0x01,        // This note is marked for evenness measurement
38
+    kDynScFl     = 0x02,        // This note is marked for dynamics measurement
39
+    kTempoScFl   = 0x04,        // This note is marked for tempo measurement
40
+    kSkipScFl    = 0x08,        // This isn't a real event (e.g. tied note) skip over it
41
+    kInvalidScFl = 0x10         // This note has a calculated time
42
   };
42
   };
43
 
43
 
44
+  struct cmScoreLoc_str;
45
+
46
+  // The score can be divided into arbitrary non-overlapping sections.
47
+  typedef struct
48
+  {
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; //
55
+  } cmScoreSection_t;
56
+
44
   typedef struct
57
   typedef struct
45
   {
58
   {
46
     unsigned     type;         // Event type
59
     unsigned     type;         // Event type
47
     double       secs;         // Time location in seconds 
60
     double       secs;         // Time location in seconds 
48
     double       durSecs;      // Duration in seconds
61
     double       durSecs;      // Duration in seconds
49
-    unsigned     index;        // index of this event
62
+    unsigned     index;        // Index of this event in the event array.
50
     cmMidiByte_t pitch;        // MIDI pitch of this note
63
     cmMidiByte_t pitch;        // MIDI pitch of this note
51
     unsigned     flags;        // Attribute flags for this event
64
     unsigned     flags;        // Attribute flags for this event
52
     unsigned     dynVal;       // Dynamcis value pppp to ffff (1 to 11) for this note.
65
     unsigned     dynVal;       // Dynamcis value pppp to ffff (1 to 11) for this note.
53
-    unsigned     barNumb;      // bar number of this event
54
-    unsigned     barNoteIdx;   // index of this note in this bar
66
+    unsigned     barNumb;      // Bar id of the measure containing this event.
67
+    unsigned     barNoteIdx;   // Index of this note in this bar
68
+    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.
70
+    unsigned     perfVel;      // Velocity of the performed note or 0 if the note was not performed.
55
   } cmScoreEvt_t;
71
   } cmScoreEvt_t;
56
 
72
 
57
-  typedef struct
73
+  typedef struct cmScoreSet_str
58
   {
74
   {
59
-    double         secs;     // Time of this location
60
-    unsigned       evtCnt;   // Count of events in evtArray[].
61
-    cmScoreEvt_t** evtArray; // Events which occur at this time.
62
-    unsigned       evtIdx;   // Index into the master event array 
63
-                             // (p->array[]) of the first event in this loc.
64
-    unsigned       barNumb;  // Bar number this event is contained by.
65
-                            
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
81
+  } cmScoreSet_t;
82
+  
83
+
84
+  // All events which are simultaneous are collected into a single
85
+  // cmScoreLoc_t record.
86
+  typedef struct cmScoreLoc_str
87
+  {
88
+    double            secs;          // Time of this location
89
+    unsigned          evtCnt;        // Count of events in evtArray[].
90
+    cmScoreEvt_t**    evtArray;      // Events which occur at this time.
91
+    unsigned          barNumb;       // Bar number this event is contained by.                            
92
+    cmScoreSet_t*     setList;       // Set's which end on this time location
93
+    cmScoreSection_t* begSectPtr;    // NULL if this location does not start a section
66
   } cmScoreLoc_t;
94
   } cmScoreLoc_t;
67
 
95
 
68
   typedef void (*cmScCb_t)( void* arg, const void* data, unsigned byteCnt );
96
   typedef void (*cmScCb_t)( void* arg, const void* data, unsigned byteCnt );
85
   // Filename of last successfuly loaded score file.
113
   // Filename of last successfuly loaded score file.
86
   const cmChar_t* cmScoreFileName( cmScH_t h );
114
   const cmChar_t* cmScoreFileName( cmScH_t h );
87
 
115
 
116
+  // Validate the score handle
88
   bool          cmScoreIsValid( cmScH_t h );
117
   bool          cmScoreIsValid( cmScH_t h );
89
 
118
 
90
   // Access the score data.
119
   // Access the score data.
94
   // Access the score location data
123
   // Access the score location data
95
   unsigned      cmScoreLocCount( cmScH_t h );
124
   unsigned      cmScoreLocCount( cmScH_t h );
96
   cmScoreLoc_t* cmScoreLoc( cmScH_t h, unsigned idx );
125
   cmScoreLoc_t* cmScoreLoc( cmScH_t h, unsigned idx );
126
+  void          cmScorePrintLoc( cmScH_t h );
97
 
127
 
98
-
128
+  // Make callbacks for all events in the score. The callbacks
129
+  // contain cmScMsg_t records serialized as a byte stream.
130
+  // Use cmScoreDecode() to convert the byte string to a
131
+  // cmScMsg_t record.
99
   cmScRC_t      cmScoreSeqNotify( cmScH_t h );
132
   cmScRC_t      cmScoreSeqNotify( cmScH_t h );
133
+
134
+  void          cmScoreClearPerfInfo( cmScH_t h );
135
+  void          cmScoreSetPerfEvent( cmScH_t h, unsigned locIdx, unsigned smpIdx, unsigned pitch, unsigned vel );
136
+  
100
   
137
   
101
   typedef enum
138
   typedef enum
102
   {
139
   {
112
     cmScoreEvt_t    evt;    // only used when typeId == kEventMsgScId
149
     cmScoreEvt_t    evt;    // only used when typeId == kEventMsgScId
113
   } cmScMsg_t;
150
   } cmScMsg_t;
114
 
151
 
152
+  // Decode a serialized cmScMsg_t from a byte stream as passed to the 
153
+  // cmScCb_t function.
115
   cmScRC_t      cmScoreDecode( const void* msg, unsigned msgByteCnt, cmScMsg_t* );
154
   cmScRC_t      cmScoreDecode( const void* msg, unsigned msgByteCnt, cmScMsg_t* );
116
 
155
 
117
   void          cmScorePrint( cmScH_t h, cmRpt_t* rpt );
156
   void          cmScorePrint( cmScH_t h, cmRpt_t* rpt );
118
 
157
 
119
-  cmScRC_t      cmScoreSyncTimeLine( cmScH_t scH, cmTlH_t tlH, unsigned editDistWndCnt, cmReal_t maxNoteOffsetSecs );
120
-
121
-  cmScRC_t      cmScoreSyncTimeLineTest( cmCtx_t* ctx,  const cmChar_t* timeLineJsFn, const cmChar_t* scoreCsvFn );
122
-
123
   void          cmScoreTest( cmCtx_t* ctx, const cmChar_t* fn );
158
   void          cmScoreTest( cmCtx_t* ctx, const cmChar_t* fn );
124
 
159
 
125
-  void          cmScoreFix( cmCtx_t* ctx );
126
 
160
 
127
 #ifdef __cplusplus
161
 #ifdef __cplusplus
128
 }
162
 }

Loading…
Annulla
Salva