|
@@ -156,9 +156,6 @@ void PlaybackScreen::toggleOnMessage(std::shared_ptr<midi::NoteOnMessage> onMsg_
|
|
|
|
|
|
const BeatSequenceNoteInformation& noteInfo
|
|
|
= sequencer.beats.getNoteInfo(onMsg_ptr->channel, onMsg_ptr->pitch);
|
|
|
- // preceding on msg
|
|
|
- BeatIndexMultiset::const_iterator precedingOnBeatIndex_it
|
|
|
- = noteInfo.onBeatIndices.less_or_max(beatIndex);
|
|
|
|
|
|
const midi::MessageList& beat = sequencer.beats[beatIndex];
|
|
|
midi::MessageList::const_iterator beatOnMsg_it = beat.find(*onMsg_ptr);
|
|
@@ -176,12 +173,12 @@ void PlaybackScreen::toggleOnMessage(std::shared_ptr<midi::NoteOnMessage> onMsg_
|
|
|
= noteInfo.offBeatIndices.greater_or_min(*precedingOnMsgBeatIndex_it);
|
|
|
std::cout << "preceding at " << *precedingOnMsgBeatIndex_it << std::endl;
|
|
|
std::cout << "\tstop of preceding at " << *precedingOnFollowingOffMsgBeatIndex_it << std::endl;
|
|
|
- std::cout << "beatsInSequence(" << *precedingOnBeatIndex_it << ", " << beatIndex + 1 << ", " << *precedingOnFollowingOffMsgBeatIndex_it << ")" << std::endl;
|
|
|
+ std::cout << "beatsInSequence(" << *precedingOnMsgBeatIndex_it << ", " << beatIndex + 1 << ", " << *precedingOnFollowingOffMsgBeatIndex_it << ")" << std::endl;
|
|
|
if(precedingOnFollowingOffMsgBeatIndex_it == noteInfo.offBeatIndices.end()) {
|
|
|
// this preceding note was never stopped
|
|
|
// so stop it before the new note
|
|
|
sequencer.beats.pushFrontMessage(beatIndex, std::shared_ptr<midi::Message>(new midi::NoteOffMessage(offMsg)));
|
|
|
- } else if (beatsInSequence(*precedingOnBeatIndex_it, beatIndex + 1, *precedingOnFollowingOffMsgBeatIndex_it)) {
|
|
|
+ } else if (beatsInSequence(*precedingOnMsgBeatIndex_it, beatIndex, *precedingOnFollowingOffMsgBeatIndex_it)) {
|
|
|
// this preceding note is currently being stopped after the beat
|
|
|
// of the new note. so stop it before the new note.
|
|
|
sequencer.beats.pushFrontMessage(beatIndex, std::shared_ptr<midi::Message>(new midi::NoteOffMessage(offMsg)));
|
|
@@ -226,6 +223,8 @@ void PlaybackScreen::toggleOnMessage(std::shared_ptr<midi::NoteOnMessage> onMsg_
|
|
|
}
|
|
|
|
|
|
// previous on without off before to-be-removed on ?
|
|
|
+ BeatIndexMultiset::const_iterator precedingOnBeatIndex_it
|
|
|
+ = noteInfo.onBeatIndices.less_or_max(beatIndex);
|
|
|
if(precedingOnBeatIndex_it != noteInfo.onBeatIndices.end()) {
|
|
|
std::cout << "previous: " << *precedingOnBeatIndex_it << std::endl;
|
|
|
}
|