From 8a6aecfbdcdd3f83069c4f889bfa058e81d954e8 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Wed, 23 Jan 2013 23:10:13 +0100 Subject: [PATCH] MidiPort: set fromMidiPort-flag of MidiEvent instances This completes the functionality introduced with commit edf93d04cbc452c81aba6549f65586bc8b02978a. Based on patch by nuio , 2013-01-20 --- src/core/midi/MidiPort.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/core/midi/MidiPort.cpp b/src/core/midi/MidiPort.cpp index 49c61e674..bdf9d42fd 100644 --- a/src/core/midi/MidiPort.cpp +++ b/src/core/midi/MidiPort.cpp @@ -2,7 +2,7 @@ * MidiPort.cpp - abstraction of MIDI-ports which are part of LMMS's MIDI- * sequencing system * - * Copyright (c) 2005-2009 Tobias Doerffel + * Copyright (c) 2005-2013 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -129,20 +129,24 @@ void MidiPort::processInEvent( const midiEvent & _me, const midiTime & _time ) if( inputEnabled() && ( inputChannel()-1 == _me.m_channel || inputChannel() == 0 ) ) { + midiEvent ev = _me; if( _me.m_type == MidiNoteOn || _me.m_type == MidiNoteOff || _me.m_type == MidiKeyPressure ) { - if( _me.key() < 0 || _me.key() >= NumKeys ) + ev.key() = ev.key() + KeysPerOctave; + if( ev.key() < 0 || ev.key() >= NumKeys ) { return; } } - midiEvent ev = _me; + if( fixedInputVelocity() >= 0 && _me.velocity() > 0 ) { ev.velocity() = fixedInputVelocity(); } + + ev.setFromMidiPort( true ); m_midiEventProcessor->processInEvent( ev, _time ); } }