diff --git a/Sources/VLMIDIWriter.cpp b/Sources/VLMIDIWriter.cpp index adfc39a..76b3da6 100644 --- a/Sources/VLMIDIWriter.cpp +++ b/Sources/VLMIDIWriter.cpp @@ -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(&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(&event)); } diff --git a/Sources/VLMIDIWriter.h b/Sources/VLMIDIWriter.h index 14e1de2..5d93c24 100644 --- a/Sources/VLMIDIWriter.h +++ b/Sources/VLMIDIWriter.h @@ -17,6 +17,7 @@ struct VLMIDIUserEvent { int8_t fPitch; // 0 -> Chord uint8_t fStanza; int16_t fMeasure; + uint32_t fVisual; VLFract fAt; }; diff --git a/Sources/VLSheetViewNotes.h b/Sources/VLSheetViewNotes.h index a06bcc3..156fe77 100644 --- a/Sources/VLSheetViewNotes.h +++ b/Sources/VLSheetViewNotes.h @@ -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 diff --git a/Sources/VLSheetViewNotes.mm b/Sources/VLSheetViewNotes.mm index 1c96ed1..7f18c0a 100644 --- a/Sources/VLSheetViewNotes.mm +++ b/Sources/VLSheetViewNotes.mm @@ -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 diff --git a/Sources/VLSheetViewSelection.mm b/Sources/VLSheetViewSelection.mm index 52acde8..54c27bc 100644 --- a/Sources/VLSheetViewSelection.mm +++ b/Sources/VLSheetViewSelection.mm @@ -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]; }