From 7b5c91195058759043bd8d49e10b64d7f6938ab2 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Fri, 18 Jul 2008 13:00:56 +0000 Subject: [PATCH] save actual instrument-settings in separate sub-node for not mixing up unknown nodes with instruments git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1331 0778d3d1-df1d-0410-868b-ea421aaaa00d --- src/tracks/instrument_track.cpp | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/src/tracks/instrument_track.cpp b/src/tracks/instrument_track.cpp index cabbcc043..1e62fb016 100644 --- a/src/tracks/instrument_track.cpp +++ b/src/tracks/instrument_track.cpp @@ -106,7 +106,7 @@ instrumentTrack::instrumentTrack( trackContainer * _tc ) : m_panningModel( DefaultPanning, PanningLeft, PanningRight, 1.0f, this, tr( "Panning" ) ), m_pitchModel( 0, -100, 100, 1, this, tr( "Pitch" ) ), - m_effectChannelModel( 0, 0, NumFxChannels, this ), + m_effectChannelModel( 0, 0, NumFxChannels, this, tr( "FX channel" ) ), m_instrument( NULL ), m_soundShaping( this ), m_arpeggiator( this ), @@ -597,7 +597,10 @@ void instrumentTrack::saveTrackSpecificSettings( QDomDocument & _doc, if( m_instrument != NULL ) { - m_instrument->saveState( _doc, _this ); + QDomElement i = _doc.createElement( "instrument" ); + i.setAttribute( "name", m_instrument->getDescriptor()->name ); + m_instrument->saveState( _doc, i ); + _this.appendChild( i ); } m_soundShaping.saveState( _doc, _this ); m_chordCreator.saveState( _doc, _this ); @@ -681,13 +684,24 @@ void instrumentTrack::loadTrackSpecificSettings( const QDomElement & _this ) m_audioPort.getEffects()->restoreState( node.toElement() ); } + else if( node.nodeName() == "instrument" ) + { + delete m_instrument; + m_instrument = NULL; + m_instrument = instrument::instantiate( + node.toElement().attribute( "name" ), + this ); + m_instrument->restoreState( + node.firstChildElement() ); + emit instrumentChanged(); + } + // compat code - if node-name doesn't match any known + // one, we assume that it is an instrument-plugin + // which we'll try to load else if( automationPattern::classNodeName() != node.nodeName() && !node.toElement().hasAttribute( "id" ) ) { - // if node-name doesn't match any known one, - // we assume that it is an instrument-plugin - // which we'll try to load delete m_instrument; m_instrument = NULL; m_instrument = instrument::instantiate(