# HG changeset patch # User Chris Cannam # Date 1235645348 0 # Node ID 4ad11b1cf05007683d2914d119e0594716ff7dc5 # Parent d4ff14feca7615bd0f63da65be05eca1e4e329d5 * Handle zero-velocity note ons as well as note offs (can't believe I fell for that one) * Add Peek Left / Peek Right (alt+left/right) and change peek-drag (i.e. dragging without moving playback pointer or other panes) from ctrl+drag to alt+drag for symmetry diff -r d4ff14feca76 -r 4ad11b1cf050 main/MainWindow.cpp --- a/main/MainWindow.cpp Wed Feb 25 12:02:53 2009 +0000 +++ b/main/MainWindow.cpp Thu Feb 26 10:49:08 2009 +0000 @@ -708,6 +708,22 @@ m_keyReference->registerShortcut(action); menu->addAction(action); + action = new QAction(tr("Peek Left"), this); + action->setShortcut(tr("Alt+Left")); + action->setStatusTip(tr("Scroll the current pane to the left without moving the playback cursor or other panes")); + connect(action, SIGNAL(triggered()), this, SLOT(peekLeft())); + connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool))); + m_keyReference->registerShortcut(action); + menu->addAction(action); + + action = new QAction(tr("Peek Right"), this); + action->setShortcut(tr("Alt+Right")); + action->setStatusTip(tr("Scroll the current pane to the right without moving the playback cursor or other panes")); + connect(action, SIGNAL(triggered()), this, SLOT(peekRight())); + connect(this, SIGNAL(canScroll(bool)), action, SLOT(setEnabled(bool))); + m_keyReference->registerShortcut(action); + menu->addAction(action); + menu->addSeparator(); m_keyReference->setCategory(tr("Zoom")); @@ -3428,17 +3444,25 @@ // happens in the MIDI input class and not here. while (m_midiInput->getEventsAvailable() > 0) { + MIDIEvent ev(m_midiInput->readEvent()); + bool noteOn = (ev.getMessageType() == MIDIConstants::MIDI_NOTE_ON && + ev.getVelocity() > 0); + + bool noteOff = (ev.getMessageType() == MIDIConstants::MIDI_NOTE_OFF || + (ev.getMessageType() == MIDIConstants::MIDI_NOTE_ON && + ev.getVelocity() == 0)); + if (currentNoteLayer) { - if (ev.getMessageType() == MIDIConstants::MIDI_NOTE_ON) { + if (noteOn) { currentNoteLayer->addNoteOn(ev.getTime(), ev.getPitch(), ev.getVelocity()); - } else if (ev.getMessageType() == MIDIConstants::MIDI_NOTE_OFF) { + } else if (noteOff) { currentNoteLayer->addNoteOff(ev.getTime(), ev.getPitch()); @@ -3446,9 +3470,8 @@ } } else { - if (ev.getMessageType() != MIDIConstants::MIDI_NOTE_ON) { - continue; - } + + if (!noteOn) continue; insertInstantAt(ev.getTime()); } }