-Fix: When quantising, remove all notes after the end of the loop.

-Fix: Use notecache based on loop events to add note-offs, else some could possibly be missed.


git-svn-id: http://svn.fuzzle.org/mloop/trunk@31 ba049829-c6ef-42ef-81ac-908dd8d2e907
master
petern 2009-07-24 07:19:13 +00:00
parent 604ae996d6
commit 4180158dc9
3 changed files with 23 additions and 1 deletions

View File

@ -144,7 +144,7 @@ void Jack::ToggleRecording(int loop, int bpm, bool delay)
m_loops[m_recording_loop].SetLength(m_recording_time);
m_loops[m_recording_loop].SetState(LS_IDLE);
m_loops[m_recording_loop].EndFromNoteCache(m_notecache);
m_loops[m_recording_loop].Finalise();
} else {
if (m_loops[loop].State() == LS_IDLE) {
m_recording_loop = loop;

View File

@ -134,6 +134,26 @@ void Loop::EndFromNoteCache(NoteCache &cache)
}
}
void Loop::Finalise()
{
NoteCache nc;
/* Remove all events after the end of the loop. */
EventList::iterator it;
for (it = m_events.begin(); it != m_events.end();) {
jack_midi_event_t &ev = *it;
if (ev.time < m_length) {
nc.HandleEvent(ev);
++it;
} else {
it = m_events.erase(it);
}
}
/* Now make sure no notes are left on. */
EndFromNoteCache(nc);
}
void Loop::Empty()
{
if (m_state != LS_IDLE) return;

View File

@ -81,6 +81,8 @@ public:
return m_loop;
}
void Finalise();
void Save(FILE *f) const;
};