Draw proper pitch for note highlights (Tracker #3288852)

This commit is contained in:
Matthias Neeracher 2011-08-26 15:54:19 +00:00
parent 7b035f66bb
commit b915085530
5 changed files with 10 additions and 5 deletions

View File

@ -54,7 +54,7 @@ void VLMIDIWriter::VisitMeasure(size_t m, VLProperties & p, VLMeasure & meas)
void VLMIDIWriter::VisitNote(VLLyricsNote & n)
{
if (!(n.fTied & VLNote::kTiedWithPrev)) {
VLMIDIUserEvent event = {8, n.fPitch, fStanza, fMeasure, fAt};
VLMIDIUserEvent event = {12, n.fPitch, fStanza, fMeasure, n.fVisual, fAt};
MusicTrackNewUserEvent(fTrack, fNoteTime,
reinterpret_cast<const MusicEventUserData *>(&event));
}
@ -65,7 +65,7 @@ void VLMIDIWriter::VisitNote(VLLyricsNote & n)
void VLMIDIWriter::VisitChord(VLChord & c)
{
if (c.fPitch != VLNote::kNoPitch) {
VLMIDIUserEvent event = {8, 0, fStanza, fMeasure, fAt};
VLMIDIUserEvent event = {12, 0, fStanza, fMeasure, 0, fAt};
MusicTrackNewUserEvent(fTrack, fChordTime,
reinterpret_cast<const MusicEventUserData *>(&event));
}

View File

@ -17,6 +17,7 @@ struct VLMIDIUserEvent {
int8_t fPitch; // 0 -> Chord
uint8_t fStanza;
int16_t fMeasure;
uint32_t fVisual;
VLFract fAt;
};

View File

@ -15,7 +15,7 @@
- (void) drawNotesForSystem:(int)system;
- (void) addNoteAtCursor;
- (void) startKeyboardCursor;
- (void) drawNoteCursor:(int)pitch inMeasure:(size_t)measure at:(VLFract)at;
- (void) drawNoteCursor:(int)pitch inMeasure:(size_t)measure at:(VLFract)at accidental:(VLMusicElement)accidental;
@end

View File

@ -160,9 +160,10 @@
}
- (void) drawNoteCursor:(int)pitch inMeasure:(size_t)measure at:(VLFract)at
accidental:(VLMusicElement)accidental
{
[self drawNoteCursor:pitch inMeasure:measure at:at
accidental:kMusicNothing mode:' '];
accidental:accidental mode:' '];
}
- (void) drawNoteCursor

View File

@ -23,6 +23,7 @@
size_t fNoteMeasure;
VLFract fNoteAt;
int fNotePitch;
VLMusicElement fNoteAccidental;
size_t fChordMeasure;
VLFract fChordAt;
}
@ -50,6 +51,8 @@
VLMIDIUserEvent * event = (VLMIDIUserEvent *)[ev pointerValue];
if (event->fPitch) {
fNotePitch = event->fPitch;
fNoteAccidental = (event->fVisual & VLNote::kWantFlat) ? kMusicFlat
: ((event->fVisual & VLNote::kWantSharp) ? kMusicSharp : kMusicNothing);
fNoteMeasure = event->fMeasure;
fNoteAt = event->fAt;
fStanza = event->fStanza;
@ -65,7 +68,7 @@
- (void) highlightCursor
{
if (fNoteMeasure != 0x80000000 && fNotePitch != VLNote::kNoPitch)
[fView drawNoteCursor:fNotePitch inMeasure:fNoteMeasure at:fNoteAt];
[fView drawNoteCursor:fNotePitch inMeasure:fNoteMeasure at:fNoteAt accidental:fNoteAccidental];
if (fChordMeasure != 0x80000000)
[fView highlightChordInMeasure:fChordMeasure at:fChordAt];
}