cmScoreMatchGraphic.c : Display damper pedal events.
This commit is contained in:
parent
fc8e338231
commit
3f3bc296aa
@ -25,8 +25,9 @@ enum
|
|||||||
kLocSmgFl = 0x0001,
|
kLocSmgFl = 0x0001,
|
||||||
kBarSmgFl = 0x0002,
|
kBarSmgFl = 0x0002,
|
||||||
kNoteSmgFl = 0x0004,
|
kNoteSmgFl = 0x0004,
|
||||||
kMidiSmgFl = 0x0008,
|
kPedalSmgFl = 0x0008,
|
||||||
kNoMatchSmgFl = 0x0010
|
kMidiSmgFl = 0x0010,
|
||||||
|
kNoMatchSmgFl = 0x0020
|
||||||
};
|
};
|
||||||
|
|
||||||
// Graphic box representing a score label or MIDI event
|
// Graphic box representing a score label or MIDI event
|
||||||
@ -60,7 +61,7 @@ typedef struct cmSmgLoc_str
|
|||||||
// Score label
|
// Score label
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
unsigned type; // kBarEvtScId | kNonEvtScId
|
unsigned type; // kBarEvtScId | kNonEvtScId | kPedalEvtScId
|
||||||
unsigned barNumb;
|
unsigned barNumb;
|
||||||
unsigned csvEventId;
|
unsigned csvEventId;
|
||||||
unsigned locIdx;
|
unsigned locIdx;
|
||||||
@ -222,33 +223,40 @@ cmSmgRC_t _cmSmgInitFromScore( cmCtx_t* ctx, cmSmg_t* p, const cmChar_t* scoreFn
|
|||||||
for(j=0; j<l->evtCnt; ++j)
|
for(j=0; j<l->evtCnt; ++j)
|
||||||
{
|
{
|
||||||
const cmScoreEvt_t* e = l->evtArray[j];
|
const cmScoreEvt_t* e = l->evtArray[j];
|
||||||
|
unsigned flags = kNoMatchSmgFl;
|
||||||
|
cmChar_t* text = NULL;
|
||||||
|
|
||||||
switch( e->type)
|
switch( e->type)
|
||||||
{
|
{
|
||||||
case kBarEvtScId:
|
|
||||||
case kNonEvtScId:
|
case kNonEvtScId:
|
||||||
{
|
flags |= kNoteSmgFl;
|
||||||
// Note: Mark all score boxes as 'no-match' - this will be cleared in cmScoreMatchGraphicInsertMidi().
|
text = cmMemAllocStr( cmMidiToSciPitch( e->pitch, NULL, 0));
|
||||||
unsigned flags = kNoMatchSmgFl | (e->type==kNonEvtScId ? kNoteSmgFl : kBarSmgFl);
|
|
||||||
cmChar_t* text = NULL;
|
|
||||||
|
|
||||||
assert( k < p->scN );
|
|
||||||
|
|
||||||
p->scV[k].type = e->type;
|
|
||||||
p->scV[k].csvEventId = e->csvEventId;
|
|
||||||
p->scV[k].locIdx = i;
|
|
||||||
p->scV[k].barNumb = e->barNumb;
|
|
||||||
|
|
||||||
if( e->type == kBarEvtScId )
|
|
||||||
text = cmTsPrintfP(NULL,"%i",e->barNumb);
|
|
||||||
else
|
|
||||||
text = cmMemAllocStr( cmMidiToSciPitch( e->pitch, NULL, 0));
|
|
||||||
|
|
||||||
p->scV[k].box = _cmSmgInsertBox(p, i, flags, e->csvEventId, text, NULL );
|
|
||||||
|
|
||||||
k += 1;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case kBarEvtScId:
|
||||||
|
flags |= kBarSmgFl;
|
||||||
|
text = cmTsPrintfP(NULL,"%i",e->barNumb);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case kPedalEvtScId:
|
||||||
|
flags |= kPedalSmgFl;
|
||||||
|
text = cmTsPrintfP(NULL,"%s", cmIsFlag(e->flags,kPedalDnScFl)?"v":"^");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if e is a score event of interest then store a reference to it
|
||||||
|
if( flags != kNoMatchSmgFl )
|
||||||
|
{
|
||||||
|
assert( k < p->scN );
|
||||||
|
|
||||||
|
p->scV[k].type = e->type;
|
||||||
|
p->scV[k].csvEventId = e->csvEventId;
|
||||||
|
p->scV[k].locIdx = i;
|
||||||
|
p->scV[k].barNumb = e->barNumb;
|
||||||
|
|
||||||
|
p->scV[k].box = _cmSmgInsertBox(p, i, flags, e->csvEventId, text, NULL );
|
||||||
|
|
||||||
|
k += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user