diff --git a/ChangeLog b/ChangeLog index 855d45410..e6c81d432 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,15 @@ added deletion of the control view to the dtor to make it clean up after itself + * include/automatable_object.h: + * include/ladspa_control.h: + * include/ladspa_control_dialog.h: + * src/core/ladspa_control_dialog.cpp: + * src/core/ladspa_control.cpp: + - added a link channels option to the ladspa controls + - unlinking the channels will currently break automation for all + but the first channel + * All of the effects related files: reformatted to respect the 80 characters per line convention diff --git a/include/automatable_object.h b/include/automatable_object.h index 003f984f7..85c6eeab2 100755 --- a/include/automatable_object.h +++ b/include/automatable_object.h @@ -264,7 +264,7 @@ public: _object2->linkObject( _object1 ); if( _object1->m_automation_pattern - != _object2->m_automation_pattern ) + != _object2->m_automation_pattern ) { if( _object2->m_automation_pattern ) { @@ -275,6 +275,21 @@ public: } } + static void unlinkObjects( autoObj * _object1, + autoObj * _object2 ) + { + _object1->unlinkObject( _object2 ); + _object2->unlinkObject( _object1 ); + + if( !_object1->m_automation_pattern ) + { + _object1->m_automation_pattern = + _object1->getAutomationPattern(); + } + _object2->m_automation_pattern = + new automationPattern( *_object1->m_automation_pattern ); + } + virtual void FASTCALL saveSettings( QDomDocument & _doc, QDomElement & _this, const QString & _name = "value" ) @@ -439,9 +454,13 @@ private: inline void unlinkObject( autoObj * _object ) { - m_linkedObjects.erase( qFind( m_linkedObjects.begin(), + if( qFind( m_linkedObjects.begin(), m_linkedObjects.end(), + _object ) != m_linkedObjects.end() ) + { + m_linkedObjects.erase( qFind( m_linkedObjects.begin(), m_linkedObjects.end(), _object ) ); + } } static T attributeValue( QString _value ); diff --git a/include/effect_chain.h b/include/effect_chain.h index 67df8a6bd..6e1ee7955 100644 --- a/include/effect_chain.h +++ b/include/effect_chain.h @@ -81,39 +81,6 @@ private: #endif -typedef vvector effect_list_t; - -class effectChain: public engineObject -{ - public: - effectChain( engine * _engine ); - ~effectChain(); - - void FASTCALL appendEffect( effect * _effect ); - void FASTCALL deleteEffect( effect * _effect ); - void FASTCALL moveDown( effect * _effect ); - void FASTCALL moveUp( effect * _effect ); - bool FASTCALL processAudioBuffer( surroundSampleFrame * _buf, - const fpab_t _frames ); - void startRunning( void ); - bool isRunning( void ); - - inline void setBypass( bool _mode ) - { - m_bypassed = _mode; - } - - inline const effect_list_t & getEffects( void ) - { - return( m_effects ); - } - - private: - effect_list_t m_effects; - - bool m_bypassed; - QMutex m_processLock; -}; diff --git a/include/ladspa_control.h b/include/ladspa_control.h index b6868d0e5..e56532b06 100644 --- a/include/ladspa_control.h +++ b/include/ladspa_control.h @@ -60,6 +60,24 @@ public: LADSPA_Data getValue( void ); void FASTCALL setValue( LADSPA_Data _value ); + void FASTCALL linkControls( ladspaControl * _control ); + void FASTCALL unlinkControls( ladspaControl * _control ); + + inline ledCheckBox * getToggle( void ) + { + return( m_toggle ); + } + + inline knob * getKnob( void ) + { + return( m_knob ); + } + + inline port_desc_t * getPort( void ) + { + return( m_port ); + } + virtual void FASTCALL saveSettings( QDomDocument & _doc, QDomElement & _parent, const QString & _name ); virtual void FASTCALL loadSettings( const QDomElement & _this, @@ -69,6 +87,13 @@ public: return( "port" ); } +signals: + void changed( Uint16 _port, LADSPA_Data ); + +protected slots: + void ledChange( bool ); + void knobChange( float ); + private: port_desc_t * m_port; track * m_track; diff --git a/src/widgets/ladspa_control.cpp b/src/widgets/ladspa_control.cpp index 17a72a743..9235b66f3 100644 --- a/src/widgets/ladspa_control.cpp +++ b/src/widgets/ladspa_control.cpp @@ -57,7 +57,9 @@ ladspaControl::ladspaControl( QWidget * _parent, { case TOGGLED: m_toggle = new ledCheckBox( m_port->name, this, "", - eng(), m_track ); + eng(), m_track ); + connect( m_toggle, SIGNAL( toggled( bool ) ), + this, SLOT( ledChange( bool ) ) ); setFixedSize( m_toggle->width(), m_toggle->height() ); if( m_port->def == 1.0f ) { @@ -67,6 +69,8 @@ ladspaControl::ladspaControl( QWidget * _parent, case INTEGER: m_knob = new knob( knobBright_26, this, m_port->name, eng(), m_track); + connect( m_knob, SIGNAL( valueChanged( float ) ), + this, SLOT( knobChange( float ) ) ); m_knob->setLabel( m_port->name ); m_knob->setRange( static_cast( m_port->max ), static_cast( m_port->min ), @@ -86,6 +90,8 @@ ladspaControl::ladspaControl( QWidget * _parent, case FLOAT: m_knob = new knob( knobBright_26, this, m_port->name, eng(), m_track); + connect( m_knob, SIGNAL( valueChanged( float ) ), + this, SLOT( knobChange( float ) ) ); m_knob->setLabel( m_port->name ); m_knob->setRange( m_port->min, m_port->max, ( m_port->max - @@ -206,6 +212,60 @@ void FASTCALL ladspaControl::loadSettings( const QDomElement & _this, +void FASTCALL ladspaControl::linkControls( ladspaControl * _control ) +{ + switch( m_port->data_type ) + { + case TOGGLED: + ledCheckBox::linkObjects( m_toggle, _control->getToggle() ); + break; + case INTEGER: + case FLOAT: + knob::linkObjects( m_knob, _control->getKnob() ); + break; + default: + break; + } +} + + + + +void ladspaControl::ledChange( bool _state ) +{ + emit( changed( m_port->port_id, static_cast( _state ) ) ); +} + + + + +void ladspaControl::knobChange( float _value ) +{ + emit( changed( m_port->port_id, static_cast( _value ) ) ); +} + + + + +void FASTCALL ladspaControl::unlinkControls( ladspaControl * _control ) +{ + switch( m_port->data_type ) + { + case TOGGLED: + ledCheckBox::unlinkObjects( m_toggle, _control->getToggle() ); + break; + case INTEGER: + case FLOAT: + knob::unlinkObjects( m_knob, _control->getKnob() ); + break; + default: + break; + } +} + + + + #include "ladspa_control.moc" #endif