rewrote management of MIDI-ports and MIDI-port subscriptions - now it's central and easy to use
git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1087 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
@@ -323,7 +323,7 @@ void midiALSASeq::removePort( midiPort * _port )
|
||||
|
||||
void midiALSASeq::subscribeReadablePort( midiPort * _port,
|
||||
const QString & _dest,
|
||||
bool _unsubscribe )
|
||||
bool _subscribe )
|
||||
{
|
||||
if( m_portIDs.contains( _port ) == FALSE ||
|
||||
( _port->mode() != midiPort::Input &&
|
||||
@@ -346,13 +346,13 @@ void midiALSASeq::subscribeReadablePort( midiPort * _port,
|
||||
snd_seq_port_subscribe_malloc( &subs );
|
||||
snd_seq_port_subscribe_set_sender( subs, &sender );
|
||||
snd_seq_port_subscribe_set_dest( subs, dest );
|
||||
if( _unsubscribe )
|
||||
if( _subscribe )
|
||||
{
|
||||
snd_seq_unsubscribe_port( m_seqHandle, subs );
|
||||
snd_seq_subscribe_port( m_seqHandle, subs );
|
||||
}
|
||||
else
|
||||
{
|
||||
snd_seq_subscribe_port( m_seqHandle, subs );
|
||||
snd_seq_unsubscribe_port( m_seqHandle, subs );
|
||||
}
|
||||
snd_seq_port_subscribe_free( subs );
|
||||
snd_seq_port_info_free( port_info );
|
||||
@@ -363,7 +363,7 @@ void midiALSASeq::subscribeReadablePort( midiPort * _port,
|
||||
|
||||
void midiALSASeq::subscribeWriteablePort( midiPort * _port,
|
||||
const QString & _dest,
|
||||
bool _unsubscribe )
|
||||
bool _subscribe )
|
||||
{
|
||||
if( m_portIDs.contains( _port ) == FALSE ||
|
||||
( _port->mode() != midiPort::Output &&
|
||||
@@ -389,13 +389,13 @@ void midiALSASeq::subscribeWriteablePort( midiPort * _port,
|
||||
snd_seq_port_subscribe_malloc( &subs );
|
||||
snd_seq_port_subscribe_set_sender( subs, sender );
|
||||
snd_seq_port_subscribe_set_dest( subs, &dest );
|
||||
if( _unsubscribe )
|
||||
if( _subscribe )
|
||||
{
|
||||
snd_seq_unsubscribe_port( m_seqHandle, subs );
|
||||
snd_seq_subscribe_port( m_seqHandle, subs );
|
||||
}
|
||||
else
|
||||
{
|
||||
snd_seq_subscribe_port( m_seqHandle, subs );
|
||||
snd_seq_unsubscribe_port( m_seqHandle, subs );
|
||||
}
|
||||
snd_seq_port_subscribe_free( subs );
|
||||
snd_seq_port_info_free( port_info );
|
||||
|
||||
@@ -64,12 +64,9 @@ void midiClient::applyPortName( midiPort * )
|
||||
|
||||
|
||||
|
||||
midiPort * midiClient::addPort( midiEventProcessor * _mep,
|
||||
const QString & _name )
|
||||
void midiClient::addPort( midiPort * _port )
|
||||
{
|
||||
midiPort * port = new midiPort( this, _mep, _name );
|
||||
m_midiPorts.push_back( port );
|
||||
return( port );
|
||||
m_midiPorts.push_back( _port );
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +79,6 @@ void midiClient::removePort( midiPort * _port )
|
||||
_port );
|
||||
if( it != m_midiPorts.end() )
|
||||
{
|
||||
delete *it;
|
||||
m_midiPorts.erase( it );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include "engine.h"
|
||||
#include "mixer.h"
|
||||
#include "midi_client.h"
|
||||
#include "midi_port.h"
|
||||
#include "midi_controller.h"
|
||||
|
||||
|
||||
@@ -42,34 +41,19 @@
|
||||
midiController::midiController( model * _parent ) :
|
||||
controller( MidiController, _parent ),
|
||||
midiEventProcessor(),
|
||||
m_midiChannel( 0, 0, MIDI_CHANNEL_COUNT, this ),
|
||||
m_midiController( 0, 0, MIDI_CONTROLLER_COUNT, this ),
|
||||
m_midiPort( engine::getMixer()->getMIDIClient()->addPort(
|
||||
this, tr( "unnamed_midi_controller" ) ) ),
|
||||
m_midiPort( tr( "unnamed_midi_controller" ),
|
||||
engine::getMixer()->getMIDIClient(), this,
|
||||
this, NULL, midiPort::Input ),
|
||||
m_lastValue( 0.0f )
|
||||
{
|
||||
m_midiPort->setMode( midiPort::Input );
|
||||
|
||||
midiClient * mc = engine::getMixer()->getMIDIClient();
|
||||
if( mc->isRaw() == FALSE )
|
||||
{
|
||||
updateReadablePorts();
|
||||
}
|
||||
|
||||
connect( &m_midiChannel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updateMidiPort() ) );
|
||||
connect( &m_midiController, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updateMidiPort() ) );
|
||||
connect( &m_midiPort, SIGNAL( modeChanged() ),
|
||||
this, SLOT( updateName() ) );
|
||||
}
|
||||
|
||||
|
||||
|
||||
midiController::~midiController()
|
||||
{
|
||||
m_midiChannel.disconnect( this );
|
||||
m_midiController.disconnect( this );
|
||||
|
||||
engine::getMixer()->getMIDIClient()->removePort( m_midiPort );
|
||||
}
|
||||
|
||||
|
||||
@@ -83,12 +67,11 @@ float midiController::value( int _offset )
|
||||
|
||||
|
||||
|
||||
void midiController::updateMidiPort( void )
|
||||
void midiController::updateName( void )
|
||||
{
|
||||
m_midiPort->setInputChannel( m_midiChannel.value() - 1 );
|
||||
setName( QString("MIDI ch%1 ctrl%2").
|
||||
arg( m_midiChannel.value() ).
|
||||
arg( m_midiController.value() ) );
|
||||
arg( m_midiPort.inputChannel() ).
|
||||
arg( m_midiPort.inputController() ) );
|
||||
}
|
||||
|
||||
|
||||
@@ -105,9 +88,9 @@ void midiController::processInEvent( const midiEvent & _me,
|
||||
bytes = _me.m_data.m_bytes;
|
||||
controllerNum = _me.m_data.m_bytes[0] & 0x7F;
|
||||
|
||||
if( m_midiController.value() == controllerNum + 1 &&
|
||||
( m_midiChannel.value() == _me.m_channel + 1 ||
|
||||
m_midiChannel.value() == 0 ) )
|
||||
if( m_midiPort.inputController() == controllerNum + 1 &&
|
||||
( m_midiPort.inputChannel() == _me.m_channel + 1 ||
|
||||
m_midiPort.inputChannel() == 0 ) )
|
||||
{
|
||||
Uint8 val = _me.m_data.m_bytes[2] & 0x7F;
|
||||
m_lastValue = (float)( val ) / 127.0f;
|
||||
@@ -124,43 +107,13 @@ void midiController::processInEvent( const midiEvent & _me,
|
||||
|
||||
|
||||
|
||||
void midiController::setReadablePorts( const midiPortMap & _map )
|
||||
void midiController::subscribeReadablePorts( const midiPort::map & _map )
|
||||
{
|
||||
m_readablePorts.clear();
|
||||
|
||||
for( midiPortMap::const_iterator it = _map.constBegin();
|
||||
it != _map.constEnd(); ++it )
|
||||
for( midiPort::map::const_iterator it = _map.constBegin();
|
||||
it != _map.constEnd(); ++it )
|
||||
{
|
||||
engine::getMixer()->getMIDIClient()->subscribeReadablePort(
|
||||
m_midiPort, it.key(), !( *it ) );
|
||||
m_midiPort.subscribeReadablePort( it.key(), *it );
|
||||
}
|
||||
|
||||
m_readablePorts = _map;
|
||||
}
|
||||
|
||||
|
||||
void midiController::updateReadablePorts( void )
|
||||
{
|
||||
// first save all selected ports
|
||||
QStringList selected_ports;
|
||||
|
||||
for( midiPortMap::const_iterator i = m_readablePorts.constBegin();
|
||||
i != m_readablePorts.constEnd(); ++i )
|
||||
{
|
||||
selected_ports.push_back( i.key() );
|
||||
++i;
|
||||
}
|
||||
|
||||
m_readablePorts.clear();
|
||||
const QStringList & wp = engine::getMixer()->getMIDIClient()->
|
||||
readablePorts();
|
||||
|
||||
// now insert new ports and restore selections
|
||||
for( QStringList::const_iterator it = wp.begin(); it != wp.end(); ++it )
|
||||
{
|
||||
m_readablePorts[ *it ] = ( selected_ports.indexOf( *it ) != -1 );
|
||||
}
|
||||
//emit readablePortsChanged();
|
||||
}
|
||||
|
||||
|
||||
@@ -169,28 +122,8 @@ void midiController::updateReadablePorts( void )
|
||||
void midiController::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
{
|
||||
controller::saveSettings( _doc, _this );
|
||||
m_midiPort.saveSettings( _doc, _this );
|
||||
|
||||
m_midiChannel.saveSettings( _doc, _this, "channel" );
|
||||
m_midiController.saveSettings( _doc, _this, "controller" );
|
||||
|
||||
if( m_readablePorts.size() )
|
||||
{
|
||||
QString rp;
|
||||
for( midiPortMap::const_iterator it = m_readablePorts.constBegin();
|
||||
it != m_readablePorts.constEnd(); ++it )
|
||||
{
|
||||
if( *it )
|
||||
{
|
||||
rp += it.key() + ",";
|
||||
}
|
||||
}
|
||||
// cut off comma
|
||||
if( rp.length() > 0 )
|
||||
{
|
||||
rp.truncate( rp.length() - 1 );
|
||||
}
|
||||
_this.setAttribute( "inports", rp );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -200,28 +133,9 @@ void midiController::loadSettings( const QDomElement & _this )
|
||||
{
|
||||
controller::loadSettings( _this );
|
||||
|
||||
m_midiChannel.loadSettings( _this, "channel" );
|
||||
m_midiController.loadSettings( _this, "controller" );
|
||||
m_midiPort.loadSettings( _this );
|
||||
|
||||
midiClient * mc = engine::getMixer()->getMIDIClient();
|
||||
if( mc->isRaw() == FALSE )
|
||||
{
|
||||
//updateReadablePorts();
|
||||
|
||||
QStringList rp = _this.attribute( "inports" ).split( ',' );
|
||||
for( midiPortMap::iterator it = m_readablePorts.begin();
|
||||
it != m_readablePorts.end(); ++it )
|
||||
{
|
||||
if( rp.indexOf( it.key() ) != -1 )
|
||||
{
|
||||
*it = TRUE;
|
||||
|
||||
engine::getMixer()->getMIDIClient()->subscribeReadablePort(
|
||||
m_midiPort, it.key(), !( *it ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
updateMidiPort();
|
||||
updateName();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,374 +0,0 @@
|
||||
#ifndef SINGLE_SOURCE_COMPILE
|
||||
|
||||
/*
|
||||
* instrument_midi_io.cpp - class instrumentMidiIO
|
||||
*
|
||||
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
|
||||
*
|
||||
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public
|
||||
* License along with this program (see COPYING); if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
#include <Qt/QtXml>
|
||||
|
||||
|
||||
#include "instrument_midi_io.h"
|
||||
#include "engine.h"
|
||||
#include "instrument_track.h"
|
||||
#include "midi_client.h"
|
||||
#include "midi_port.h"
|
||||
#include "song.h"
|
||||
|
||||
|
||||
|
||||
instrumentMidiIO::instrumentMidiIO( instrumentTrack * _instrument_track,
|
||||
midiPort * _port ) :
|
||||
model( _instrument_track ),
|
||||
m_instrumentTrack( _instrument_track ),
|
||||
m_midiPort( _port ),
|
||||
m_inputChannelModel( m_midiPort->inputChannel() + 1,
|
||||
0, MIDI_CHANNEL_COUNT, this ),
|
||||
m_outputChannelModel( m_midiPort->outputChannel() + 1,
|
||||
1, MIDI_CHANNEL_COUNT, this ),
|
||||
m_receiveEnabledModel( FALSE, this ),
|
||||
m_sendEnabledModel( FALSE, this ),
|
||||
m_defaultVelocityInEnabledModel( FALSE, this ),
|
||||
m_defaultVelocityOutEnabledModel( FALSE, this )
|
||||
{
|
||||
m_inputChannelModel.setTrack( m_instrumentTrack );
|
||||
m_outputChannelModel.setTrack( m_instrumentTrack );
|
||||
m_receiveEnabledModel.setTrack( m_instrumentTrack );
|
||||
m_defaultVelocityInEnabledModel.setTrack( m_instrumentTrack );
|
||||
m_sendEnabledModel.setTrack( m_instrumentTrack );
|
||||
m_defaultVelocityOutEnabledModel.setTrack( m_instrumentTrack );
|
||||
|
||||
connect( &m_inputChannelModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updateInputChannel() ) );
|
||||
connect( &m_outputChannelModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updateOutputChannel() ) );
|
||||
connect( &m_receiveEnabledModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updateMidiPortMode() ) );
|
||||
connect( &m_defaultVelocityInEnabledModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updateDefaultVelIn() ) );
|
||||
connect( &m_sendEnabledModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updateMidiPortMode() ) );
|
||||
connect( &m_defaultVelocityOutEnabledModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updateDefaultVelOut() ) );
|
||||
|
||||
updateInputChannel();
|
||||
updateOutputChannel();
|
||||
|
||||
|
||||
const midiPort::Modes m = m_midiPort->mode();
|
||||
m_receiveEnabledModel.setValue( m == midiPort::Input ||
|
||||
m == midiPort::Duplex );
|
||||
m_sendEnabledModel.setValue( m == midiPort::Output ||
|
||||
m == midiPort::Duplex );
|
||||
|
||||
// when using with non-raw-clients we can provide buttons showing
|
||||
// our port-menus when being clicked
|
||||
midiClient * mc = engine::getMixer()->getMIDIClient();
|
||||
if( mc->isRaw() == FALSE )
|
||||
{
|
||||
updateReadablePorts();
|
||||
updateWriteablePorts();
|
||||
|
||||
// we want to get informed about port-changes!
|
||||
mc->connectRPChanged( this, SLOT( updateReadablePorts() ) );
|
||||
mc->connectWPChanged( this, SLOT( updateWriteablePorts() ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
instrumentMidiIO::~instrumentMidiIO()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void instrumentMidiIO::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
{
|
||||
m_inputChannelModel.saveSettings( _doc, _this, "inputchannel" );
|
||||
m_outputChannelModel.saveSettings( _doc, _this, "outputchannel" );
|
||||
m_receiveEnabledModel.saveSettings( _doc, _this, "receive" );
|
||||
m_sendEnabledModel.saveSettings( _doc, _this, "send" );
|
||||
m_defaultVelocityInEnabledModel.saveSettings( _doc, _this, "defvelin" );
|
||||
m_defaultVelocityOutEnabledModel.saveSettings( _doc, _this,
|
||||
"defvelout" );
|
||||
|
||||
if( m_receiveEnabledModel.value() == TRUE )
|
||||
{
|
||||
QString rp;
|
||||
for( midiPortMap::iterator it = m_readablePorts.begin();
|
||||
it != m_readablePorts.end(); ++it )
|
||||
{
|
||||
if( it->second )
|
||||
{
|
||||
rp += it->first + ",";
|
||||
}
|
||||
}
|
||||
// cut off comma
|
||||
if( rp.length() > 0 )
|
||||
{
|
||||
rp.truncate( rp.length() - 1 );
|
||||
}
|
||||
_this.setAttribute( "inports", rp );
|
||||
}
|
||||
|
||||
if( m_sendEnabledModel.value() == TRUE )
|
||||
{
|
||||
QString wp;
|
||||
for( midiPortMap::iterator it = m_writeablePorts.begin();
|
||||
it != m_writeablePorts.end(); ++it )
|
||||
{
|
||||
if( it->second )
|
||||
{
|
||||
wp += it->first + ",";
|
||||
}
|
||||
}
|
||||
// cut off comma
|
||||
if( wp.length() > 0 )
|
||||
{
|
||||
wp.truncate( wp.length() - 1 );
|
||||
}
|
||||
_this.setAttribute( "outports", wp );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void instrumentMidiIO::loadSettings( const QDomElement & _this )
|
||||
{
|
||||
m_inputChannelModel.loadSettings( _this, "inputchannel" );
|
||||
m_outputChannelModel.loadSettings( _this, "outputchannel" );
|
||||
m_receiveEnabledModel.loadSettings( _this, "receive" );
|
||||
m_sendEnabledModel.loadSettings( _this, "send" );
|
||||
m_defaultVelocityInEnabledModel.loadSettings( _this, "defvelin" );
|
||||
m_defaultVelocityOutEnabledModel.loadSettings( _this, "defvelout" );
|
||||
|
||||
// restore connections
|
||||
|
||||
if( m_receiveEnabledModel.value() == TRUE )
|
||||
{
|
||||
QStringList rp = _this.attribute( "inports" ).split( ',' );
|
||||
for( midiPortMap::iterator it = m_readablePorts.begin();
|
||||
it != m_readablePorts.end(); ++it )
|
||||
{
|
||||
if( it->second != ( rp.indexOf( it->first ) != -1 ) )
|
||||
{
|
||||
it->second = TRUE;
|
||||
activatedReadablePort( *it );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( m_sendEnabledModel.value() == TRUE )
|
||||
{
|
||||
QStringList wp = _this.attribute( "outports" ).split( ',' );
|
||||
for( midiPortMap::iterator it = m_writeablePorts.begin();
|
||||
it != m_writeablePorts.end(); ++it )
|
||||
{
|
||||
if( it->second != ( wp.indexOf( it->first ) != -1 ) )
|
||||
{
|
||||
it->second = TRUE;
|
||||
activatedWriteablePort( *it );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void instrumentMidiIO::updateInputChannel( void )
|
||||
{
|
||||
m_midiPort->setInputChannel( m_inputChannelModel.value() - 1 );
|
||||
engine::getSong()->setModified();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void instrumentMidiIO::updateOutputChannel( void )
|
||||
{
|
||||
m_midiPort->setOutputChannel( m_outputChannelModel.value() - 1 );
|
||||
engine::getSong()->setModified();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void instrumentMidiIO::updateDefaultVelIn( void )
|
||||
{
|
||||
m_midiPort->enableDefaultVelocityForInEvents(
|
||||
m_defaultVelocityInEnabledModel.value() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void instrumentMidiIO::updateDefaultVelOut( void )
|
||||
{
|
||||
m_midiPort->enableDefaultVelocityForOutEvents(
|
||||
m_defaultVelocityOutEnabledModel.value() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void instrumentMidiIO::updateMidiPortMode( void )
|
||||
{
|
||||
// this small lookup-table makes everything easier
|
||||
static const midiPort::Modes modeTable[2][2] =
|
||||
{
|
||||
{ midiPort::Disabled, midiPort::Output },
|
||||
{ midiPort::Input, midiPort::Duplex }
|
||||
} ;
|
||||
m_midiPort->setMode( modeTable[m_receiveEnabledModel.value()]
|
||||
[m_sendEnabledModel.value()] );
|
||||
|
||||
// check whether we have to dis-check items in connection-menu
|
||||
if( m_receiveEnabledModel.value() == FALSE )
|
||||
{
|
||||
for( midiPortMap::iterator it = m_readablePorts.begin();
|
||||
it != m_readablePorts.end(); ++it )
|
||||
{
|
||||
if( it->second == TRUE )
|
||||
{
|
||||
it->second = FALSE;
|
||||
activatedReadablePort( *it );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( m_sendEnabledModel.value() == FALSE )
|
||||
{
|
||||
for( midiPortMap::iterator it = m_writeablePorts.begin();
|
||||
it != m_writeablePorts.end(); ++it )
|
||||
{
|
||||
if( it->second == TRUE )
|
||||
{
|
||||
it->second = FALSE;
|
||||
activatedWriteablePort( *it );
|
||||
}
|
||||
}
|
||||
}
|
||||
engine::getSong()->setModified();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void instrumentMidiIO::updateReadablePorts( void )
|
||||
{
|
||||
// first save all selected ports
|
||||
QStringList selected_ports;
|
||||
for( midiPortMap::iterator it = m_readablePorts.begin();
|
||||
it != m_readablePorts.end(); ++it )
|
||||
{
|
||||
if( it->second == TRUE )
|
||||
{
|
||||
selected_ports.push_back( it->first );
|
||||
}
|
||||
}
|
||||
|
||||
m_readablePorts.clear();
|
||||
const QStringList & wp = engine::getMixer()->getMIDIClient()->
|
||||
readablePorts();
|
||||
// now insert new ports and restore selections
|
||||
for( QStringList::const_iterator it = wp.begin(); it != wp.end(); ++it )
|
||||
{
|
||||
m_readablePorts.push_back( qMakePair( *it,
|
||||
selected_ports.indexOf( *it ) != -1 ) );
|
||||
}
|
||||
emit readablePortsChanged();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void instrumentMidiIO::updateWriteablePorts( void )
|
||||
{
|
||||
// first save all selected ports
|
||||
QStringList selected_ports;
|
||||
for( midiPortMap::iterator it = m_writeablePorts.begin();
|
||||
it != m_writeablePorts.end(); ++it )
|
||||
{
|
||||
if( it->second == TRUE )
|
||||
{
|
||||
selected_ports.push_back( it->first );
|
||||
}
|
||||
}
|
||||
|
||||
m_writeablePorts.clear();
|
||||
const QStringList & wp = engine::getMixer()->getMIDIClient()->
|
||||
writeablePorts();
|
||||
// now insert new ports and restore selections
|
||||
for( QStringList::const_iterator it = wp.begin(); it != wp.end(); ++it )
|
||||
{
|
||||
m_writeablePorts.push_back( qMakePair( *it,
|
||||
selected_ports.indexOf( *it ) != -1 ) );
|
||||
}
|
||||
emit writeablePortsChanged();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void instrumentMidiIO::activatedReadablePort(
|
||||
const descriptiveMidiPort & _port )
|
||||
{
|
||||
// make sure, MIDI-port is configured for input
|
||||
if( _port.second == TRUE &&
|
||||
m_midiPort->mode() != midiPort::Input &&
|
||||
m_midiPort->mode() != midiPort::Duplex )
|
||||
{
|
||||
m_receiveEnabledModel.setValue( TRUE );
|
||||
}
|
||||
engine::getMixer()->getMIDIClient()->subscribeReadablePort( m_midiPort,
|
||||
_port.first, !_port.second );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void instrumentMidiIO::activatedWriteablePort(
|
||||
const descriptiveMidiPort & _port )
|
||||
{
|
||||
// make sure, MIDI-port is configured for output
|
||||
if( _port.second == TRUE &&
|
||||
m_midiPort->mode() != midiPort::Output &&
|
||||
m_midiPort->mode() != midiPort::Duplex )
|
||||
{
|
||||
m_sendEnabledModel.setValue( TRUE );
|
||||
}
|
||||
engine::getMixer()->getMIDIClient()->subscribeWriteablePort( m_midiPort,
|
||||
_port.first, !_port.second );
|
||||
}
|
||||
|
||||
|
||||
|
||||
#include "instrument_midi_io.moc"
|
||||
|
||||
|
||||
#endif
|
||||
@@ -26,23 +26,62 @@
|
||||
*/
|
||||
|
||||
|
||||
#include <Qt/QtXml>
|
||||
|
||||
#include "midi_port.h"
|
||||
#include "midi_client.h"
|
||||
#include "volume.h"
|
||||
#include "song.h"
|
||||
|
||||
|
||||
|
||||
midiPort::midiPort( midiClient * _mc, midiEventProcessor * _mep,
|
||||
const QString & _name, Modes _mode ) :
|
||||
midiPort::midiPort( const QString & _name, midiClient * _mc,
|
||||
midiEventProcessor * _mep, model * _parent,
|
||||
track * _track, Modes _mode ) :
|
||||
model( _parent ),
|
||||
m_midiClient( _mc ),
|
||||
m_midiEventProcessor( _mep ),
|
||||
m_name( _name ),
|
||||
m_mode( _mode ),
|
||||
m_inputChannel( -1 ),
|
||||
m_outputChannel( -1 ),
|
||||
m_defaultVelocityForInEventsEnabled( FALSE ),
|
||||
m_defaultVelocityForOutEventsEnabled( FALSE )
|
||||
m_inputChannelModel( 0, 0, MIDI_CHANNEL_COUNT, this ),
|
||||
m_outputChannelModel( 1, 1, MIDI_CHANNEL_COUNT, this ),
|
||||
m_inputControllerModel( 0, 0, MIDI_CONTROLLER_COUNT, this ),
|
||||
m_outputControllerModel( 0, 0, MIDI_CONTROLLER_COUNT, this ),
|
||||
m_readableModel( FALSE, this ),
|
||||
m_writableModel( FALSE, this ),
|
||||
m_defaultVelocityInEnabledModel( FALSE, this ),
|
||||
m_defaultVelocityOutEnabledModel( FALSE, this )
|
||||
{
|
||||
m_midiClient->addPort( this );
|
||||
|
||||
m_inputChannelModel.setTrack( _track );
|
||||
m_outputChannelModel.setTrack( _track );
|
||||
m_defaultVelocityInEnabledModel.setTrack( _track );
|
||||
m_defaultVelocityOutEnabledModel.setTrack( _track );
|
||||
|
||||
m_readableModel.setValue( m_mode == Input || m_mode == Duplex );
|
||||
m_writableModel.setValue( m_mode == Output || m_mode == Duplex );
|
||||
|
||||
connect( &m_readableModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updateMidiPortMode() ) );
|
||||
connect( &m_writableModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updateMidiPortMode() ) );
|
||||
|
||||
|
||||
// when using with non-raw-clients we can provide buttons showing
|
||||
// our port-menus when being clicked
|
||||
if( m_midiClient->isRaw() == FALSE )
|
||||
{
|
||||
updateReadablePorts();
|
||||
updateWriteablePorts();
|
||||
|
||||
// we want to get informed about port-changes!
|
||||
m_midiClient->connectRPChanged( this,
|
||||
SLOT( updateReadablePorts() ) );
|
||||
m_midiClient->connectWPChanged( this,
|
||||
SLOT( updateWriteablePorts() ) );
|
||||
}
|
||||
|
||||
updateMidiPortMode();
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +89,7 @@ midiPort::midiPort( midiClient * _mc, midiEventProcessor * _mep,
|
||||
|
||||
midiPort::~midiPort()
|
||||
{
|
||||
m_midiClient->removePort( this );
|
||||
}
|
||||
|
||||
|
||||
@@ -77,10 +117,10 @@ void midiPort::processInEvent( const midiEvent & _me, const midiTime & _time )
|
||||
{
|
||||
// mask event
|
||||
if( ( mode() == Input || mode() == Duplex ) &&
|
||||
( inputChannel() == _me.m_channel || inputChannel() == -1 ) )
|
||||
( inputChannel()-1 == _me.m_channel || inputChannel() == 0 ) )
|
||||
{
|
||||
midiEvent ev = _me;
|
||||
if( m_defaultVelocityForInEventsEnabled == TRUE &&
|
||||
if( m_defaultVelocityInEnabledModel.value() == TRUE &&
|
||||
_me.velocity() > 0 )
|
||||
{
|
||||
ev.velocity() = DefaultVolume;
|
||||
@@ -96,10 +136,10 @@ void midiPort::processOutEvent( const midiEvent & _me, const midiTime & _time )
|
||||
{
|
||||
// mask event
|
||||
if( ( mode() == Output || mode() == Duplex ) &&
|
||||
( outputChannel() == _me.m_channel && outputChannel() != -1 ) )
|
||||
( outputChannel()-1 == _me.m_channel && outputChannel() != 0 ) )
|
||||
{
|
||||
midiEvent ev = _me;
|
||||
if( m_defaultVelocityForOutEventsEnabled == TRUE &&
|
||||
if( m_defaultVelocityOutEnabledModel.value() == TRUE &&
|
||||
_me.velocity() > 0 )
|
||||
{
|
||||
ev.velocity() = DefaultVolume;
|
||||
@@ -110,4 +150,231 @@ void midiPort::processOutEvent( const midiEvent & _me, const midiTime & _time )
|
||||
|
||||
|
||||
|
||||
|
||||
void midiPort::saveSettings( QDomDocument & _doc, QDomElement & _this )
|
||||
{
|
||||
m_inputChannelModel.saveSettings( _doc, _this, "inputchannel" );
|
||||
m_outputChannelModel.saveSettings( _doc, _this, "outputchannel" );
|
||||
m_inputControllerModel.saveSettings( _doc, _this, "inputcontroller" );
|
||||
m_outputControllerModel.saveSettings( _doc, _this, "outputcontroller" );
|
||||
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( m_readableModel.value() == TRUE )
|
||||
{
|
||||
QString rp;
|
||||
for( midiPort::map::iterator it = m_readablePorts.begin();
|
||||
it != m_readablePorts.end(); ++it )
|
||||
{
|
||||
if( it.value() )
|
||||
{
|
||||
rp += it.key() + ",";
|
||||
}
|
||||
}
|
||||
// cut off comma
|
||||
if( rp.length() > 0 )
|
||||
{
|
||||
rp.truncate( rp.length() - 1 );
|
||||
}
|
||||
_this.setAttribute( "inports", rp );
|
||||
}
|
||||
|
||||
if( m_writableModel.value() == TRUE )
|
||||
{
|
||||
QString wp;
|
||||
for( map::const_iterator it = m_writablePorts.begin();
|
||||
it != m_writablePorts.end(); ++it )
|
||||
{
|
||||
if( it.value() )
|
||||
{
|
||||
wp += it.key() + ",";
|
||||
}
|
||||
}
|
||||
// cut off comma
|
||||
if( wp.length() > 0 )
|
||||
{
|
||||
wp.truncate( wp.length() - 1 );
|
||||
}
|
||||
_this.setAttribute( "outports", wp );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void midiPort::loadSettings( const QDomElement & _this )
|
||||
{
|
||||
m_inputChannelModel.loadSettings( _this, "inputchannel" );
|
||||
m_outputChannelModel.loadSettings( _this, "outputchannel" );
|
||||
m_inputControllerModel.loadSettings( _this, "inputcontroller" );
|
||||
m_outputControllerModel.loadSettings( _this, "outputcontroller" );
|
||||
m_readableModel.loadSettings( _this, "readable" );
|
||||
m_writableModel.loadSettings( _this, "writable" );
|
||||
m_defaultVelocityInEnabledModel.loadSettings( _this, "defvelin" );
|
||||
m_defaultVelocityOutEnabledModel.loadSettings( _this, "defvelout" );
|
||||
|
||||
// restore connections
|
||||
|
||||
if( m_readableModel.value() == TRUE )
|
||||
{
|
||||
QStringList rp = _this.attribute( "inports" ).split( ',' );
|
||||
for( map::const_iterator it = m_readablePorts.begin();
|
||||
it != m_readablePorts.end(); ++it )
|
||||
{
|
||||
if( it.value() != ( rp.indexOf( it.key() ) != -1 ) )
|
||||
{
|
||||
subscribeReadablePort( it.key() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( m_writableModel.value() == TRUE )
|
||||
{
|
||||
QStringList wp = _this.attribute( "outports" ).split( ',' );
|
||||
for( map::const_iterator it = m_writablePorts.begin();
|
||||
it != m_writablePorts.end(); ++it )
|
||||
{
|
||||
if( it.value() != ( wp.indexOf( it.key() ) != -1 ) )
|
||||
{
|
||||
subscribeReadablePort( it.key() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void midiPort::updateMidiPortMode( void )
|
||||
{
|
||||
// this small lookup-table makes everything easier
|
||||
static const Modes modeTable[2][2] =
|
||||
{
|
||||
{ Disabled, Output },
|
||||
{ Input, Duplex }
|
||||
} ;
|
||||
setMode( modeTable[m_readableModel.value()][m_writableModel.value()] );
|
||||
|
||||
// check whether we have to dis-check items in connection-menu
|
||||
if( m_readableModel.value() == FALSE )
|
||||
{
|
||||
for( map::const_iterator it = m_readablePorts.begin();
|
||||
it != m_readablePorts.end(); ++it )
|
||||
{
|
||||
if( it.value() == TRUE )
|
||||
{
|
||||
subscribeReadablePort( it.key(), FALSE );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( m_writableModel.value() == FALSE )
|
||||
{
|
||||
for( map::const_iterator it = m_writablePorts.begin();
|
||||
it != m_writablePorts.end(); ++it )
|
||||
{
|
||||
if( it.value() == TRUE )
|
||||
{
|
||||
subscribeWriteablePort( it.key(), FALSE );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
emit readablePortsChanged();
|
||||
emit writeablePortsChanged();
|
||||
emit modeChanged();
|
||||
|
||||
engine::getSong()->setModified();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void midiPort::updateReadablePorts( void )
|
||||
{
|
||||
// first save all selected ports
|
||||
QStringList selected_ports;
|
||||
for( midiPort::map::iterator it = m_readablePorts.begin();
|
||||
it != m_readablePorts.end(); ++it )
|
||||
{
|
||||
if( it.value() == TRUE )
|
||||
{
|
||||
selected_ports.push_back( it.key() );
|
||||
}
|
||||
}
|
||||
|
||||
m_readablePorts.clear();
|
||||
const QStringList & wp = engine::getMixer()->getMIDIClient()->
|
||||
readablePorts();
|
||||
// now insert new ports and restore selections
|
||||
for( QStringList::const_iterator it = wp.begin(); it != wp.end(); ++it )
|
||||
{
|
||||
m_readablePorts[*it] = ( selected_ports.indexOf( *it ) != -1 );
|
||||
}
|
||||
emit readablePortsChanged();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void midiPort::updateWriteablePorts( void )
|
||||
{
|
||||
// first save all selected ports
|
||||
QStringList selected_ports;
|
||||
for( midiPort::map::iterator it = m_writablePorts.begin();
|
||||
it != m_writablePorts.end(); ++it )
|
||||
{
|
||||
if( it.value() == TRUE )
|
||||
{
|
||||
selected_ports.push_back( it.key() );
|
||||
}
|
||||
}
|
||||
|
||||
m_writablePorts.clear();
|
||||
const QStringList & wp = engine::getMixer()->getMIDIClient()->
|
||||
writeablePorts();
|
||||
// now insert new ports and restore selections
|
||||
for( QStringList::const_iterator it = wp.begin(); it != wp.end(); ++it )
|
||||
{
|
||||
m_writablePorts[*it] = ( selected_ports.indexOf( *it ) != -1 );
|
||||
}
|
||||
emit writeablePortsChanged();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void midiPort::subscribeReadablePort( const QString & _port, bool _subscribe )
|
||||
{
|
||||
m_readablePorts[_port] = _subscribe;
|
||||
// make sure, MIDI-port is configured for input
|
||||
if( _subscribe == TRUE && mode() != Input && mode() != Duplex )
|
||||
{
|
||||
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 && mode() != Output && mode() != Duplex )
|
||||
{
|
||||
m_writableModel.setValue( TRUE );
|
||||
}
|
||||
m_midiClient->subscribeWriteablePort( this, _port, _subscribe );
|
||||
}
|
||||
|
||||
|
||||
|
||||
#include "midi_port.moc"
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -105,7 +105,7 @@ notePlayHandle::notePlayHandle( instrumentTrack * _it,
|
||||
setFrames( _frames );
|
||||
// send MIDI-note-on-event
|
||||
m_instrumentTrack->processOutEvent( midiEvent( NOTE_ON,
|
||||
m_instrumentTrack->m_midiPort->outputChannel(),
|
||||
m_instrumentTrack->m_midiPort.outputChannel(),
|
||||
key(),
|
||||
tLimit<Uint16>(
|
||||
(Uint16) ( ( getVolume() / 100.0f ) *
|
||||
@@ -303,7 +303,7 @@ void notePlayHandle::noteOff( const f_cnt_t _s )
|
||||
m_instrumentTrack->m_soundShaping.releaseFrames() );
|
||||
// send MIDI-note-off-event
|
||||
m_instrumentTrack->processOutEvent( midiEvent( NOTE_OFF,
|
||||
m_instrumentTrack->m_midiPort->outputChannel(),
|
||||
m_instrumentTrack->m_midiPort.outputChannel(),
|
||||
key(), 0 ),
|
||||
midiTime::fromFrames( m_framesBeforeRelease,
|
||||
engine::framesPerTick() ) );
|
||||
|
||||
@@ -126,7 +126,7 @@ presetPreviewPlayHandle::presetPreviewPlayHandle(
|
||||
|
||||
// make sure, our preset-preview-track does not appear in any MIDI-
|
||||
// devices list, so just disable receiving/sending MIDI-events at all
|
||||
s_previewTC->previewInstrumentTrack()->m_midiPort->setMode(
|
||||
s_previewTC->previewInstrumentTrack()->m_midiPort.setMode(
|
||||
midiPort::Disabled );
|
||||
|
||||
// create note-play-handle for it
|
||||
|
||||
@@ -117,6 +117,8 @@ song::song( void ) :
|
||||
/* connect( &m_masterPitchModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( masterPitchChanged() ) );*/
|
||||
|
||||
qRegisterMetaType<note>( "note" );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#include "group_box.h"
|
||||
#include "midi_controller.h"
|
||||
#include "midi_client.h"
|
||||
#include "midi_port.h"
|
||||
#include "midi_port_menu.h"
|
||||
#include "midi.h"
|
||||
#include "song.h"
|
||||
#include "tool_button.h"
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
m_detectedMidiChannel( 0 ),
|
||||
m_detectedMidiController( 0 )
|
||||
{
|
||||
updateMidiPort();
|
||||
updateName();
|
||||
}
|
||||
|
||||
|
||||
@@ -68,8 +68,8 @@ public:
|
||||
const midiTime & _time, bool _lock )
|
||||
{
|
||||
if( _me.m_type == CONTROL_CHANGE &&
|
||||
( m_midiChannel.value() == _me.m_channel + 1 ||
|
||||
m_midiChannel.value() == 0 ) )
|
||||
( m_midiPort.inputChannel() == _me.m_channel + 1 ||
|
||||
m_midiPort.inputChannel() == 0 ) )
|
||||
{
|
||||
m_detectedMidiChannel = _me.m_channel + 1;
|
||||
m_detectedMidiController = ( _me.m_data.m_bytes[0] & 0x7F ) + 1;
|
||||
@@ -87,9 +87,9 @@ public:
|
||||
midiController * copyToMidiController( model * _parent )
|
||||
{
|
||||
midiController * c = new midiController( _parent );
|
||||
c->midiChannelModel()->setValue( m_midiChannel.value() );
|
||||
c->midiControllerModel()->setValue( m_midiController.value() );
|
||||
c->setReadablePorts( m_readablePorts );
|
||||
c->m_midiPort.setInputChannel( m_midiPort.inputChannel() );
|
||||
c->m_midiPort.setInputController( m_midiPort.inputController() );
|
||||
c->subscribeReadablePorts( m_midiPort.readablePorts() );
|
||||
|
||||
return c;
|
||||
}
|
||||
@@ -97,16 +97,16 @@ public:
|
||||
|
||||
void useDetected( void )
|
||||
{
|
||||
m_midiChannel.setValue( m_detectedMidiChannel );
|
||||
m_midiController.setValue( m_detectedMidiController );
|
||||
m_midiPort.setInputChannel( m_detectedMidiChannel );
|
||||
m_midiPort.setInputController( m_detectedMidiController );
|
||||
}
|
||||
|
||||
|
||||
public slots:
|
||||
void reset( void )
|
||||
{
|
||||
m_midiChannel.setValue( 0 );
|
||||
m_midiController.setValue( 0 );
|
||||
m_midiPort.setInputChannel( 0 );
|
||||
m_midiPort.setInputController( 0 );
|
||||
}
|
||||
|
||||
};
|
||||
@@ -162,14 +162,9 @@ controllerConnectionDialog::controllerConnectionDialog( QWidget * _parent,
|
||||
|
||||
// when using with non-raw-clients we can provide buttons showing
|
||||
// our port-menus when being clicked
|
||||
midiClient * mc = engine::getMixer()->getMIDIClient();
|
||||
if( mc->isRaw() == FALSE )
|
||||
if( !engine::getMixer()->getMIDIClient()->isRaw() )
|
||||
{
|
||||
m_readablePorts = new QMenu( this );
|
||||
m_readablePorts->setFont( pointSize<9>(
|
||||
m_readablePorts->font() ) );
|
||||
connect( m_readablePorts, SIGNAL( triggered( QAction * ) ),
|
||||
this, SLOT( activatedReadablePort( QAction * ) ) );
|
||||
m_readablePorts = new midiPortMenu( midiPort::Input );
|
||||
|
||||
toolButton * rp_btn = new toolButton( m_midiGroupBox );
|
||||
rp_btn->setText( tr( "MIDI-devices to receive "
|
||||
@@ -251,13 +246,11 @@ controllerConnectionDialog::controllerConnectionDialog( QWidget * _parent,
|
||||
midiController * cont =
|
||||
(midiController*)( cc->getController() );
|
||||
m_midiChannelSpinBox->model()->setValue(
|
||||
cont->midiChannelModel()->value() );
|
||||
cont->m_midiPort.inputChannel() );
|
||||
m_midiControllerSpinBox->model()->setValue(
|
||||
cont->midiControllerModel()->value() );
|
||||
cont->m_midiPort.inputController() );
|
||||
|
||||
// update menuupdateReadablePortsMenu
|
||||
m_midiController->setReadablePorts( static_cast<midiController*>( cc->getController() )->m_readablePorts );
|
||||
updateReadablePortsMenu();
|
||||
m_midiController->subscribeReadablePorts( static_cast<midiController*>( cc->getController() )->m_midiPort.readablePorts() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -307,13 +300,13 @@ void controllerConnectionDialog::selectController( void )
|
||||
if( m_targetModel->getTrack() &&
|
||||
!m_targetModel->getTrack()->displayName().isEmpty() )
|
||||
{
|
||||
mc->getMidiPort()->setName( QString( "%1 (%2)" ).
|
||||
mc->m_midiPort.setName( QString( "%1 (%2)" ).
|
||||
arg( m_targetModel->getTrack()->displayName() ).
|
||||
arg( m_targetModel->displayName() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
mc->getMidiPort()->setName( m_targetModel->displayName() );
|
||||
mc->m_midiPort.setName( m_targetModel->displayName() );
|
||||
}
|
||||
m_controller = mc;
|
||||
}
|
||||
@@ -348,15 +341,14 @@ void controllerConnectionDialog::midiToggled( void )
|
||||
{
|
||||
m_midiController = new autoDetectMidiController( engine::getSong() );
|
||||
m_midiChannelSpinBox->setModel(
|
||||
m_midiController->midiChannelModel() );
|
||||
&m_midiController->m_midiPort.m_inputChannelModel );
|
||||
m_midiControllerSpinBox->setModel(
|
||||
m_midiController->midiControllerModel() );
|
||||
&m_midiController->m_midiPort.m_inputControllerModel );
|
||||
m_readablePorts->setModel( &m_midiController->m_midiPort );
|
||||
|
||||
|
||||
connect( m_midiController, SIGNAL( valueChanged() ),
|
||||
this, SLOT( midiValueChanged() ) );
|
||||
|
||||
updateReadablePortsMenu();
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -410,39 +402,6 @@ void controllerConnectionDialog::midiValueChanged( void )
|
||||
|
||||
|
||||
|
||||
void controllerConnectionDialog::activatedReadablePort( QAction * _item )
|
||||
{
|
||||
// make sure, MIDI-port is configured for input
|
||||
if( _item->isChecked() == TRUE &&
|
||||
m_midiController->m_midiPort->mode() != midiPort::Input &&
|
||||
m_midiController->m_midiPort->mode() != midiPort::Duplex )
|
||||
{
|
||||
//mio->m_receiveEnabledModel.setValue( TRUE );
|
||||
}
|
||||
engine::getMixer()->getMIDIClient()->subscribeReadablePort(
|
||||
m_midiController->m_midiPort, _item->text(), !_item->isChecked() );
|
||||
m_midiController->m_readablePorts[_item->text()] = _item->isChecked();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void controllerConnectionDialog::updateReadablePortsMenu( void )
|
||||
{
|
||||
if( m_readablePorts )
|
||||
{
|
||||
m_readablePorts->clear();
|
||||
for( midiController::midiPortMap::const_iterator it =
|
||||
m_midiController->m_readablePorts.begin();
|
||||
it != m_midiController->m_readablePorts.end(); ++it )
|
||||
{
|
||||
QAction * a = m_readablePorts->addAction( it.key() );
|
||||
a->setCheckable( TRUE );
|
||||
a->setChecked( *it );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#include "controller_connection_dialog.moc"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -515,7 +515,7 @@ void pianoRoll::setCurrentPattern( pattern * _new_pattern )
|
||||
// of start-notes and so on...)
|
||||
resizeEvent( NULL );
|
||||
|
||||
// remove all connections to other channel-tracks
|
||||
// remove all connections to other instrument-tracks
|
||||
disconnect( this, SLOT( recordNote( const note & ) ) );
|
||||
|
||||
// and now connect to noteDone()-signal of channel so that
|
||||
|
||||
@@ -30,13 +30,9 @@
|
||||
|
||||
|
||||
#include "instrument_midi_io_view.h"
|
||||
#include "instrument_midi_io.h"
|
||||
#include "midi_port_menu.h"
|
||||
#include "embed.h"
|
||||
#include "engine.h"
|
||||
#include "gui_templates.h"
|
||||
#include "midi_client.h"
|
||||
#include "midi_port.h"
|
||||
#include "mixer.h"
|
||||
#include "led_checkbox.h"
|
||||
#include "lcd_spinbox.h"
|
||||
#include "tab_widget.h"
|
||||
@@ -44,11 +40,12 @@
|
||||
|
||||
|
||||
|
||||
instrumentMidiIOView::instrumentMidiIOView( QWidget * _parent ) :
|
||||
instrumentMidiIOView::instrumentMidiIOView(
|
||||
midiPortMenu * _readable_ports_menu,
|
||||
midiPortMenu * _writable_ports_menu,
|
||||
QWidget * _parent ) :
|
||||
QWidget( _parent ),
|
||||
modelView( NULL ),
|
||||
m_readablePorts( NULL ),
|
||||
m_writeablePorts( NULL )
|
||||
modelView( NULL )
|
||||
{
|
||||
m_setupTabWidget = new tabWidget( tr( "MIDI-SETUP FOR THIS CHANNEL" ),
|
||||
this );
|
||||
@@ -101,38 +98,24 @@ instrumentMidiIOView::instrumentMidiIOView( QWidget * _parent ) :
|
||||
m_defaultVelocityOutCheckBox->move( 28, 164 );
|
||||
|
||||
|
||||
|
||||
// when using with non-raw-clients we can provide buttons showing
|
||||
// our port-menus when being clicked
|
||||
midiClient * mc = engine::getMixer()->getMIDIClient();
|
||||
if( mc->isRaw() == FALSE )
|
||||
if( _readable_ports_menu != NULL )
|
||||
{
|
||||
m_readablePorts = new QMenu( m_setupTabWidget );
|
||||
m_readablePorts->setFont( pointSize<9>(
|
||||
m_readablePorts->font() ) );
|
||||
connect( m_readablePorts, SIGNAL( triggered( QAction * ) ),
|
||||
this, SLOT( activatedReadablePort( QAction * ) ) );
|
||||
|
||||
m_writeablePorts = new QMenu( m_setupTabWidget );
|
||||
m_writeablePorts->setFont( pointSize<9>(
|
||||
m_writeablePorts->font() ) );
|
||||
connect( m_writeablePorts, SIGNAL( triggered( QAction * ) ),
|
||||
this, SLOT( activatedWriteablePort( QAction * ) ) );
|
||||
|
||||
QToolButton * rp_btn = new QToolButton( m_setupTabWidget );
|
||||
rp_btn->setText( tr( "MIDI-devices to receive "
|
||||
"MIDI-events from" ) );
|
||||
rp_btn->setIcon( embed::getIconPixmap( "midi_in" ) );
|
||||
rp_btn->setGeometry( 186, 34, 40, 40 );
|
||||
rp_btn->setMenu( m_readablePorts );
|
||||
rp_btn->setMenu( _readable_ports_menu );
|
||||
rp_btn->setPopupMode( QToolButton::InstantPopup );
|
||||
|
||||
}
|
||||
if( _writable_ports_menu != NULL )
|
||||
{
|
||||
QToolButton * wp_btn = new QToolButton( m_setupTabWidget );
|
||||
wp_btn->setText( tr( "MIDI-devices to send MIDI-events "
|
||||
"to" ) );
|
||||
wp_btn->setIcon( embed::getIconPixmap( "midi_out" ) );
|
||||
wp_btn->setGeometry( 186, 114, 40, 40 );
|
||||
wp_btn->setMenu( m_writeablePorts );
|
||||
wp_btn->setMenu( _writable_ports_menu );
|
||||
wp_btn->setPopupMode( QToolButton::InstantPopup );
|
||||
}
|
||||
}
|
||||
@@ -149,101 +132,16 @@ instrumentMidiIOView::~instrumentMidiIOView()
|
||||
|
||||
void instrumentMidiIOView::modelChanged( void )
|
||||
{
|
||||
instrumentMidiIO * mio = castModel<instrumentMidiIO>();
|
||||
m_inputChannelSpinBox->setModel( &mio->m_inputChannelModel );
|
||||
m_outputChannelSpinBox->setModel( &mio->m_outputChannelModel );
|
||||
m_receiveCheckBox->setModel( &mio->m_receiveEnabledModel );
|
||||
midiPort * mp = castModel<midiPort>();
|
||||
m_inputChannelSpinBox->setModel( &mp->m_inputChannelModel );
|
||||
m_outputChannelSpinBox->setModel( &mp->m_outputChannelModel );
|
||||
m_receiveCheckBox->setModel( &mp->m_readableModel );
|
||||
m_defaultVelocityInCheckBox->setModel(
|
||||
&mio->m_defaultVelocityInEnabledModel );
|
||||
m_sendCheckBox->setModel( &mio->m_sendEnabledModel );
|
||||
&mp->m_defaultVelocityInEnabledModel );
|
||||
m_sendCheckBox->setModel( &mp->m_writableModel );
|
||||
m_defaultVelocityOutCheckBox->setModel(
|
||||
&mio->m_defaultVelocityOutEnabledModel );
|
||||
connect( mio, SIGNAL( readablePortsChanged() ),
|
||||
this, SLOT( updateReadablePortsMenu() ) );
|
||||
connect( mio, SIGNAL( writeablePortsChanged() ),
|
||||
this, SLOT( updateWriteablePortsMenu() ) );
|
||||
updateReadablePortsMenu();
|
||||
updateWriteablePortsMenu();
|
||||
&mp->m_defaultVelocityOutEnabledModel );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void instrumentMidiIOView::activatedReadablePort( QAction * _item )
|
||||
{
|
||||
instrumentMidiIO * mio = castModel<instrumentMidiIO>();
|
||||
// make sure, MIDI-port is configured for input
|
||||
if( _item->isChecked() == TRUE &&
|
||||
mio->m_midiPort->mode() != midiPort::Input &&
|
||||
mio->m_midiPort->mode() != midiPort::Duplex )
|
||||
{
|
||||
mio->m_receiveEnabledModel.setValue( TRUE );
|
||||
}
|
||||
engine::getMixer()->getMIDIClient()->subscribeReadablePort(
|
||||
mio->m_midiPort, _item->text(), !_item->isChecked() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void instrumentMidiIOView::activatedWriteablePort( QAction * _item )
|
||||
{
|
||||
instrumentMidiIO * mio = castModel<instrumentMidiIO>();
|
||||
// make sure, MIDI-port is configured for output
|
||||
if( _item->isChecked() == TRUE &&
|
||||
mio->m_midiPort->mode() != midiPort::Output &&
|
||||
mio->m_midiPort->mode() != midiPort::Duplex )
|
||||
{
|
||||
mio->m_sendEnabledModel.setValue( TRUE );
|
||||
}
|
||||
engine::getMixer()->getMIDIClient()->subscribeWriteablePort(
|
||||
mio->m_midiPort, _item->text(), !_item->isChecked() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void instrumentMidiIOView::updateReadablePortsMenu( void )
|
||||
{
|
||||
instrumentMidiIO * mio = castModel<instrumentMidiIO>();
|
||||
if( m_readablePorts )
|
||||
{
|
||||
m_readablePorts->clear();
|
||||
for( instrumentMidiIO::midiPortMap::const_iterator it =
|
||||
mio->m_readablePorts.begin();
|
||||
it != mio->m_readablePorts.end(); ++it )
|
||||
{
|
||||
QAction * a = m_readablePorts->addAction( it->first );
|
||||
a->setCheckable( TRUE );
|
||||
a->setChecked( it->second );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void instrumentMidiIOView::updateWriteablePortsMenu( void )
|
||||
{
|
||||
instrumentMidiIO * mio = castModel<instrumentMidiIO>();
|
||||
if( m_writeablePorts )
|
||||
{
|
||||
m_writeablePorts->clear();
|
||||
for( instrumentMidiIO::midiPortMap::const_iterator it =
|
||||
mio->m_writeablePorts.begin();
|
||||
it != mio->m_writeablePorts.end(); ++it )
|
||||
{
|
||||
QAction * a = m_writeablePorts->addAction( it->first );
|
||||
a->setCheckable( TRUE );
|
||||
a->setChecked( it->second );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#include "instrument_midi_io_view.moc"
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -63,9 +63,8 @@
|
||||
#include "led_checkbox.h"
|
||||
#include "main_window.h"
|
||||
#include "midi_client.h"
|
||||
#include "midi_port.h"
|
||||
#include "midi_port_menu.h"
|
||||
#include "fx_mixer.h"
|
||||
#include "instrument_midi_io.h"
|
||||
#include "mmp.h"
|
||||
#include "note_play_handle.h"
|
||||
#include "pattern.h"
|
||||
@@ -104,19 +103,20 @@ const int INSTRUMENT_WINDOW_CACHE_SIZE = 8;
|
||||
instrumentTrack::instrumentTrack( trackContainer * _tc ) :
|
||||
track( InstrumentTrack, _tc ),
|
||||
midiEventProcessor(),
|
||||
m_midiPort( engine::getMixer()->getMIDIClient()->addPort( this,
|
||||
tr( "unnamed_channel" ) ) ),
|
||||
m_audioPort( tr( "unnamed_channel" ), this ),
|
||||
m_audioPort( tr( "unnamed_track" ), this ),
|
||||
m_midiPort( tr( "unnamed_track" ), engine::getMixer()->getMIDIClient(),
|
||||
this, this, this ),
|
||||
m_notes(),
|
||||
m_baseNoteModel( 0, 0, KeysPerOctave * NumOctaves - 1, this ),
|
||||
m_volumeModel( DefaultVolume, MinVolume, MaxVolume, 1.0f, this, tr( "Volume" ) ),
|
||||
m_panningModel( DefaultPanning, PanningLeft, PanningRight, 1.0f, this, tr( "Panning" ) ),
|
||||
m_volumeModel( DefaultVolume, MinVolume, MaxVolume, 1.0f, this,
|
||||
tr( "Volume" ) ),
|
||||
m_panningModel( DefaultPanning, PanningLeft, PanningRight, 1.0f,
|
||||
this, tr( "Panning" ) ),
|
||||
m_effectChannelModel( 0, 0, NumFxChannels, this ),
|
||||
m_instrument( NULL ),
|
||||
m_soundShaping( this ),
|
||||
m_arpeggiator( this ),
|
||||
m_chordCreator( this ),
|
||||
m_midiIO( this, m_midiPort ),
|
||||
m_piano( this )
|
||||
{
|
||||
m_baseNoteModel.setTrack( this );
|
||||
@@ -145,7 +145,6 @@ instrumentTrack::instrumentTrack( trackContainer * _tc ) :
|
||||
instrumentTrack::~instrumentTrack()
|
||||
{
|
||||
engine::getMixer()->removePlayHandles( this );
|
||||
engine::getMixer()->getMIDIClient()->removePort( m_midiPort );
|
||||
delete m_instrument;
|
||||
}
|
||||
|
||||
@@ -339,7 +338,7 @@ void instrumentTrack::processOutEvent( const midiEvent & _me,
|
||||
break;
|
||||
}
|
||||
// if appropriate, midi-port does futher routing
|
||||
m_midiPort->processOutEvent( _me, _time );
|
||||
m_midiPort.processOutEvent( _me, _time );
|
||||
}
|
||||
|
||||
|
||||
@@ -466,7 +465,7 @@ void instrumentTrack::setName( const QString & _new_name )
|
||||
}
|
||||
|
||||
track::setName( _new_name );
|
||||
m_midiPort->setName( name() );
|
||||
m_midiPort.setName( name() );
|
||||
m_audioPort.setName( name() );
|
||||
|
||||
emit nameChanged();
|
||||
@@ -675,7 +674,7 @@ void instrumentTrack::saveTrackSpecificSettings( QDomDocument & _doc,
|
||||
m_soundShaping.saveState( _doc, _this );
|
||||
m_chordCreator.saveState( _doc, _this );
|
||||
m_arpeggiator.saveState( _doc, _this );
|
||||
m_midiIO.saveState( _doc, _this );
|
||||
m_midiPort.saveState( _doc, _this );
|
||||
m_audioPort.getEffects()->saveState( _doc, _this );
|
||||
if( getHook() )
|
||||
{
|
||||
@@ -743,9 +742,9 @@ void instrumentTrack::loadTrackSpecificSettings( const QDomElement & _this )
|
||||
{
|
||||
m_arpeggiator.restoreState( node.toElement() );
|
||||
}
|
||||
else if( m_midiIO.nodeName() == node.nodeName() )
|
||||
else if( m_midiPort.nodeName() == node.nodeName() )
|
||||
{
|
||||
m_midiIO.restoreState( node.toElement() );
|
||||
m_midiPort.restoreState( node.toElement() );
|
||||
}
|
||||
else if( m_audioPort.getEffects()->nodeName() ==
|
||||
node.nodeName() )
|
||||
@@ -830,7 +829,9 @@ QQueue<instrumentTrackWindow *> instrumentTrackView::s_windows;
|
||||
instrumentTrackView::instrumentTrackView( instrumentTrack * _it,
|
||||
trackContainerView * _tcv ) :
|
||||
trackView( _it, _tcv ),
|
||||
m_window( NULL )
|
||||
m_window( NULL ),
|
||||
m_readablePortsMenu( NULL ),
|
||||
m_writablePortsMenu( NULL )
|
||||
{
|
||||
setAcceptDrops( TRUE );
|
||||
setFixedHeight( 32 );
|
||||
@@ -854,6 +855,32 @@ instrumentTrackView::instrumentTrackView( instrumentTrack * _it,
|
||||
m_tswMidiMenu = new QMenu( tsw_midi );
|
||||
tsw_midi->setMenu( m_tswMidiMenu );
|
||||
|
||||
// sequenced MIDI?
|
||||
if( !engine::getMixer()->getMIDIClient()->isRaw() )
|
||||
{
|
||||
m_readablePortsMenu = new midiPortMenu( midiPort::Input );
|
||||
m_writablePortsMenu = new midiPortMenu( midiPort::Output );
|
||||
m_readablePortsMenu->setModel( &_it->m_midiPort );
|
||||
m_writablePortsMenu->setModel( &_it->m_midiPort );
|
||||
m_midiInputAction = m_tswMidiMenu->addMenu(
|
||||
m_readablePortsMenu );
|
||||
m_midiOutputAction = m_tswMidiMenu->addMenu(
|
||||
m_writablePortsMenu );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_midiInputAction = m_tswMidiMenu->addAction( "" );
|
||||
connect( m_midiInputAction, SIGNAL( changed() ), this,
|
||||
SLOT( midiInSelected() ) );
|
||||
m_midiOutputAction = m_tswMidiMenu->addAction( "" );
|
||||
connect( m_midiOutputAction, SIGNAL( changed() ), this,
|
||||
SLOT( midiOutSelected() ) );
|
||||
connect( &_it->m_midiPort, SIGNAL( modeChanged() ),
|
||||
this, SLOT( midiConfigChanged() ) );
|
||||
}
|
||||
|
||||
m_midiInputAction->setText( tr( "MIDI input" ) );
|
||||
m_midiOutputAction->setText( tr( "MIDI output" ) );
|
||||
|
||||
m_tswActivityIndicator = new fadeButton( QColor( 96, 96, 96 ),
|
||||
QColor( 255, 204, 0 ),
|
||||
@@ -871,41 +898,6 @@ instrumentTrackView::instrumentTrackView( instrumentTrack * _it,
|
||||
m_tswInstrumentTrackButton->setGeometry( 64, 2, 144, 28 );
|
||||
m_tswInstrumentTrackButton->show();
|
||||
|
||||
/* if( m_midiWidget->m_readablePorts )
|
||||
{
|
||||
m_midiInputAction = m_tswMidiMenu->addMenu(
|
||||
m_midiWidget->m_readablePorts );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_midiInputAction = m_tswMidiMenu->addAction( "" );
|
||||
connect( m_midiInputAction, SIGNAL( changed() ), this,
|
||||
SLOT( midiInSelected() ) );
|
||||
}
|
||||
if( m_midiWidget->m_writeablePorts )
|
||||
{
|
||||
m_midiOutputAction = m_tswMidiMenu->addMenu(
|
||||
m_midiWidget->m_writeablePorts );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_midiOutputAction = m_tswMidiMenu->addAction( "" );
|
||||
connect( m_midiOutputAction, SIGNAL( changed() ), this,
|
||||
SLOT( midiOutSelected() ) );
|
||||
}
|
||||
m_midiInputAction->setText( tr( "MIDI input" ) );
|
||||
m_midiOutputAction->setText( tr( "MIDI output" ) );
|
||||
if( m_midiWidget->m_readablePorts == NULL ||
|
||||
m_midiWidget->m_writeablePorts == NULL )
|
||||
{
|
||||
connect( m_midiWidget->m_sendCheckBox,
|
||||
SIGNAL( toggled( bool ) ),
|
||||
this, SLOT( midiConfigChanged( bool ) ) );
|
||||
connect( m_midiWidget->m_receiveCheckBox,
|
||||
SIGNAL( toggled( bool ) ),
|
||||
this, SLOT( midiConfigChanged( bool ) ) );
|
||||
}*/
|
||||
|
||||
setModel( _it );
|
||||
|
||||
connect( m_tswInstrumentTrackButton, SIGNAL( toggled( bool ) ),
|
||||
@@ -1029,6 +1021,36 @@ void instrumentTrackView::updateName( void )
|
||||
|
||||
|
||||
|
||||
|
||||
void instrumentTrackView::midiInSelected( void )
|
||||
{
|
||||
m_midiInputAction->setChecked( !m_midiInputAction->isChecked() );
|
||||
model()->m_midiPort.setReadable( m_midiInputAction->isChecked() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void instrumentTrackView::midiOutSelected( void )
|
||||
{
|
||||
m_midiOutputAction->setChecked( !m_midiOutputAction->isChecked() );
|
||||
model()->m_midiPort.setWritable( m_midiOutputAction->isChecked() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void instrumentTrackView::midiConfigChanged( void )
|
||||
{
|
||||
m_midiInputAction->setChecked( model()->m_midiPort.isReadable() );
|
||||
m_midiOutputAction->setChecked( model()->m_midiPort.isWritable() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class fxLineLcdSpinBox : public lcdSpinBox
|
||||
{
|
||||
public:
|
||||
@@ -1052,9 +1074,7 @@ instrumentTrackWindow::instrumentTrackWindow( instrumentTrackView * _itv ) :
|
||||
modelView( NULL ),
|
||||
m_track( _itv->model() ),
|
||||
m_itv( _itv ),
|
||||
m_instrumentView( NULL ),
|
||||
m_midiInputAction( NULL ),
|
||||
m_midiOutputAction( NULL )
|
||||
m_instrumentView( NULL )
|
||||
{
|
||||
setAcceptDrops( TRUE );
|
||||
|
||||
@@ -1130,7 +1150,9 @@ instrumentTrackWindow::instrumentTrackWindow( instrumentTrackView * _itv ) :
|
||||
instrument_functions );
|
||||
m_arpView= new arpeggiatorView( &m_track->m_arpeggiator,
|
||||
instrument_functions );
|
||||
m_midiView = new instrumentMidiIOView( m_tabWidget );
|
||||
m_midiView = new instrumentMidiIOView( m_itv->m_readablePortsMenu,
|
||||
m_itv->m_writablePortsMenu,
|
||||
m_tabWidget );
|
||||
m_effectView = new effectRackView( m_track->m_audioPort.getEffects(),
|
||||
m_tabWidget );
|
||||
m_tabWidget->addTab( m_ssView, tr( "ENV/LFO" ), 1 );
|
||||
@@ -1146,40 +1168,6 @@ instrumentTrackWindow::instrumentTrackWindow( instrumentTrackView * _itv ) :
|
||||
vlayout->addWidget( m_tabWidget );
|
||||
vlayout->addWidget( m_pianoView );
|
||||
|
||||
if( m_midiView->m_readablePorts )
|
||||
{
|
||||
m_midiInputAction = m_itv->m_tswMidiMenu->addMenu(
|
||||
m_midiView->m_readablePorts );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_midiInputAction = m_itv->m_tswMidiMenu->addAction( "" );
|
||||
connect( m_midiInputAction, SIGNAL( changed() ), this,
|
||||
SLOT( midiInSelected() ) );
|
||||
}
|
||||
if( m_midiView->m_writeablePorts )
|
||||
{
|
||||
m_midiOutputAction = m_itv->m_tswMidiMenu->addMenu(
|
||||
m_midiView->m_writeablePorts );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_midiOutputAction = m_itv->m_tswMidiMenu->addAction( "" );
|
||||
connect( m_midiOutputAction, SIGNAL( changed() ), this,
|
||||
SLOT( midiOutSelected() ) );
|
||||
}
|
||||
m_midiInputAction->setText( tr( "MIDI input" ) );
|
||||
m_midiOutputAction->setText( tr( "MIDI output" ) );
|
||||
if( m_midiView->m_readablePorts == NULL ||
|
||||
m_midiView->m_writeablePorts == NULL )
|
||||
{
|
||||
connect( m_midiView->m_sendCheckBox,
|
||||
SIGNAL( toggled( bool ) ),
|
||||
this, SLOT( midiConfigChanged( bool ) ) );
|
||||
connect( m_midiView->m_receiveCheckBox,
|
||||
SIGNAL( toggled( bool ) ),
|
||||
this, SLOT( midiConfigChanged( bool ) ) );
|
||||
}
|
||||
|
||||
setModel( _itv->model() );
|
||||
|
||||
@@ -1241,9 +1229,18 @@ void instrumentTrackWindow::modelChanged( void )
|
||||
m_ssView->setModel( &m_track->m_soundShaping );
|
||||
m_chordView->setModel( &m_track->m_chordCreator );
|
||||
m_arpView->setModel( &m_track->m_arpeggiator );
|
||||
m_midiView->setModel( &m_track->m_midiIO );
|
||||
m_midiView->setModel( &m_track->m_midiPort );
|
||||
m_effectView->setModel( m_track->m_audioPort.getEffects() );
|
||||
updateName();
|
||||
|
||||
if( m_itv->m_readablePortsMenu != NULL )
|
||||
{
|
||||
m_itv->m_readablePortsMenu->setModel( &m_track->m_midiPort );
|
||||
}
|
||||
if( m_itv->m_writablePortsMenu != NULL )
|
||||
{
|
||||
m_itv->m_writablePortsMenu->setModel( &m_track->m_midiPort );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1435,32 +1432,6 @@ void instrumentTrackWindow::loadSettings( const QDomElement & _this )
|
||||
|
||||
|
||||
|
||||
void instrumentTrackWindow::midiInSelected( void )
|
||||
{
|
||||
m_midiInputAction->setChecked( !m_midiInputAction->isChecked() );
|
||||
m_midiView->m_receiveCheckBox->setChecked(
|
||||
m_midiInputAction->isChecked() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
void instrumentTrackWindow::midiOutSelected( void )
|
||||
{
|
||||
m_midiOutputAction->setChecked( !m_midiOutputAction->isChecked() );
|
||||
m_midiView->m_sendCheckBox->setChecked(
|
||||
m_midiOutputAction->isChecked() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void instrumentTrackWindow::midiConfigChanged( bool )
|
||||
{
|
||||
m_midiInputAction->setChecked(
|
||||
m_midiView->m_receiveCheckBox->model()->value() );
|
||||
m_midiOutputAction->setChecked(
|
||||
m_midiView->m_sendCheckBox->model()->value() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user