From 300baab2f1cd46d5bd7bc663b966d21132e56a7d Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Sun, 21 Sep 2008 23:45:39 +0000 Subject: [PATCH] refactored MIDI tab in instrumentTrackWindow which now also allows setting arbitrary fixed velocity and defining a program for MIDI output git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1679 0778d3d1-df1d-0410-868b-ea421aaaa00d --- data/themes/default/midi_in.png | Bin 1089 -> 0 bytes data/themes/default/midi_out.png | Bin 1134 -> 0 bytes include/group_box.h | 5 + include/instrument_midi_io_view.h | 16 +-- include/midi.h | 1 + include/midi_port.h | 42 +++---- src/core/midi/midi_port.cpp | 119 +++++++++++--------- src/gui/widgets/instrument_midi_io_view.cpp | 100 ++++++++-------- 8 files changed, 148 insertions(+), 135 deletions(-) delete mode 100644 data/themes/default/midi_in.png delete mode 100644 data/themes/default/midi_out.png diff --git a/data/themes/default/midi_in.png b/data/themes/default/midi_in.png deleted file mode 100644 index 44808ede856fb93227e92f54bea51c2dad9e3a33..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1089 zcmV-H1it%;P)Gzx)ua|D73GR(t(KogHJw+Zw?0v zo1#)I#q2?SkZMu76)BCHK%3OINt&cLzwh;a&hEFy&CR3=zU06mH|P8Pp7S}MbI$i( zpe=3rpG9kSVn@5;)GSJVDHV%v7p&wpo&L?X=tn4h1I4GawQH#$10&<7LQ+S-EA z?4feGjPCAkIqdiQ;q`jOMn^uM50y#<)oK-%Wyv~iT-SB|c(2FffngXZl}fTV7K=e| z7C^05!~Xt0CMG7tQL$LW*w`34Iy#Wg=Y`IhnHfw^PfI}4G{si0*99E+777LNGdw(u zY&I)Eng&2e>2z8G9vvMal}btW%q*Eq3NwK~K-TG)>tusL)!tk#huz&>@t4VD1X#-q zFna=E1`N(j)iXg*8I)iNgzW6??a6aI9v9kqhU+|Iv;yGZ;6SocPFY6=BQOR~4a#-e z7+`aA6RWGM7#|-;G#Ztx`MkWmj8G`l8URwrpbWqa=!|R-m;ykmX(K=?0Vv>XK*iMd z_O>*t-YNqGzyPeFDuJR~mEiF35bNvf0#q&=O}lRlmHaaU7X!~|xl@%!0E%M80KpJ| za=x>(Bc)M+c!t7}rvDl!-j@e_1EzBi*KR- ziSsfMq?aSg`l`%mXV$zAD60OnvF?dP0wW_M2#3QkJmDc&uf$)sJL^xwXV>5nUTheZ zqLojaL&ynEn6yW1d|bVbFV;T8W&JW1$F3rLZs37;{=@79&U?eKp4~ogkDKqK+deHV zsZ_Xe(mvDh-*U79m`@h)Vf-3yymtfBLo-;ISio>7@|R!_dS}p1MyN6c_EY5x@H)YZ z&MK9?RBh-GpQB#)nZKu9FwWjmuZio%HC+7q0+N}OObW|E=Z%@(E9zaqH3N@TU$_gc z;pJR&vpwrluk2M9WWdqq94$EdE0Fy?i^Vq=amLAmPE}C;N~1Zy>dOoth zs{8<}p8vN&oBAfy-UwVm#tzuG>faz)+rK-LZD~te{(JcY4%?krm}e@h00000NkvXX Hu0mjf)6Wmz diff --git a/data/themes/default/midi_out.png b/data/themes/default/midi_out.png deleted file mode 100644 index a7e2a09234fab0d1430bd437efb96eb2ad1cceeb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1134 zcmV-!1d;oRP)UDx>< zd%0YW@MhP5aadJVnwXfNQmI6lOom2BN2y+~QzDU|;o)JLoSdYosVOR#%al&1X>f3m zC(35CG%_;6&w<3izyK8r1!}k3T?0^X7!O0bot+)d9ItDh z6o5mO&CShw8V%~fa0ZRK-^vGyuli#bUw&HdstJVxU?-Xg$Wg*GA-r0uW4*RIn5Eh1`M}_E93NWm)EDU}!+G_9~2G2Q6a# zmdkxaKN6m)egEvltuy(zLNA_qeVpA5fW=}lD;|&2+S(eQb<`E}j3fZ!^?Lb)z@ZWV zcx8)PKYvC{HmS$wrAD((vfTq&y9YjB_>hjjV*`8=HL=~W-L$hJI0Wrw;Vq08msF#tduJ)>-VO1}2nL@sEER~%oM&vqd? zK%hF!+ismFL)Vn^n&JImtJ(Xl0=9S@%ez9)1Ej|R2G^9%-XC^2 zK(eb>KO73~Oe*QtNe%#P!SX?dq&S1GQCG=T{FMkp;C3XHJHLA!fLKR zlI=;7WTW+rf*Qk8sT7|EQExbsV!mOJA5PUYh4(dxo^m7?i6Ekz>% diff --git a/include/group_box.h b/include/group_box.h index 40bbeac26..a77e1250e 100644 --- a/include/group_box.h +++ b/include/group_box.h @@ -44,6 +44,11 @@ public: virtual void modelChanged( void ); + pixmapButton * ledButton( void ) + { + return m_led; + } + protected: virtual void mousePressEvent( QMouseEvent * _me ); diff --git a/include/instrument_midi_io_view.h b/include/instrument_midi_io_view.h index 6dc52e883..d9b1128b8 100644 --- a/include/instrument_midi_io_view.h +++ b/include/instrument_midi_io_view.h @@ -32,8 +32,7 @@ #include "mv_base.h" -class tabWidget; -class ledCheckBox; +class groupBox; class lcdSpinBox; class midiPortMenu; class QToolButton; @@ -49,14 +48,15 @@ public: private: virtual void modelChanged( void ); - tabWidget * m_setupTabWidget; + groupBox * m_midiInputGroupBox; lcdSpinBox * m_inputChannelSpinBox; - lcdSpinBox * m_outputChannelSpinBox; - ledCheckBox * m_receiveCheckBox; - ledCheckBox * m_sendCheckBox; - ledCheckBox * m_defaultVelocityInCheckBox; - ledCheckBox * m_defaultVelocityOutCheckBox; + lcdSpinBox * m_fixedInputVelocitySpinBox; QToolButton * m_rpBtn; + + groupBox * m_midiOutputGroupBox; + lcdSpinBox * m_outputChannelSpinBox; + lcdSpinBox * m_fixedOutputVelocitySpinBox; + lcdSpinBox * m_outputProgramSpinBox; QToolButton * m_wpBtn; } ; diff --git a/include/midi.h b/include/midi.h index cad10c60b..dbbc15898 100644 --- a/include/midi.h +++ b/include/midi.h @@ -81,6 +81,7 @@ enum MidiMetaEvents const int MidiChannelCount = 16; const int MidiControllerCount = 128; +const int MidiProgramCount = 128; const int MidiMaxVelocity = 127; diff --git a/include/midi_port.h b/include/midi_port.h index 61073b313..05847e1b5 100644 --- a/include/midi_port.h +++ b/include/midi_port.h @@ -53,6 +53,12 @@ class midiPort : public model, public serializingObject m_inputControllerModel); mapPropertyFromModel(int,outputController,setOutputController, m_outputControllerModel); + mapPropertyFromModel(int,fixedInputVelocity,setFixedInputVelocity, + m_fixedInputVelocityModel); + mapPropertyFromModel(int,fixedOutputVelocity,setFixedOutputVelocity, + m_fixedOutputVelocityModel); + mapPropertyFromModel(int,outputProgram,setOutputProgram, + m_outputProgramModel); mapPropertyFromModel(bool,isReadable,setReadable,m_readableModel); mapPropertyFromModel(bool,isWritable,setWritable,m_writableModel); public: @@ -73,11 +79,6 @@ public: Modes _mode = Disabled ); virtual ~midiPort(); - inline const QString & name( void ) const - { - return( m_name ); - } - void setName( const QString & _name ); inline Modes mode( void ) const @@ -97,16 +98,6 @@ public: return( mode() == Output || mode() == Duplex ); } - inline void enableDefaultVelocityForInEvents( const bool _on ) - { - m_defaultVelocityInEnabledModel.setValue( _on ); - } - - inline void enableDefaultVelocityForOutEvents( const bool _on ) - { - m_defaultVelocityOutEnabledModel.setValue( _on ); - } - void processInEvent( const midiEvent & _me, const midiTime & _time ); void processOutEvent( const midiEvent & _me, const midiTime & _time ); @@ -139,12 +130,6 @@ public: midiPortMenu * m_writablePortsMenu; -signals: - void readablePortsChanged( void ); - void writeablePortsChanged( void ); - void modeChanged( void ); - - public slots: void updateMidiPortMode( void ); @@ -152,24 +137,24 @@ public slots: private slots: void updateReadablePorts( void ); void updateWriteablePorts( void ); + void updateOutputProgram( void ); private: midiClient * m_midiClient; midiEventProcessor * m_midiEventProcessor; - QString m_name; // TODO: replace with model-name-property! - Modes m_mode; intModel m_inputChannelModel; intModel m_outputChannelModel; intModel m_inputControllerModel; intModel m_outputControllerModel; + intModel m_fixedInputVelocityModel; + intModel m_fixedOutputVelocityModel; + intModel m_outputProgramModel; boolModel m_readableModel; boolModel m_writableModel; - boolModel m_defaultVelocityInEnabledModel; - boolModel m_defaultVelocityOutEnabledModel; map m_readablePorts; map m_writablePorts; @@ -178,6 +163,13 @@ private: friend class controllerConnectionDialog; friend class instrumentMidiIOView; + +signals: + void readablePortsChanged( void ); + void writeablePortsChanged( void ); + void modeChanged( void ); + + } ; diff --git a/src/core/midi/midi_port.cpp b/src/core/midi/midi_port.cpp index cd270f37a..44896e798 100644 --- a/src/core/midi/midi_port.cpp +++ b/src/core/midi/midi_port.cpp @@ -1,5 +1,3 @@ -#ifndef SINGLE_SOURCE_COMPILE - /* * midi_port.cpp - abstraction of MIDI-ports which are part of LMMS's MIDI- * sequencing system @@ -42,7 +40,6 @@ midiPort::midiPort( const QString & _name, midiClient * _mc, m_writablePortsMenu( NULL ), m_midiClient( _mc ), m_midiEventProcessor( _mep ), - m_name( _name ), m_mode( _mode ), m_inputChannelModel( 0, 0, MidiChannelCount, this, tr( "Input channel" ) ), @@ -52,12 +49,14 @@ midiPort::midiPort( const QString & _name, midiClient * _mc, tr( "Input controller" ) ), m_outputControllerModel( 0, 0, MidiControllerCount, this, tr( "Output controller" ) ), - m_readableModel( FALSE, this, tr( "Receive MIDI-events" ) ), - m_writableModel( FALSE, this, tr( "Send MIDI-events" ) ), - m_defaultVelocityInEnabledModel( FALSE, this, - tr( "Default input velocity" ) ), - m_defaultVelocityOutEnabledModel( FALSE, this, - tr( "Default output velocity" ) ) + m_fixedInputVelocityModel( -1, -1, MidiMaxVelocity, this, + tr( "Fixed input velocity" ) ), + m_fixedOutputVelocityModel( -1, -1, MidiMaxVelocity, this, + tr( "Fixed output velocity" ) ), + m_outputProgramModel( 1, 1, MidiProgramCount, this, + tr( "Output MIDI program" ) ), + m_readableModel( false, this, tr( "Receive MIDI-events" ) ), + m_writableModel( false, this, tr( "Send MIDI-events" ) ) { m_midiClient->addPort( this ); @@ -68,11 +67,13 @@ midiPort::midiPort( const QString & _name, midiClient * _mc, this, SLOT( updateMidiPortMode() ) ); connect( &m_writableModel, SIGNAL( dataChanged() ), this, SLOT( updateMidiPortMode() ) ); + connect( &m_outputProgramModel, SIGNAL( dataChanged() ), + this, SLOT( updateOutputProgram() ) ); // when using with non-raw-clients we can provide buttons showing // our port-menus when being clicked - if( m_midiClient->isRaw() == FALSE ) + if( m_midiClient->isRaw() == false ) { updateReadablePorts(); updateWriteablePorts(); @@ -93,8 +94,8 @@ midiPort::midiPort( const QString & _name, midiClient * _mc, midiPort::~midiPort() { // unsubscribe ports - m_readableModel.setValue( FALSE ); - m_writableModel.setValue( FALSE ); + m_readableModel.setValue( false ); + m_writableModel.setValue( false ); // and finally unregister ourself m_midiClient->removePort( this ); @@ -105,7 +106,7 @@ midiPort::~midiPort() void midiPort::setName( const QString & _name ) { - m_name = _name; + setDisplayName( _name ); m_midiClient->applyPortName( this ); } @@ -137,10 +138,9 @@ void midiPort::processInEvent( const midiEvent & _me, const midiTime & _time ) } } midiEvent ev = _me; - if( m_defaultVelocityInEnabledModel.value() == true && - _me.velocity() > 0 ) + if( fixedInputVelocity() >= 0 && _me.velocity() > 0 ) { - ev.velocity() = MidiMaxVelocity; + ev.velocity() = fixedInputVelocity(); } m_midiEventProcessor->processInEvent( ev, _time ); } @@ -152,8 +152,7 @@ void midiPort::processInEvent( const midiEvent & _me, const midiTime & _time ) void midiPort::processOutEvent( const midiEvent & _me, const midiTime & _time ) { // mask event - if( outputEnabled() && - ( outputChannel() == _me.m_channel && outputChannel() != 0 ) ) + if( outputEnabled() && outputChannel() == _me.m_channel ) { midiEvent ev = _me; // we use/display MIDI channels 1...16 but we need 0...15 for @@ -162,10 +161,11 @@ void midiPort::processOutEvent( const midiEvent & _me, const midiTime & _time ) { --ev.m_channel; } - if( m_defaultVelocityOutEnabledModel.value() == true && - _me.velocity() > 0 ) + if( fixedOutputVelocity() >= 0 && _me.velocity() > 0 && + ( _me.m_type == MidiNoteOn || + _me.m_type == MidiKeyPressure ) ) { - ev.velocity() = MidiMaxVelocity; + ev.velocity() = fixedOutputVelocity(); } m_midiClient->processOutEvent( ev, _time, this ); } @@ -180,11 +180,13 @@ void midiPort::saveSettings( QDomDocument & _doc, QDomElement & _this ) m_outputChannelModel.saveSettings( _doc, _this, "outputchannel" ); m_inputControllerModel.saveSettings( _doc, _this, "inputcontroller" ); m_outputControllerModel.saveSettings( _doc, _this, "outputcontroller" ); + m_fixedInputVelocityModel.saveSettings( _doc, _this, + "fixedinputvelocity" ); + m_fixedOutputVelocityModel.saveSettings( _doc, _this, + "fixedoutputvelocity" ); + m_outputProgramModel.saveSettings( _doc, _this, "outputprogram" ); m_readableModel.saveSettings( _doc, _this, "readable" ); m_writableModel.saveSettings( _doc, _this, "writable" ); - m_defaultVelocityInEnabledModel.saveSettings( _doc, _this, "defvelin" ); - m_defaultVelocityOutEnabledModel.saveSettings( _doc, _this, - "defvelout" ); if( inputEnabled() ) { @@ -234,10 +236,11 @@ void midiPort::loadSettings( const QDomElement & _this ) m_outputChannelModel.loadSettings( _this, "outputchannel" ); m_inputControllerModel.loadSettings( _this, "inputcontroller" ); m_outputControllerModel.loadSettings( _this, "outputcontroller" ); + m_fixedInputVelocityModel.loadSettings( _this, "fixedinputvelocity" ); + m_fixedOutputVelocityModel.loadSettings( _this, "fixedoutputvelocity" ); + m_outputProgramModel.loadSettings( _this, "outputprogram" ); m_readableModel.loadSettings( _this, "readable" ); m_writableModel.loadSettings( _this, "writable" ); - m_defaultVelocityInEnabledModel.loadSettings( _this, "defvelin" ); - m_defaultVelocityOutEnabledModel.loadSettings( _this, "defvelout" ); // restore connections @@ -271,6 +274,34 @@ void midiPort::loadSettings( const QDomElement & _this ) +void midiPort::subscribeReadablePort( const QString & _port, bool _subscribe ) +{ + m_readablePorts[_port] = _subscribe; + // make sure, MIDI-port is configured for input + if( _subscribe == true && !inputEnabled() ) + { + m_readableModel.setValue( true ); + } + m_midiClient->subscribeReadablePort( this, _port, _subscribe ); +} + + + + +void midiPort::subscribeWriteablePort( const QString & _port, bool _subscribe ) +{ + m_writablePorts[_port] = _subscribe; + // make sure, MIDI-port is configured for output + if( _subscribe == true && !outputEnabled() ) + { + m_writableModel.setValue( true ); + } + m_midiClient->subscribeWriteablePort( this, _port, _subscribe ); +} + + + + void midiPort::updateMidiPortMode( void ) { // this small lookup-table makes everything easier @@ -290,7 +321,7 @@ void midiPort::updateMidiPortMode( void ) // subscribed? if( it.value() ) { - subscribeReadablePort( it.key(), FALSE ); + subscribeReadablePort( it.key(), false ); } } } @@ -303,7 +334,7 @@ void midiPort::updateMidiPortMode( void ) // subscribed? if( it.value() ) { - subscribeWriteablePort( it.key(), FALSE ); + subscribeWriteablePort( it.key(), false ); } } } @@ -325,7 +356,7 @@ void midiPort::updateReadablePorts( void ) for( midiPort::map::iterator it = m_readablePorts.begin(); it != m_readablePorts.end(); ++it ) { - if( it.value() == TRUE ) + if( it.value() == true ) { selected_ports.push_back( it.key() ); } @@ -351,7 +382,7 @@ void midiPort::updateWriteablePorts( void ) for( midiPort::map::iterator it = m_writablePorts.begin(); it != m_writablePorts.end(); ++it ) { - if( it.value() == TRUE ) + if( it.value() == true ) { selected_ports.push_back( it.key() ); } @@ -370,34 +401,14 @@ void midiPort::updateWriteablePorts( void ) -void midiPort::subscribeReadablePort( const QString & _port, bool _subscribe ) +void midiPort::updateOutputProgram( void ) { - m_readablePorts[_port] = _subscribe; - // make sure, MIDI-port is configured for input - if( _subscribe == TRUE && !inputEnabled() ) - { - m_readableModel.setValue( TRUE ); - } - m_midiClient->subscribeReadablePort( this, _port, _subscribe ); -} - - - - -void midiPort::subscribeWriteablePort( const QString & _port, bool _subscribe ) -{ - m_writablePorts[_port] = _subscribe; - // make sure, MIDI-port is configured for output - if( _subscribe == TRUE && !outputEnabled() ) - { - m_writableModel.setValue( TRUE ); - } - m_midiClient->subscribeWriteablePort( this, _port, _subscribe ); + processOutEvent( midiEvent( MidiProgramChange, + outputChannel(), + outputProgram()-1 ), midiTime( 0 ) ); } #include "moc_midi_port.cxx" - -#endif diff --git a/src/gui/widgets/instrument_midi_io_view.cpp b/src/gui/widgets/instrument_midi_io_view.cpp index df69b2839..7149bc98e 100644 --- a/src/gui/widgets/instrument_midi_io_view.cpp +++ b/src/gui/widgets/instrument_midi_io_view.cpp @@ -1,5 +1,3 @@ -#ifndef SINGLE_SOURCE_COMPILE - /* * instrument_midi_io_view.cpp - MIDI-IO-View * @@ -32,11 +30,10 @@ #include "instrument_midi_io_view.h" #include "midi_port_menu.h" #include "embed.h" +#include "group_box.h" #include "gui_templates.h" -#include "led_checkbox.h" #include "lcd_spinbox.h" #include "midi_client.h" -#include "tab_widget.h" #include "tooltip.h" @@ -47,64 +44,69 @@ instrumentMidiIOView::instrumentMidiIOView( QWidget * _parent ) : m_rpBtn( NULL ), m_wpBtn( NULL ) { - m_setupTabWidget = new tabWidget( - tr( "MIDI SETUP FOR THIS INSTRUMENT" ), - this ); - m_setupTabWidget->setGeometry( 4, 5, 242, 200 ); + m_midiInputGroupBox = new groupBox( tr( "ENABLE MIDI INPUT" ), this ); + m_midiInputGroupBox->setGeometry( 4, 5, 242, 80 ); - m_inputChannelSpinBox = new lcdSpinBox( 3, m_setupTabWidget ); + m_inputChannelSpinBox = new lcdSpinBox( 3, m_midiInputGroupBox ); m_inputChannelSpinBox->addTextForValue( 0, "---" ); m_inputChannelSpinBox->setLabel( tr( "CHANNEL" ) ); - m_inputChannelSpinBox->move( 28, 52 ); - m_inputChannelSpinBox->setEnabled( FALSE ); + m_inputChannelSpinBox->move( 16, 32 ); + m_inputChannelSpinBox->setEnabled( false ); + m_fixedInputVelocitySpinBox = new lcdSpinBox( 3, m_midiInputGroupBox ); + m_fixedInputVelocitySpinBox->addTextForValue( -1, "---" ); + m_fixedInputVelocitySpinBox->setLabel( tr( "VELOCITY" ) ); + m_fixedInputVelocitySpinBox->move( 64, 32 ); + m_fixedInputVelocitySpinBox->setEnabled( false ); - - m_outputChannelSpinBox = new lcdSpinBox( 3, m_setupTabWidget ); - m_outputChannelSpinBox->setLabel( tr( "CHANNEL" ) ); - m_outputChannelSpinBox->move( 28, 132 ); - m_outputChannelSpinBox->setEnabled( FALSE ); - - - m_receiveCheckBox = new ledCheckBox( tr( "Receive MIDI-events" ), - m_setupTabWidget ); - m_receiveCheckBox->move( 10, 34 ); - // enabling/disabling widgets is UI-stuff thus we do not use model here - connect( m_receiveCheckBox, SIGNAL( toggled( bool ) ), + connect( m_midiInputGroupBox->ledButton(), SIGNAL( toggled( bool ) ), m_inputChannelSpinBox, SLOT( setEnabled( bool ) ) ); + connect( m_midiInputGroupBox->ledButton(), SIGNAL( toggled( bool ) ), + m_fixedInputVelocitySpinBox, SLOT( setEnabled( bool ) ) ); - m_defaultVelocityInCheckBox = new ledCheckBox( tr( "Equal velocity" ), - m_setupTabWidget ); - m_defaultVelocityInCheckBox->move( 28, 86 ); + m_midiOutputGroupBox = new groupBox( tr( "ENABLE MIDI OUTPUT" ), this ); + m_midiOutputGroupBox->setGeometry( 4, 90, 242, 80 ); - m_sendCheckBox = new ledCheckBox( tr( "Send MIDI-events" ), - m_setupTabWidget ); - m_sendCheckBox->move( 10, 114 ); - connect( m_sendCheckBox, SIGNAL( toggled( bool ) ), + m_outputChannelSpinBox = new lcdSpinBox( 3, m_midiOutputGroupBox ); + m_outputChannelSpinBox->setLabel( tr( "CHANNEL" ) ); + m_outputChannelSpinBox->move( 16, 32 ); + m_outputChannelSpinBox->setEnabled( false ); + + m_fixedOutputVelocitySpinBox = new lcdSpinBox( 3, m_midiOutputGroupBox ); + m_fixedOutputVelocitySpinBox->addTextForValue( -1, "---" ); + m_fixedOutputVelocitySpinBox->setLabel( tr( "VELOCITY" ) ); + m_fixedOutputVelocitySpinBox->move( 64, 32 ); + m_fixedOutputVelocitySpinBox->setEnabled( false ); + + m_outputProgramSpinBox = new lcdSpinBox( 3, m_midiOutputGroupBox ); + m_outputProgramSpinBox->setLabel( tr( "PROGRAM" ) ); + m_outputProgramSpinBox->move( 112, 32 ); + m_outputProgramSpinBox->setEnabled( false ); + + connect( m_midiOutputGroupBox->ledButton(), SIGNAL( toggled( bool ) ), m_outputChannelSpinBox, SLOT( setEnabled( bool ) ) ); - - - m_defaultVelocityOutCheckBox = new ledCheckBox( tr( "Equal velocity" ), - m_setupTabWidget ); - m_defaultVelocityOutCheckBox->move( 28, 166 ); + connect( m_midiOutputGroupBox->ledButton(), SIGNAL( toggled( bool ) ), + m_fixedOutputVelocitySpinBox, SLOT( setEnabled( bool ) ) ); + connect( m_midiOutputGroupBox->ledButton(), SIGNAL( toggled( bool ) ), + m_outputProgramSpinBox, SLOT( setEnabled( bool ) ) ); if( !engine::getMixer()->getMidiClient()->isRaw() ) { - m_rpBtn = new QToolButton( m_setupTabWidget ); + m_rpBtn = new QToolButton( m_midiInputGroupBox ); m_rpBtn->setText( tr( "MIDI-devices to receive " "MIDI-events from" ) ); - m_rpBtn->setIcon( embed::getIconPixmap( "midi_in" ) ); - m_rpBtn->setGeometry( 186, 34, 40, 40 ); + m_rpBtn->setIcon( embed::getIconPixmap( "piano" ) ); + m_rpBtn->setGeometry( 186, 24, 32, 32 ); m_rpBtn->setPopupMode( QToolButton::InstantPopup ); - m_wpBtn = new QToolButton( m_setupTabWidget ); + m_wpBtn = new QToolButton( m_midiOutputGroupBox ); m_wpBtn->setText( tr( "MIDI-devices to send MIDI-events " "to" ) ); - m_wpBtn->setIcon( embed::getIconPixmap( "midi_out" ) ); - m_wpBtn->setGeometry( 186, 114, 40, 40 ); + m_wpBtn->setIcon( embed::getIconPixmap( "piano" ) ); + m_wpBtn->setGeometry( 186, 24, 32, 32 ); m_wpBtn->setPopupMode( QToolButton::InstantPopup ); } } @@ -122,14 +124,17 @@ instrumentMidiIOView::~instrumentMidiIOView() void instrumentMidiIOView::modelChanged( void ) { midiPort * mp = castModel(); + + m_midiInputGroupBox->setModel( &mp->m_readableModel ); m_inputChannelSpinBox->setModel( &mp->m_inputChannelModel ); + m_fixedInputVelocitySpinBox->setModel( &mp->m_fixedInputVelocityModel ); + + m_midiOutputGroupBox->setModel( &mp->m_writableModel ); m_outputChannelSpinBox->setModel( &mp->m_outputChannelModel ); - m_receiveCheckBox->setModel( &mp->m_readableModel ); - m_defaultVelocityInCheckBox->setModel( - &mp->m_defaultVelocityInEnabledModel ); - m_sendCheckBox->setModel( &mp->m_writableModel ); - m_defaultVelocityOutCheckBox->setModel( - &mp->m_defaultVelocityOutEnabledModel ); + m_fixedOutputVelocitySpinBox->setModel( + &mp->m_fixedOutputVelocityModel ); + m_outputProgramSpinBox->setModel( &mp->m_outputProgramModel ); + if( m_rpBtn ) { m_rpBtn->setMenu( mp->m_readablePortsMenu ); @@ -141,4 +146,3 @@ void instrumentMidiIOView::modelChanged( void ) } -#endif