Browse Source

cmScore.h/c:Added cmScoreBarEvt() and cmScoreEvtLoc().

master
kpl 11 years ago
parent
commit
a14aaf21e5
2 changed files with 36 additions and 1 deletions
  1. 27
    0
      app/cmScore.c
  2. 9
    1
      app/cmScore.h

+ 27
- 0
app/cmScore.c View File

@@ -1231,6 +1231,17 @@ cmScoreEvt_t* cmScoreEvt( cmScH_t h, unsigned idx )
1231 1231
   return p->array + idx;
1232 1232
 }
1233 1233
 
1234
+cmScoreEvt_t* cmScoreBarEvt( cmScH_t h, unsigned barNumb )
1235
+{
1236
+  cmSc_t* p = _cmScHandleToPtr(h);
1237
+  unsigned i = 0;
1238
+  for(; i<p->cnt; ++i)
1239
+    if( p->array[i].typeId==kBarEvtScId && p->array[i].barNumb==barNumb )
1240
+      return p->array + i;
1241
+
1242
+  return NULL;
1243
+}
1244
+
1234 1245
 unsigned      cmScoreSectionCount( cmScH_t h )
1235 1246
 { 
1236 1247
   cmSc_t* p = _cmScHandleToPtr(h);
@@ -1262,6 +1273,22 @@ cmScoreLoc_t* cmScoreLoc( cmScH_t h, unsigned idx )
1262 1273
   return p->loc + idx;
1263 1274
 }
1264 1275
 
1276
+cmScoreLoc_t* cmScoreEvtLoc( cmScH_t h, const cmScoreEvt_t* evt )
1277
+{
1278
+  cmSc_t* p = _cmScHandleToPtr(h);
1279
+  unsigned i;
1280
+  if( evt != NULL )
1281
+    for(i=0; i<p->locCnt; ++i)
1282
+    {
1283
+      unsigned j;
1284
+      for(j=0; j<p->loc[i].evtCnt; ++j)
1285
+        if( p->loc[i].evtArray[j] == evt )
1286
+          return p->loc + i;
1287
+    }
1288
+  return NULL;
1289
+}
1290
+
1291
+
1265 1292
 
1266 1293
 void cmScorePrintLoc( cmScH_t h )
1267 1294
 {

+ 9
- 1
app/cmScore.h View File

@@ -151,6 +151,9 @@ extern "C" {
151 151
   unsigned      cmScoreEvtCount( cmScH_t h );
152 152
   cmScoreEvt_t* cmScoreEvt( cmScH_t h, unsigned idx );
153 153
 
154
+  // Given a bar number return the associated 'bar' event record.
155
+  cmScoreEvt_t* cmScoreBarEvt( cmScH_t h, unsigned barNumb );
156
+
154 157
   // Access section records
155 158
   unsigned      cmScoreSectionCount( cmScH_t h );
156 159
   cmScoreSection_t* cmScoreSection( cmScH_t h, unsigned idx );
@@ -160,6 +163,9 @@ extern "C" {
160 163
   cmScoreLoc_t* cmScoreLoc( cmScH_t h, unsigned idx );
161 164
   void          cmScorePrintLoc( cmScH_t h );
162 165
 
166
+  // Return the location associated with a given score event.
167
+  cmScoreLoc_t* cmScoreEvtLoc( cmScH_t h, const cmScoreEvt_t* evt );
168
+
163 169
   // Return the count of sets.
164 170
   unsigned      cmScoreSetCount( cmScH_t h );
165 171
 
@@ -169,6 +175,7 @@ extern "C" {
169 175
   // cmScMsg_t record.
170 176
   cmScRC_t      cmScoreSeqNotify( cmScH_t h );
171 177
 
178
+  /*
172 179
   void          cmScoreClearPerfInfo( cmScH_t h );
173 180
 
174 181
   // Assign 'smpIdx' and 'vel'  to the event matching 'pitch' at 'locIdx'
@@ -186,7 +193,8 @@ extern "C" {
186 193
   
187 194
   // Set the performed dynamic level of a score event.
188 195
   void          cmScoreSetPerfDynLevel( cmScH_t h, unsigned evtIdx, unsigned dynLvl );
189
-
196
+  */
197
+  
190 198
   typedef enum
191 199
   {
192 200
     kInvalidMsgScId,

Loading…
Cancel
Save