From 8c8763721c456e589e1bb5dc413bca54cd73e6fe Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Tue, 14 Jan 2014 23:34:03 +0100 Subject: [PATCH] Piano: added optional velocity argument to handleKeyPress() --- include/Piano.h | 2 +- src/core/Piano.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/Piano.h b/include/Piano.h index a9d112a38..1673d9479 100644 --- a/include/Piano.h +++ b/include/Piano.h @@ -50,7 +50,7 @@ public: return m_pressedKeys[key]; } - void handleKeyPress( int key ); + void handleKeyPress( int key, int midiVelocity = MidiMaxVelocity ); void handleKeyRelease( int key ); InstrumentTrack* instrumentTrack() const diff --git a/src/core/Piano.cpp b/src/core/Piano.cpp index 160d413cc..3bd85ee8d 100644 --- a/src/core/Piano.cpp +++ b/src/core/Piano.cpp @@ -92,11 +92,11 @@ void Piano::setKeyState( int key, bool state ) * * \param key the key being pressed */ -void Piano::handleKeyPress( int key ) +void Piano::handleKeyPress( int key, int midiVelocity ) { if( isValidKey( key ) ) { - m_midiEvProc->processInEvent( midiEvent( MidiNoteOn, 0, key, MidiMaxVelocity ), midiTime() ); + m_midiEvProc->processInEvent( midiEvent( MidiNoteOn, 0, key, midiVelocity ), midiTime() ); m_pressedKeys[key] = true; } }