From c46c4ff3d16500e38ff1608837699f3285814704 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Tue, 18 Aug 2009 01:29:10 +0200 Subject: [PATCH] ZynAddSubFX: forward MidiControlChange events to ZynAddSubFX core So far we ignored all events other than MidiNoteOn, MidiNoteOff and MidiPitchBend. By also processing MidiControlChange events one can control some basic parameters of ZynAddSubFX via MIDI now. (cherry picked from commit 49ebb835af0cff56237849c4a5e901c682f892b4) --- plugins/zynaddsubfx/remote_zynaddsubfx.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/plugins/zynaddsubfx/remote_zynaddsubfx.cpp b/plugins/zynaddsubfx/remote_zynaddsubfx.cpp index c3011df4b..0b29507e7 100644 --- a/plugins/zynaddsubfx/remote_zynaddsubfx.cpp +++ b/plugins/zynaddsubfx/remote_zynaddsubfx.cpp @@ -138,8 +138,10 @@ public: // all functions are called while master->mutex is held virtual void processMidiEvent( const midiEvent & _e, - const f_cnt_t /* _offset */ ) - { + const f_cnt_t /* _offset */ ) + { + static MidiIn midiIn; + switch( _e.m_type ) { case MidiNoteOn: @@ -174,6 +176,11 @@ public: _e.m_data.m_param[0] + _e.m_data.m_param[1]*128-8192 ); break; + case MidiControlChange: + master->SetController( 0, + midiIn.getcontroller( _e.m_data.m_param[0] ), + _e.m_data.m_param[1] ); + break; default: break; } @@ -356,11 +363,11 @@ int main( int _argc, char * * _argv ) remotePluginClient::message m; while( ( m = __remote_zasf->receiveMessage() ).id != IdQuit ) - { + { pthread_mutex_lock( &master->mutex ); - __remote_zasf->processMessage( m ); + __remote_zasf->processMessage( m ); pthread_mutex_unlock( &master->mutex ); - } + } __exit = 1;