kicker: backwards compatibility

This commit is contained in:
Hannu Haahti
2014-03-31 06:34:58 +03:00
parent bbe6ee226e
commit 243c66e0e8
2 changed files with 19 additions and 1 deletions

View File

@@ -69,7 +69,8 @@ kickerInstrument::kickerInstrument( InstrumentTrack * _instrument_track ) :
m_clickModel( 0.4f, 0.0f, 1.0f, 0.05f, this, tr( "Click" ) ),
m_slopeModel( 0.06f, 0.001f, 1.0f, 0.001f, this, tr( "Slope" ) ),
m_startNoteModel( false, this, tr( "Start from note" ) ),
m_endNoteModel( false, this, tr( "End to note" ) )
m_endNoteModel( false, this, tr( "End to note" ) ),
m_versionModel( 0, 0, KICKER_PRESET_VERSION, this, "" )
{
}
@@ -97,6 +98,7 @@ void kickerInstrument::saveSettings( QDomDocument & _doc,
m_slopeModel.saveSettings( _doc, _this, "slope" );
m_startNoteModel.saveSettings( _doc, _this, "startnote" );
m_endNoteModel.saveSettings( _doc, _this, "endnote" );
m_versionModel.saveSettings( _doc, _this, "version" );
}
@@ -115,6 +117,17 @@ void kickerInstrument::loadSettings( const QDomElement & _this )
m_slopeModel.loadSettings( _this, "slope" );
m_startNoteModel.loadSettings( _this, "startnote" );
m_endNoteModel.loadSettings( _this, "endnote" );
m_versionModel.loadSettings( _this, "version" );
// Try to maintain backwards compatibility
if( m_versionModel.value() < 1 )
{
m_decayModel.setValue( m_decayModel.value() * 1.33f );
m_envModel.setValue( 1.0f );
m_slopeModel.setValue( 1.0f );
m_clickModel.setValue( 0.0f );
m_versionModel.setValue( KICKER_PRESET_VERSION );
}
}

View File

@@ -34,6 +34,9 @@
#include "led_checkbox.h"
#define KICKER_PRESET_VERSION 1
class kickerInstrumentView;
class NotePlayHandle;
@@ -80,6 +83,8 @@ private:
BoolModel m_startNoteModel;
BoolModel m_endNoteModel;
IntModel m_versionModel;
friend class kickerInstrumentView;
} ;