full support for saving and loading effects

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@297 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Danny McRae
2006-08-09 14:56:33 +00:00
parent ccb5a4ea77
commit 19e4bfdb5e
5 changed files with 68 additions and 24 deletions

View File

@@ -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;
}
}

View File

@@ -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();
}
}

View File

@@ -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<rackPlugin *>::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();
}
}