4
4
* midi_tab_widget.cpp - tab-widget in channel-track-window for setting up
7
* Copyright (c) 2005-2006 Tobias Doerffel <tobydox/at/users.sourceforge.net>
7
* Copyright (c) 2005-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
9
9
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
21
21
* You should have received a copy of the GNU General Public
22
22
* License along with this program (see COPYING); if not, write to the
23
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24
* Boston, MA 02111-1307, USA.
23
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24
* Boston, MA 02110-1301 USA.
50
50
#include "midi_tab_widget.h"
53
#include "gui_templates.h"
51
54
#include "instrument_track.h"
55
#include "midi_client.h"
52
56
#include "midi_port.h"
53
#include "tab_widget.h"
54
57
#include "led_checkbox.h"
55
58
#include "lcd_spinbox.h"
59
#include "song_editor.h"
60
#include "tab_widget.h"
56
61
#include "tooltip.h"
57
#include "song_editor.h"
58
#include "midi_client.h"
63
65
midiTabWidget::midiTabWidget( instrumentTrack * _instrument_track,
64
66
midiPort * _port ) :
65
67
QWidget( _instrument_track->tabWidgetParent() ),
66
journallingObject( _instrument_track->eng() ),
67
68
m_instrumentTrack( _instrument_track ),
68
69
m_midiPort( _port ),
69
70
m_readablePorts( NULL ),
77
78
m_inputChannelSpinBox = new lcdSpinBox( 0, MIDI_CHANNEL_COUNT, 3,
79
tr( "Input channel" ),
80
eng(), _instrument_track );
80
tr( "Input channel" ),
81
82
m_inputChannelSpinBox->addTextForValue( 0, "---" );
82
83
m_inputChannelSpinBox->setValue( m_midiPort->inputChannel() + 1 );
83
84
m_inputChannelSpinBox->setLabel( tr( "CHANNEL" ) );
84
85
m_inputChannelSpinBox->move( 28, 52 );
86
m_inputChannelSpinBox->setEnabled( FALSE );
85
87
connect( m_inputChannelSpinBox, SIGNAL( valueChanged( int ) ),
86
88
this, SLOT( inputChannelChanged( int ) ) );
87
89
inputChannelChanged( m_inputChannelSpinBox->value() );
89
91
m_outputChannelSpinBox = new lcdSpinBox( 1, MIDI_CHANNEL_COUNT, 3,
91
tr( "Output channel" ),
92
eng(), _instrument_track );
93
tr( "Output channel" ),
93
95
m_outputChannelSpinBox->setValue( m_midiPort->outputChannel() + 1 );
94
96
//m_outputChannelSpinBox->addTextForValue( 0, "---" );
95
97
m_outputChannelSpinBox->setLabel( tr( "CHANNEL" ) );
96
98
m_outputChannelSpinBox->move( 28, 132 );
99
m_outputChannelSpinBox->setEnabled( FALSE );
97
100
connect( m_outputChannelSpinBox, SIGNAL( valueChanged( int ) ),
98
101
this, SLOT( outputChannelChanged( int ) ) );
99
102
outputChannelChanged( m_outputChannelSpinBox->value() );
102
105
m_receiveCheckBox = new ledCheckBox( tr( "Receive MIDI-events" ),
103
106
m_setupTabWidget,
104
107
tr( "Receive MIDI-events" ),
105
eng(), _instrument_track );
106
109
m_receiveCheckBox->move( 10, 34 );
107
110
connect( m_receiveCheckBox, SIGNAL( toggled( bool ) ),
108
111
this, SLOT( midiPortModeToggled( bool ) ) );
113
116
"for all input-events" ),
114
117
m_setupTabWidget,
115
118
tr( "Default input velocity" ),
116
eng(), _instrument_track );
117
120
m_defaultVelocityInCheckBox->move( 28, 84 );
118
121
connect( m_defaultVelocityInCheckBox, SIGNAL( toggled( bool ) ),
119
122
this, SLOT( defaultVelInChanged( bool ) ) );
122
125
m_sendCheckBox = new ledCheckBox( tr( "Send MIDI-events" ),
123
126
m_setupTabWidget,
124
127
tr( "Send MIDI-events" ),
125
eng(), _instrument_track );
126
129
m_sendCheckBox->move( 10, 114 );
127
130
connect( m_sendCheckBox, SIGNAL( toggled( bool ) ),
128
131
this, SLOT( midiPortModeToggled( bool ) ) );
133
136
"for all output-events" ),
134
137
m_setupTabWidget,
135
138
tr( "Default output velocity" ),
136
eng(), _instrument_track );
137
140
m_defaultVelocityOutCheckBox->move( 28, 164 );
138
141
connect( m_defaultVelocityOutCheckBox, SIGNAL( toggled( bool ) ),
139
142
this, SLOT( defaultVelOutChanged( bool ) ) );
148
151
// when using with non-raw-clients we can provide buttons showing
149
152
// our port-menus when being clicked
150
midiClient * mc = eng()->getMixer()->getMIDIClient();
153
midiClient * mc = engine::getMixer()->getMIDIClient();
151
154
if( mc->isRaw() == FALSE )
153
156
m_readablePorts = new QMenu( m_setupTabWidget );
499
502
m_readablePorts->clear();
500
const QStringList & rp = eng()->getMixer()->getMIDIClient()->
503
const QStringList & rp = engine::getMixer()->getMIDIClient()->
502
505
// now insert new ports and restore selections
503
506
for( QStringList::const_iterator it = rp.begin(); it != rp.end(); ++it )
551
554
m_writeablePorts->clear();
552
const QStringList & wp = eng()->getMixer()->getMIDIClient()->
555
const QStringList & wp = engine::getMixer()->getMIDIClient()->
553
556
writeablePorts();
554
557
// now insert new ports and restore selections
555
558
for( QStringList::const_iterator it = wp.begin(); it != wp.end(); ++it )
585
588
m_receiveCheckBox->setChecked( TRUE );
587
eng()->getMixer()->getMIDIClient()->subscribeReadablePort( m_midiPort,
590
engine::getMixer()->getMIDIClient()->subscribeReadablePort( m_midiPort,
588
591
_item->text(), !_item->isChecked() );
601
604
m_sendCheckBox->setChecked( TRUE );
603
eng()->getMixer()->getMIDIClient()->subscribeWriteablePort( m_midiPort,
606
engine::getMixer()->getMIDIClient()->subscribeWriteablePort( m_midiPort,
604
607
_item->text(), !_item->isChecked() );
623
626
m_readablePorts->setItemChecked( _id,
624
627
!m_readablePorts->isItemChecked( _id ) );
625
eng()->getMixer()->getMIDIClient()->subscribeReadablePort(
628
engine::getMixer()->getMIDIClient()->subscribeReadablePort(
626
629
m_midiPort, m_readablePorts->text( _id ),
627
630
!m_readablePorts->isItemChecked( _id ) );
642
645
m_writeablePorts->setItemChecked( _id,
643
646
!m_writeablePorts->isItemChecked( _id ) );
644
eng()->getMixer()->getMIDIClient()->subscribeWriteablePort(
647
engine::getMixer()->getMIDIClient()->subscribeWriteablePort(
645
648
m_midiPort, m_writeablePorts->text( _id ),
646
649
!m_writeablePorts->isItemChecked( _id ) );