-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Semi-Realtime MIDI - separation of voices [WIP] #2794
Conversation
25ca630
to
1fbbfb3
Compare
seg = setNoteRest(seg, track, NoteVal(), Fraction::fromTicks(rchord->tick() - seg->tick()), Direction::AUTO); // This *appears* to work in all voices, but see FIXME below. | ||
while (seg->tick() < rchord->tick()) // might encounter segments from other voices before the one we want | ||
seg = seg->next(Segment::Type::ChordRest); // FIXME: in higher voices this sometimes does not find the ChordRest we just added 2 lines above with setNoteRest() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where the problem occurs.
I use setNoteRest
to add a rest so that I can guarantee there will be a ChordRest at the tick immediately after it. I then try to move to the end of the rest with seg->next(Segment::Type::ChordRest)
. This works fine in Voice 1 and usually in higher voices too, but sometimes in higher voices it moves too far and skips past the end of the rest.
1fbbfb3
to
cacf5f0
Compare
What's the current status? I still have the PR marked as WIP. |
Status is unchanged at present. TLDR: ChordRests and ties are being added to the score but are subsequently ignored. Does this mean anything to you? My code separates the voices and adds the notes to ChordRests in each voice, but for some reason the new ChordRests do not appear to be "visible" to the other voices. Perhaps I need to do something like call |
For any playback changes probably score->setPlaylistDirty() has to be called to force the midi event list to be recreated on next play.. |
This PR now needs a rebase. |
@shoogle, would you like to rebase this PR or should we better archive it for now? |
Archiving this for now, if it is planned to be updated feel free to reopen this PR. |
Definitely a work-in-progress at the moment. The voice recalculation works perfectly, but there are bugs when it comes to entering the newly calculated voice into the score. The pre-existing
setNoteRest()
function appears to have problems with higher voices. It seems like ChordRests are being created but then ignored, so when the chord looks for the next ChordRest the new ones are missed and things get corrupted.Voice separation works some of the time, but crashes consistently with certain inputs, such as when playing short low notes at the same time as long high notes. For example, playing an E whole-note while playing C quarters causes a crash, but playing E quarters against a C whole note is fine.