Handle automation on processing thread (#4692)
This commit is contained in:
committed by
Hyunjin Song
parent
a8828d332c
commit
2070ef21f5
@@ -41,6 +41,10 @@ public:
|
||||
m_displayName( _display_name ),
|
||||
m_defaultConstructed( _default_constructed )
|
||||
{
|
||||
#if QT_VERSION < 0x050000
|
||||
connect( this, SIGNAL( dataChanged() ), this,
|
||||
SLOT( thisDataChanged() ), Qt::DirectConnection );
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual ~Model()
|
||||
@@ -85,6 +89,19 @@ signals:
|
||||
// emitted if properties of the model (e.g. ranges) have changed
|
||||
void propertiesChanged();
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
// emitted along with dataChanged(), but with this model as an argument
|
||||
// workaround for when QObject::sender() and Qt5 are unavailable
|
||||
void dataChanged( Model * );
|
||||
|
||||
private slots:
|
||||
void thisDataChanged()
|
||||
{
|
||||
emit dataChanged( this );
|
||||
}
|
||||
|
||||
signals:
|
||||
#endif
|
||||
} ;
|
||||
|
||||
|
||||
|
||||
@@ -90,7 +90,13 @@ void VstEffectControls::loadSettings( const QDomElement & _this )
|
||||
knobFModel[ i ]->setInitValue(LocaleHelper::toFloat(s_dumpValues.at(2)));
|
||||
}
|
||||
|
||||
connect( knobFModel[i], SIGNAL( dataChanged() ), this, SLOT( setParameter() ) );
|
||||
#if QT_VERSION < 0x050000
|
||||
connect( knobFModel[i], SIGNAL( dataChanged( Model * ) ),
|
||||
this, SLOT( setParameter( Model * ) ), Qt::DirectConnection );
|
||||
#else
|
||||
connect( knobFModel[i], &FloatModel::dataChanged, this,
|
||||
[this, i]() { setParameter( knobFModel[i] ); }, Qt::DirectConnection);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
@@ -100,10 +106,8 @@ void VstEffectControls::loadSettings( const QDomElement & _this )
|
||||
|
||||
|
||||
|
||||
void VstEffectControls::setParameter( void )
|
||||
void VstEffectControls::setParameter( Model * action )
|
||||
{
|
||||
|
||||
Model *action = qobject_cast<Model *>(sender());
|
||||
int knobUNID = action->displayName().toInt();
|
||||
|
||||
if ( m_effect->m_plugin != NULL ) {
|
||||
@@ -385,9 +389,16 @@ manageVSTEffectView::manageVSTEffectView( VstEffect * _eff, VstEffectControls *
|
||||
m_vi->knobFModel[ i ] = new FloatModel( LocaleHelper::toFloat(s_dumpValues.at(2)),
|
||||
0.0f, 1.0f, 0.01f, _eff, tr( paramStr ) );
|
||||
}
|
||||
connect( m_vi->knobFModel[ i ], SIGNAL( dataChanged() ), this,
|
||||
SLOT( setParameter() ) );
|
||||
vstKnobs[ i ] ->setModel( m_vi->knobFModel[ i ] );
|
||||
|
||||
FloatModel * model = m_vi->knobFModel[i];
|
||||
#if QT_VERSION < 0x050000
|
||||
connect( model, SIGNAL( dataChanged( Model * ) ), this,
|
||||
SLOT( setParameter( Model * ) ), Qt::DirectConnection );
|
||||
#else
|
||||
connect( model, &FloatModel::dataChanged, this,
|
||||
[this, model]() { setParameter( model ); }, Qt::DirectConnection);
|
||||
#endif
|
||||
vstKnobs[ i ] ->setModel( model );
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
@@ -480,10 +491,8 @@ void manageVSTEffectView::displayAutomatedOnly( void )
|
||||
|
||||
|
||||
|
||||
void manageVSTEffectView::setParameter( void )
|
||||
void manageVSTEffectView::setParameter( Model * action )
|
||||
{
|
||||
|
||||
Model *action = qobject_cast<Model *>(sender());
|
||||
int knobUNID = action->displayName().toInt();
|
||||
|
||||
if ( m_effect->m_plugin != NULL ) {
|
||||
|
||||
@@ -70,7 +70,7 @@ protected slots:
|
||||
void rollPreset( void );
|
||||
void rolrPreset( void );
|
||||
void selPreset( void );
|
||||
void setParameter( void );
|
||||
void setParameter( Model * action );
|
||||
|
||||
protected:
|
||||
virtual void paintEvent( QPaintEvent * _pe );
|
||||
@@ -110,7 +110,7 @@ public:
|
||||
protected slots:
|
||||
void syncPlugin( void );
|
||||
void displayAutomatedOnly( void );
|
||||
void setParameter( void );
|
||||
void setParameter( Model * action );
|
||||
void closeWindow();
|
||||
|
||||
private:
|
||||
|
||||
@@ -209,7 +209,13 @@ void vestigeInstrument::loadSettings( const QDomElement & _this )
|
||||
knobFModel[ i ]->setInitValue(LocaleHelper::toFloat(s_dumpValues.at(2)));
|
||||
}
|
||||
|
||||
connect( knobFModel[i], SIGNAL( dataChanged() ), this, SLOT( setParameter() ) );
|
||||
#if QT_VERSION < 0x050000
|
||||
connect( knobFModel[i], SIGNAL( dataChanged( Model * ) ),
|
||||
this, SLOT( setParameter( Model * ) ), Qt::DirectConnection );
|
||||
#else
|
||||
connect( knobFModel[i], &FloatModel::dataChanged, this,
|
||||
[this, i]() { setParameter( knobFModel[i] ); }, Qt::DirectConnection);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
m_pluginMutex.unlock();
|
||||
@@ -218,10 +224,8 @@ void vestigeInstrument::loadSettings( const QDomElement & _this )
|
||||
|
||||
|
||||
|
||||
void vestigeInstrument::setParameter( void )
|
||||
void vestigeInstrument::setParameter( Model * action )
|
||||
{
|
||||
|
||||
Model *action = qobject_cast<Model *>(sender());
|
||||
int knobUNID = action->displayName().toInt();
|
||||
|
||||
if ( m_plugin != NULL ) {
|
||||
@@ -996,8 +1000,16 @@ manageVestigeInstrumentView::manageVestigeInstrumentView( Instrument * _instrume
|
||||
m_vi->knobFModel[ i ] = new FloatModel( LocaleHelper::toFloat(s_dumpValues.at(2)),
|
||||
0.0f, 1.0f, 0.01f, castModel<vestigeInstrument>(), tr( paramStr ) );
|
||||
}
|
||||
connect( m_vi->knobFModel[i], SIGNAL( dataChanged() ), this, SLOT( setParameter() ) );
|
||||
vstKnobs[i] ->setModel( m_vi->knobFModel[i] );
|
||||
|
||||
FloatModel * model = m_vi->knobFModel[i];
|
||||
#if QT_VERSION < 0x050000
|
||||
connect( model, SIGNAL( dataChanged( Model * ) ), this,
|
||||
SLOT( setParameter( Model * ) ), Qt::DirectConnection );
|
||||
#else
|
||||
connect( model, &FloatModel::dataChanged, this,
|
||||
[this, model]() { setParameter( model ); }, Qt::DirectConnection);
|
||||
#endif
|
||||
vstKnobs[i] ->setModel( model );
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
@@ -1128,10 +1140,8 @@ manageVestigeInstrumentView::~manageVestigeInstrumentView()
|
||||
|
||||
|
||||
|
||||
void manageVestigeInstrumentView::setParameter( void )
|
||||
void manageVestigeInstrumentView::setParameter( Model * action )
|
||||
{
|
||||
|
||||
Model *action = qobject_cast<Model *>(sender());
|
||||
int knobUNID = action->displayName().toInt();
|
||||
|
||||
if ( m_vi->m_plugin != NULL ) {
|
||||
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
virtual PluginView * instantiateView( QWidget * _parent );
|
||||
|
||||
protected slots:
|
||||
void setParameter( void );
|
||||
void setParameter( Model * action );
|
||||
void handleConfigChange( QString cls, QString attr, QString value );
|
||||
void reloadPlugin();
|
||||
|
||||
@@ -109,7 +109,7 @@ public:
|
||||
protected slots:
|
||||
void syncPlugin( void );
|
||||
void displayAutomatedOnly( void );
|
||||
void setParameter( void );
|
||||
void setParameter( Model * action );
|
||||
void closeWindow();
|
||||
|
||||
|
||||
|
||||
@@ -1936,7 +1936,9 @@ DWORD WINAPI RemoteVstPlugin::processingThread( LPVOID _param )
|
||||
RemotePluginClient::message m;
|
||||
while( ( m = _this->receiveMessage() ).id != IdQuit )
|
||||
{
|
||||
if( m.id == IdStartProcessing || m.id == IdMidiEvent )
|
||||
if( m.id == IdStartProcessing
|
||||
|| m.id == IdMidiEvent
|
||||
|| m.id == IdVstSetParameter )
|
||||
{
|
||||
_this->processMessage( m );
|
||||
}
|
||||
|
||||
@@ -122,13 +122,20 @@ ZynAddSubFxInstrument::ZynAddSubFxInstrument(
|
||||
{
|
||||
initPlugin();
|
||||
|
||||
connect( &m_portamentoModel, SIGNAL( dataChanged() ), this, SLOT( updatePortamento() ) );
|
||||
connect( &m_filterFreqModel, SIGNAL( dataChanged() ), this, SLOT( updateFilterFreq() ) );
|
||||
connect( &m_filterQModel, SIGNAL( dataChanged() ), this, SLOT( updateFilterQ() ) );
|
||||
connect( &m_bandwidthModel, SIGNAL( dataChanged() ), this, SLOT( updateBandwidth() ) );
|
||||
connect( &m_fmGainModel, SIGNAL( dataChanged() ), this, SLOT( updateFmGain() ) );
|
||||
connect( &m_resCenterFreqModel, SIGNAL( dataChanged() ), this, SLOT( updateResCenterFreq() ) );
|
||||
connect( &m_resBandwidthModel, SIGNAL( dataChanged() ), this, SLOT( updateResBandwidth() ) );
|
||||
connect( &m_portamentoModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updatePortamento() ), Qt::DirectConnection );
|
||||
connect( &m_filterFreqModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updateFilterFreq() ), Qt::DirectConnection );
|
||||
connect( &m_filterQModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updateFilterQ() ), Qt::DirectConnection );
|
||||
connect( &m_bandwidthModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updateBandwidth() ), Qt::DirectConnection );
|
||||
connect( &m_fmGainModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updateFmGain() ), Qt::DirectConnection );
|
||||
connect( &m_resCenterFreqModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updateResCenterFreq() ), Qt::DirectConnection );
|
||||
connect( &m_resBandwidthModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updateResBandwidth() ), Qt::DirectConnection );
|
||||
|
||||
// now we need a play-handle which cares for calling play()
|
||||
InstrumentPlayHandle * iph = new InstrumentPlayHandle( this, _instrumentTrack );
|
||||
@@ -138,7 +145,7 @@ ZynAddSubFxInstrument::ZynAddSubFxInstrument(
|
||||
this, SLOT( reloadPlugin() ) );
|
||||
|
||||
connect( instrumentTrack()->pitchRangeModel(), SIGNAL( dataChanged() ),
|
||||
this, SLOT( updatePitchRange() ) );
|
||||
this, SLOT( updatePitchRange() ), Qt::DirectConnection );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -417,7 +417,8 @@ void AutomatableModel::linkModel( AutomatableModel* model )
|
||||
|
||||
if( !model->hasLinkedModels() )
|
||||
{
|
||||
QObject::connect( this, SIGNAL( dataChanged() ), model, SIGNAL( dataChanged() ) );
|
||||
QObject::connect( this, SIGNAL( dataChanged() ),
|
||||
model, SIGNAL( dataChanged() ), Qt::DirectConnection );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -476,7 +477,8 @@ void AutomatableModel::setControllerConnection( ControllerConnection* c )
|
||||
m_controllerConnection = c;
|
||||
if( c )
|
||||
{
|
||||
QObject::connect( m_controllerConnection, SIGNAL( valueChanged() ), this, SIGNAL( dataChanged() ) );
|
||||
QObject::connect( m_controllerConnection, SIGNAL( valueChanged() ),
|
||||
this, SIGNAL( dataChanged() ), Qt::DirectConnection );
|
||||
QObject::connect( m_controllerConnection, SIGNAL( destroyed() ), this, SLOT( unlinkControllerConnection() ) );
|
||||
m_valueChanged = true;
|
||||
emit dataChanged();
|
||||
|
||||
@@ -117,7 +117,7 @@ void ControllerConnection::setController( Controller * _controller )
|
||||
{
|
||||
_controller->addConnection( this );
|
||||
QObject::connect( _controller, SIGNAL( valueChanged() ),
|
||||
this, SIGNAL( valueChanged() ) );
|
||||
this, SIGNAL( valueChanged() ), Qt::DirectConnection );
|
||||
}
|
||||
|
||||
m_ownsController =
|
||||
|
||||
@@ -126,10 +126,14 @@ InstrumentTrack::InstrumentTrack( TrackContainer* tc ) :
|
||||
|
||||
setName( tr( "Default preset" ) );
|
||||
|
||||
connect( &m_baseNoteModel, SIGNAL( dataChanged() ), this, SLOT( updateBaseNote() ) );
|
||||
connect( &m_pitchModel, SIGNAL( dataChanged() ), this, SLOT( updatePitch() ) );
|
||||
connect( &m_pitchRangeModel, SIGNAL( dataChanged() ), this, SLOT( updatePitchRange() ) );
|
||||
connect( &m_effectChannelModel, SIGNAL( dataChanged() ), this, SLOT( updateEffectChannel() ) );
|
||||
connect( &m_baseNoteModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updateBaseNote() ), Qt::DirectConnection );
|
||||
connect( &m_pitchModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updatePitch() ), Qt::DirectConnection );
|
||||
connect( &m_pitchRangeModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updatePitchRange() ), Qt::DirectConnection );
|
||||
connect( &m_effectChannelModel, SIGNAL( dataChanged() ),
|
||||
this, SLOT( updateEffectChannel() ), Qt::DirectConnection );
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user