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

This commit is contained in:
kpl 2013-07-08 12:28:49 -07:00
parent 869d1c716b
commit a14aaf21e5
2 changed files with 36 additions and 1 deletions

View File

@ -1231,6 +1231,17 @@ cmScoreEvt_t* cmScoreEvt( cmScH_t h, unsigned idx )
return p->array + idx;
}
cmScoreEvt_t* cmScoreBarEvt( cmScH_t h, unsigned barNumb )
{
cmSc_t* p = _cmScHandleToPtr(h);
unsigned i = 0;
for(; i<p->cnt; ++i)
if( p->array[i].typeId==kBarEvtScId && p->array[i].barNumb==barNumb )
return p->array + i;
return NULL;
}
unsigned cmScoreSectionCount( cmScH_t h )
{
cmSc_t* p = _cmScHandleToPtr(h);
@ -1262,6 +1273,22 @@ cmScoreLoc_t* cmScoreLoc( cmScH_t h, unsigned idx )
return p->loc + idx;
}
cmScoreLoc_t* cmScoreEvtLoc( cmScH_t h, const cmScoreEvt_t* evt )
{
cmSc_t* p = _cmScHandleToPtr(h);
unsigned i;
if( evt != NULL )
for(i=0; i<p->locCnt; ++i)
{
unsigned j;
for(j=0; j<p->loc[i].evtCnt; ++j)
if( p->loc[i].evtArray[j] == evt )
return p->loc + i;
}
return NULL;
}
void cmScorePrintLoc( cmScH_t h )
{

View File

@ -151,6 +151,9 @@ extern "C" {
unsigned cmScoreEvtCount( cmScH_t h );
cmScoreEvt_t* cmScoreEvt( cmScH_t h, unsigned idx );
// Given a bar number return the associated 'bar' event record.
cmScoreEvt_t* cmScoreBarEvt( cmScH_t h, unsigned barNumb );
// Access section records
unsigned cmScoreSectionCount( cmScH_t h );
cmScoreSection_t* cmScoreSection( cmScH_t h, unsigned idx );
@ -160,6 +163,9 @@ extern "C" {
cmScoreLoc_t* cmScoreLoc( cmScH_t h, unsigned idx );
void cmScorePrintLoc( cmScH_t h );
// Return the location associated with a given score event.
cmScoreLoc_t* cmScoreEvtLoc( cmScH_t h, const cmScoreEvt_t* evt );
// Return the count of sets.
unsigned cmScoreSetCount( cmScH_t h );
@ -169,6 +175,7 @@ extern "C" {
// cmScMsg_t record.
cmScRC_t cmScoreSeqNotify( cmScH_t h );
/*
void cmScoreClearPerfInfo( cmScH_t h );
// Assign 'smpIdx' and 'vel' to the event matching 'pitch' at 'locIdx'
@ -186,7 +193,8 @@ extern "C" {
// Set the performed dynamic level of a score event.
void cmScoreSetPerfDynLevel( cmScH_t h, unsigned evtIdx, unsigned dynLvl );
*/
typedef enum
{
kInvalidMsgScId,