From 599ae94bd3da63ccbd00a469306083856cd5e51e Mon Sep 17 00:00:00 2001 From: Achim Settelmeier Date: Mon, 1 Jun 2009 02:18:04 +0200 Subject: [PATCH] Set up some nice default values for MidiControlListener. This adds some nearly-standard keys and controllers to give new users a hint how the MIDI remote control works. Signed-off-by: Tobias Doerffel --- src/core/midi/midi_control_listener.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/core/midi/midi_control_listener.cpp b/src/core/midi/midi_control_listener.cpp index d2d02b418..31c7ab748 100644 --- a/src/core/midi/midi_control_listener.cpp +++ b/src/core/midi/midi_control_listener.cpp @@ -63,8 +63,16 @@ MidiControlListener::MidiControlListener() : m_controlKeyCount( 0 ), m_listenerEnabled( false ), m_channel( -1 ), - m_useControlKey( false ) + m_useControlKey( true ) { + // add some nice default settings + m_actionMapKeys[60] = ActionControl; // C5 + m_actionMapKeys[57] = ActionPlay; // A4 + m_actionMapKeys[59] = ActionStop; // B4 + m_actionMapKeys[58] = ActionToggleLoop; // B#4 + m_actionMapControllers[24] = ActionPlay; // Controller #24 + m_actionMapControllers[23] = ActionStop; // Controller #23 + readConfiguration(); // reads previously remembered configuration } @@ -271,6 +279,12 @@ void MidiControlListener::rememberConfiguration( QDomDocument & doc ) */ void MidiControlListener::readConfiguration() { + // check whether there's a configuration tree at all + if( s_configTree.isNull() || ! s_configTree.hasChildNodes() ) + { + return; + } + // default settings m_listenerEnabled = false; // turn off by default m_useControlKey = true; // use control key @@ -281,12 +295,6 @@ void MidiControlListener::readConfiguration() // unsubscribe all ports m_port.unsubscribeAllPorts(); - // check whether there's a configuration tree at all - if( s_configTree.isNull() || ! s_configTree.hasChildNodes() ) - { - return; - } - QDomElement conf = s_configTree.firstChildElement( "config" ); // check whether config tag is present if( ! conf.isNull() )