diff --git a/ChangeLog b/ChangeLog index ac241b72f..f4acaa66a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-08-09 Danny McRae + * include/ladspa_control.h: + * include/ladspa_control_dialog.h: + * src/widgets/ladspa_control.cpp: + * src/widgets/rack_plugin.cpp: + * src/widgets/rack_view.cpp: + full save and load support for effects in instrument tracks + 2006-08-08 Danny McRae * include/effect.h: * include/effect_chain.h: @@ -30,7 +38,7 @@ clean up some things that were preventing the getNextSample methods from being inlined - * configure + * configure: * configure.in: -made ladspa support default off -must pass --with-ladspa to get it to build diff --git a/include/ladspa_control.h b/include/ladspa_control.h index b89b01bb8..2b3022016 100644 --- a/include/ladspa_control.h +++ b/include/ladspa_control.h @@ -48,8 +48,8 @@ public: LADSPA_Data getValue( void ); void FASTCALL setValue( LADSPA_Data _value ); - virtual void FASTCALL saveSettings( QDomDocument & _doc, QDomElement & _parent ); - virtual void FASTCALL loadSettings( const QDomElement & _this ); + virtual void FASTCALL saveSettings( QDomDocument & _doc, QDomElement & _parent, const QString & _name ); + virtual void FASTCALL loadSettings( const QDomElement & _this, const QString & _name ); inline virtual QString nodeName( void ) const { return( "port" ); diff --git a/src/widgets/ladspa_control.cpp b/src/widgets/ladspa_control.cpp index 8c88f7332..1411f128d 100644 --- a/src/widgets/ladspa_control.cpp +++ b/src/widgets/ladspa_control.cpp @@ -136,15 +136,40 @@ void ladspaControl::setValue( LADSPA_Data _value ) -void FASTCALL ladspaControl::saveSettings( QDomDocument & _doc, QDomElement & _this ) +void FASTCALL ladspaControl::saveSettings( QDomDocument & _doc, QDomElement & _this, const QString & _name ) { + switch( m_port->data_type ) + { + case TOGGLED: + m_toggle->saveSettings( _doc, _this, _name ); + break; + case INTEGER: + case FLOAT: + m_knob->saveSettings( _doc, _this, _name ); + break; + default: + printf("ladspaControl::saveSettings BAD BAD BAD\n"); + break; + } } - -void FASTCALL ladspaControl::loadSettings( const QDomElement & _this ) +void FASTCALL ladspaControl::loadSettings( const QDomElement & _this, const QString & _name ) { + switch( m_port->data_type ) + { + case TOGGLED: + m_toggle->loadSettings( _this, _name ); + break; + case INTEGER: + case FLOAT: + m_knob->loadSettings( _this, _name ); + break; + default: + printf("ladspaControl::loadSettings BAD BAD BAD\n"); + break; + } } diff --git a/src/widgets/rack_plugin.cpp b/src/widgets/rack_plugin.cpp index 182e02a57..560a7080c 100644 --- a/src/widgets/rack_plugin.cpp +++ b/src/widgets/rack_plugin.cpp @@ -331,7 +331,19 @@ void FASTCALL rackPlugin::loadSettings( const QDomElement & _this ) m_wetDry->setValue( _this.attribute( "wet" ).toFloat() ); m_autoQuit->setValue( _this.attribute( "autoquit" ).toFloat() ); m_gate->setValue( _this.attribute( "gate" ).toFloat() ); - m_controlView->loadSettings( _this ); + + QDomNode node = _this.firstChild(); + while( !node.isNull() ) + { + if( node.isElement() ) + { + if( m_controlView->nodeName() == node.nodeName() ) + { + m_controlView->restoreState( node.toElement() ); + } + } + node = node.nextSibling(); + } } diff --git a/src/widgets/rack_view.cpp b/src/widgets/rack_view.cpp index 727973794..a52345a62 100644 --- a/src/widgets/rack_view.cpp +++ b/src/widgets/rack_view.cpp @@ -170,15 +170,17 @@ void rackView::redraw() void FASTCALL rackView::saveSettings( QDomDocument & _doc, QDomElement & _this ) { + int num = 0; _this.setAttribute( "plugins", m_rackInserts.count() ); for( vvector::iterator it = m_rackInserts.begin(); it != m_rackInserts.end(); it++ ) { ladspa_key_t key = (*it)->getKey(); - _this.setAttribute( "label", key.first ); - _this.setAttribute( "lib", key.second ); - _this.setAttribute( "name", m_ladspa->getName( key ) ); - _this.setAttribute( "maker", m_ladspa->getMaker( key ) ); + _this.setAttribute( "label" + QString::number(num), key.first ); + _this.setAttribute( "lib" + QString::number(num), key.second ); + _this.setAttribute( "name" + QString::number(num), m_ladspa->getName( key ) ); + _this.setAttribute( "maker" + QString::number(num), m_ladspa->getMaker( key ) ); (*it)->saveState( _doc, _this ); + num++; } } @@ -188,33 +190,29 @@ void FASTCALL rackView::saveSettings( QDomDocument & _doc, QDomElement & _this ) void FASTCALL rackView::loadSettings( const QDomElement & _this ) { int plugin_cnt = _this.attribute( "plugins" ).toInt(); - QString lib = _this.attribute( "lib" ); - QString label = _this.attribute( "label" ); + + QDomNode node = _this.firstChild(); for( int i = 0; i < plugin_cnt; i++ ) { - printf( "%s, %s\n", lib.ascii(), label.ascii() ); + QString lib = _this.attribute( "lib" + QString::number( i ) ); + QString label = _this.attribute( "label" + QString::number( i ) ); ladspa_key_t key( label, lib ); if( m_ladspa->getDescriptor( key ) != NULL ) { addPlugin( key ); - QDomNode node = _this.firstChild(); - while( !node.isNull() ) + if( node.isElement() ) { - if( node.isElement() ) + if( m_rackInserts.last()->nodeName() == node.nodeName() ) { - if( m_rackInserts.last()->nodeName() == node.nodeName() ) - { - m_rackInserts.last()->restoreState( node.toElement() ); - } + m_rackInserts.last()->restoreState( node.toElement() ); } - node = node.nextSibling(); } } else { - QString name = _this.attribute( "name" ); - QString maker = _this.attribute( "maker" ); + QString name = _this.attribute( "name" + QString::number( i ) ); + QString maker = _this.attribute( "maker" + QString::number( i ) ); QString message = "Couldn't find " + name + " from:\n\n"; message += "Library: " + lib + "\n"; message += "Label: " + label + "\n"; @@ -222,6 +220,7 @@ void FASTCALL rackView::loadSettings( const QDomElement & _this ) QMessageBox::information( 0, tr( "Uknown plugin" ), message, QMessageBox::Ok ); } + node = node.nextSibling(); } }