From db002130c9b0c7604307cda2f06049d30c0553da Mon Sep 17 00:00:00 2001 From: Francois Best Date: Wed, 21 May 2014 09:56:06 +0200 Subject: [PATCH] Improve performance by iterating from the tail when removing notes. --- res/Examples/MIDI_SimpleSynth/noteList.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/res/Examples/MIDI_SimpleSynth/noteList.h b/res/Examples/MIDI_SimpleSynth/noteList.h index 5037a05..18ef829 100644 --- a/res/Examples/MIDI_SimpleSynth/noteList.h +++ b/res/Examples/MIDI_SimpleSynth/noteList.h @@ -108,7 +108,7 @@ inline MidiNote::MidiNote(const MidiNote& inOther) inline MidiNote& MidiNote::operator= (const MidiNote& inOther) { - pitch = inOther.pitch; + pitch = inOther.pitch; velocity = inOther.velocity; return *this; } @@ -197,9 +197,9 @@ inline void MidiNoteList::add(const MidiNote& inNote) template inline void MidiNoteList::remove(byte inPitch) { - if (mHead != 0) + if (mTail != 0) { - for (Cell* it = mHead; it != 0; it = it->next) + for (Cell* it = mTail; it != 0; it = it->prev) { if (it->note.pitch == inPitch) {