From 912eccce7b6485e8f250a2a4b2d7489cb662105e Mon Sep 17 00:00:00 2001 From: Javier Serrano Polo Date: Mon, 26 Jun 2006 23:23:40 +0000 Subject: [PATCH] added automation to many knobs git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@173 0778d3d1-df1d-0410-868b-ea421aaaa00d --- .../audio_file_processor.cpp | 12 +-- plugins/bit_invader/bit_invader.cpp | 2 +- plugins/organic/organic.cpp | 44 +++++------ .../plucked_string_synth.cpp | 13 ++-- .../triple_oscillator/triple_oscillator.cpp | 64 +++++++-------- plugins/vibed/vibed.cpp | 77 +++++++------------ src/core/arp_and_chords_tab_widget.cpp | 28 ++++--- src/core/envelope_tab_widget.cpp | 21 ++--- 8 files changed, 120 insertions(+), 141 deletions(-) diff --git a/plugins/audio_file_processor/audio_file_processor.cpp b/plugins/audio_file_processor/audio_file_processor.cpp index a5648c5e7..dd55ae164 100644 --- a/plugins/audio_file_processor/audio_file_processor.cpp +++ b/plugins/audio_file_processor/audio_file_processor.cpp @@ -169,7 +169,8 @@ audioFileProcessor::audioFileProcessor( instrumentTrack * _channel_track ) : "This is useful for things like string- and choir-" "samples." ) ); - m_ampKnob = new volumeKnob( knobDark_28, this, tr( "Amplify" ), eng() ); + m_ampKnob = new volumeKnob( knobDark_28, this, tr( "Amplify" ), eng(), + _channel_track ); m_ampKnob->setRange( 0, 500, 1.0f ); m_ampKnob->move( 6, 114 ); m_ampKnob->setInitValue( 100.0f ); @@ -188,7 +189,7 @@ audioFileProcessor::audioFileProcessor( instrumentTrack * _channel_track ) : "actual sample-file isn't touched!)" ) ); m_startKnob = new knob( knobDark_28, this, tr( "Start of sample" ), - eng() ); + eng(), _channel_track ); m_startKnob->setRange( 0.0f, 1.0f, 0.00001f ); m_startKnob->move( 46, 114 ); m_startKnob->setInitValue( 0.0f ); @@ -207,7 +208,8 @@ audioFileProcessor::audioFileProcessor( instrumentTrack * _channel_track ) : "which AudioFileProcessor returns if a note is longer " "than the sample between start- and end-point." ) ); - m_endKnob = new knob( knobDark_28, this, tr( "End of sample" ), eng() ); + m_endKnob = new knob( knobDark_28, this, tr( "End of sample" ), eng(), + _channel_track ); m_endKnob->setRange( 0.0f, 1.0f, 0.00001f ); m_endKnob->move( 84, 114 ); m_endKnob->setInitValue( 1.0f ); @@ -303,7 +305,7 @@ void audioFileProcessor::saveSettings( QDomDocument & _doc, m_reverseButton->isChecked() ) ); _this.setAttribute( "looped", QString::number( m_loopButton->isChecked() ) ); - _this.setAttribute( "amp", QString::number( m_ampKnob->value() ) ); + m_ampKnob->saveSettings( _doc, _this, "amp" ); } @@ -323,7 +325,7 @@ void audioFileProcessor::loadSettings( const QDomElement & _this ) _this.attribute( "eframe" ).toFloat() ); m_reverseButton->setChecked( _this.attribute( "reversed" ).toInt() ); m_loopButton->setChecked( _this.attribute( "looped" ).toInt() ); - m_ampKnob->setValue( _this.attribute( "amp" ).toFloat() ); + m_ampKnob->loadSettings( _this, "amp" ); } diff --git a/plugins/bit_invader/bit_invader.cpp b/plugins/bit_invader/bit_invader.cpp index 8e8b6b954..03293bd35 100644 --- a/plugins/bit_invader/bit_invader.cpp +++ b/plugins/bit_invader/bit_invader.cpp @@ -188,7 +188,7 @@ bitInvader::bitInvader( instrumentTrack * _channel_track ) : m_sampleLengthKnob = new knob( knobDark_28, this, tr( "Samplelength" ), - eng() ); + eng(), _channel_track ); m_sampleLengthKnob->setRange( 8, 128, 1 ); m_sampleLengthKnob->setInitValue( 128 ); m_sampleLengthKnob->move( 10, 120 ); diff --git a/plugins/organic/organic.cpp b/plugins/organic/organic.cpp index f87148814..37112592c 100644 --- a/plugins/organic/organic.cpp +++ b/plugins/organic/organic.cpp @@ -121,7 +121,8 @@ organicInstrument::organicInstrument( instrumentTrack * _channel_track ) : // setup volume-knob m_osc[i].oscKnob = new knob( knobGreen_17, this, tr( - "Osc %1 waveform" ).arg( i+1 ), eng() ); + "Osc %1 waveform" ).arg( i+1 ), eng(), + _channel_track ); m_osc[i].oscKnob->move( 25+i*20, 90 ); m_osc[i].oscKnob->setRange( 0.0f, 5.0f, 0.25f ); m_osc[i].oscKnob->setInitValue( 0.0f ); @@ -134,7 +135,8 @@ organicInstrument::organicInstrument( instrumentTrack * _channel_track ) : // setup volume-knob m_osc[i].volKnob = new volumeKnob( knobGreen_17, this, tr( - "Osc %1 volume" ).arg( i+1 ), eng() ); + "Osc %1 volume" ).arg( i+1 ), eng(), + _channel_track ); m_osc[i].volKnob->setData( i ); m_osc[i].volKnob->move( 25+i*20, 110 ); m_osc[i].volKnob->setRange( 0, 100, 1.0f ); @@ -144,7 +146,8 @@ organicInstrument::organicInstrument( instrumentTrack * _channel_track ) : // setup panning-knob m_osc[i].panKnob = new knob( knobGreen_17, this, - tr( "Osc %1 panning" ).arg( i + 1 ), eng() ); + tr( "Osc %1 panning" ).arg( i + 1 ), eng(), + _channel_track ); m_osc[i].panKnob->setData( i ); m_osc[i].panKnob->move( 25+i*20, 130 ); m_osc[i].panKnob->setRange( PANNING_LEFT, PANNING_RIGHT, 1.0f ); @@ -155,7 +158,7 @@ organicInstrument::organicInstrument( instrumentTrack * _channel_track ) : // setup knob for left fine-detuning m_osc[i].detuneKnob = new knob( knobGreen_17, this, tr( "Osc %1 fine detuning left" ).arg( i+1 ), - eng() ); + eng(), _channel_track ); m_osc[i].detuneKnob->setData( i ); m_osc[i].detuneKnob->move( 25+i*20, 150 ); m_osc[i].detuneKnob->setRange( -100.0f, 100.0f, 1.0f ); @@ -185,14 +188,15 @@ organicInstrument::organicInstrument( instrumentTrack * _channel_track ) : // setup knob for FX1 fx1Knob = new knob( knobGreen_17, this, - tr( "FX1" ), eng() ); + tr( "FX1" ), eng(), _channel_track ); fx1Knob->move( 20, 200 ); fx1Knob->setRange( 0.0f, 0.99f, 0.01f ); fx1Knob->setInitValue( 0.0f); // setup volume-knob volKnob = new knob( knobGreen_17, this, tr( - "Osc %1 volume" ).arg( 1 ), eng() ); + "Osc %1 volume" ).arg( 1 ), eng(), + _channel_track ); volKnob->move( 50, 200 ); volKnob->setRange( 0, 200, 1.0f ); volKnob->setInitValue( 100 ); @@ -244,20 +248,17 @@ organicInstrument::~organicInstrument() void organicInstrument::saveSettings( QDomDocument & _doc, QDomElement & _this ) { _this.setAttribute( "num_osc", QString::number( m_num_oscillators ) ); - _this.setAttribute( "foldback", QString::number( fx1Knob->value() ) ); - _this.setAttribute( "vol", QString::number( volKnob->value() ) ); + fx1Knob->saveSettings( _doc, _this, "foldback" ); + volKnob->saveSettings( _doc, _this, "vol" ); for( int i = 0; i < m_num_oscillators; ++i ) { QString is = QString::number( i ); - _this.setAttribute( "vol" + is, QString::number( - m_osc[i].volKnob->value() ) ); - _this.setAttribute( "pan" + is, QString::number( - m_osc[i].panKnob->value() ) ); + m_osc[i].volKnob->saveSettings( _doc, _this, "vol" + is ); + m_osc[i].panKnob->saveSettings( _doc, _this, "pan" + is ); _this.setAttribute( "harmonic" + is, QString::number( m_osc[i].harmonic ) ); - _this.setAttribute( "detune" + is, QString::number( - m_osc[i].detuneKnob->value() ) ); + m_osc[i].detuneKnob->saveSettings( _doc, _this, "detune" + is ); _this.setAttribute( "wavetype" + is, QString::number( m_osc[i].waveShape ) ); } @@ -274,20 +275,15 @@ void organicInstrument::loadSettings( const QDomElement & _this ) for( int i = 0; i < m_num_oscillators; ++i ) { QString is = QString::number( i ); - m_osc[i].volKnob->setValue( _this.attribute( "vol" + is ). - toFloat() ); - m_osc[i].detuneKnob->setValue( _this.attribute( "detune" + is ). - toFloat() ); - m_osc[i].panKnob->setValue( _this.attribute( "pan" + is ). - toFloat() ); + m_osc[i].volKnob->loadSettings( _this, "vol" + is ); + m_osc[i].detuneKnob->loadSettings( _this, "detune" + is ); + m_osc[i].panKnob->loadSettings( _this, "pan" + is ); m_osc[i].oscKnob->setValue( _this.attribute( "wavetype"+is ). toInt() ); } - volKnob->setValue( _this.attribute( "vol" ). - toFloat() ); - fx1Knob->setValue( _this.attribute( "foldback" ). - toFloat() ); + volKnob->loadSettings( _this, "vol" ); + fx1Knob->loadSettings( _this, "foldback" ); oscButtonChanged(); } diff --git a/plugins/plucked_string_synth/plucked_string_synth.cpp b/plugins/plucked_string_synth/plucked_string_synth.cpp index c4675469f..78996ae21 100644 --- a/plugins/plucked_string_synth/plucked_string_synth.cpp +++ b/plugins/plucked_string_synth/plucked_string_synth.cpp @@ -72,14 +72,14 @@ pluckedStringSynth::pluckedStringSynth( instrumentTrack * _channel_track ) : instrument( _channel_track, &pluckedstringsynth_plugin_descriptor ) { m_pickKnob = new knob( knobDark_28, this, tr( "Pick position" ), - eng() ); + eng(), _channel_track ); m_pickKnob->setRange( 0.0f, 0.5f, 0.005f ); m_pickKnob->setInitValue( 0.0f ); m_pickKnob->move( 86, 134 ); m_pickKnob->setHintText( tr( "Pick position:" ) + " ", "" ); m_pickupKnob = new knob( knobDark_28, this, tr( "Pickup position" ), - eng() ); + eng(), _channel_track ); m_pickupKnob->setRange( 0.0f, 0.5f, 0.005f ); m_pickupKnob->setInitValue( 0.05f ); m_pickupKnob->move( 138, 134 ); @@ -108,9 +108,8 @@ pluckedStringSynth::~pluckedStringSynth() void pluckedStringSynth::saveSettings( QDomDocument & _doc, QDomElement & _this ) { - _this.setAttribute( "pick", QString::number( m_pickKnob->value() ) ); - _this.setAttribute( "pickup", QString::number( - m_pickupKnob->value() ) ); + m_pickKnob->saveSettings( _doc, _this, "pick" ); + m_pickupKnob->saveSettings( _doc, _this, "pickup" ); } @@ -118,8 +117,8 @@ void pluckedStringSynth::saveSettings( QDomDocument & _doc, void pluckedStringSynth::loadSettings( const QDomElement & _this ) { - m_pickKnob->setValue( _this.attribute( "pick" ).toFloat() ); - m_pickupKnob->setValue( _this.attribute( "pickup" ).toFloat() ); + m_pickKnob->loadSettings( _this, "pick" ); + m_pickupKnob->loadSettings( _this, "pickup" ); } diff --git a/plugins/triple_oscillator/triple_oscillator.cpp b/plugins/triple_oscillator/triple_oscillator.cpp index f2c492e2a..0a2183211 100644 --- a/plugins/triple_oscillator/triple_oscillator.cpp +++ b/plugins/triple_oscillator/triple_oscillator.cpp @@ -246,7 +246,8 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : // setup volume-knob m_osc[i].volKnob = new volumeKnob( knobSmall_17, this, tr( - "Osc %1 volume" ).arg( i+1 ), eng() ); + "Osc %1 volume" ).arg( i+1 ), eng(), + _channel_track ); m_osc[i].volKnob->setData( i ); m_osc[i].volKnob->move( 6, 104+i*50 ); m_osc[i].volKnob->setRange( MIN_VOLUME, MAX_VOLUME, 1.0f ); @@ -267,7 +268,8 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : // setup panning-knob m_osc[i].panKnob = new knob( knobSmall_17, this, - tr( "Osc %1 panning" ).arg( i + 1 ), eng() ); + tr( "Osc %1 panning" ).arg( i + 1 ), eng(), + _channel_track ); m_osc[i].panKnob->setData( i ); m_osc[i].panKnob->move( 33, 104+i*50 ); m_osc[i].panKnob->setRange( PANNING_LEFT, PANNING_RIGHT, 1.0f ); @@ -287,7 +289,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : // setup coarse-knob m_osc[i].coarseKnob = new knob( knobSmall_17, this, tr( "Osc %1 coarse detuning" ).arg( i + 1 ), - eng() ); + eng(), _channel_track ); m_osc[i].coarseKnob->setData( i ); m_osc[i].coarseKnob->move( 66, 104 + i * 50 ); m_osc[i].coarseKnob->setRange( -2 * NOTES_PER_OCTAVE, @@ -310,7 +312,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : // setup knob for left fine-detuning m_osc[i].fineLKnob = new knob( knobSmall_17, this, tr( "Osc %1 fine detuning left" ).arg( i+1 ), - eng() ); + eng(), _channel_track ); m_osc[i].fineLKnob->setData( i ); m_osc[i].fineLKnob->move( 90, 104 + i * 50 ); m_osc[i].fineLKnob->setRange( -100.0f, 100.0f, 1.0f ); @@ -334,7 +336,7 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : m_osc[i].fineRKnob = new knob( knobSmall_17, this, tr( "Osc %1 fine detuning right" ).arg( i + 1 ), - eng() ); + eng(), _channel_track ); m_osc[i].fineRKnob->setData( i ); m_osc[i].fineRKnob->move( 110, 104 + i * 50 ); m_osc[i].fineRKnob->setRange( -100.0f, 100.0f, 1.0f ); @@ -357,7 +359,8 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : m_osc[i].phaseOffsetKnob = new knob( knobSmall_17, this, tr( "Osc %1 phase-" "offset" ).arg( i+1 ), - eng() ); + eng(), + _channel_track ); m_osc[i].phaseOffsetKnob->setData( i ); m_osc[i].phaseOffsetKnob->move( 142, 104 + i * 50 ); m_osc[i].phaseOffsetKnob->setRange( 0.0f, 360.0f, 1.0f ); @@ -384,7 +387,8 @@ tripleOscillator::tripleOscillator( instrumentTrack * _channel_track ) : m_osc[i].stereoPhaseDetuningKnob = new knob( knobSmall_17, this, tr( "Osc %1 stereo phase-" "detuning" ).arg( i+1 ), - eng() ); + eng(), + _channel_track ); m_osc[i].stereoPhaseDetuningKnob->setData( i ); m_osc[i].stereoPhaseDetuningKnob->move( 166, 104 + i * 50 ); m_osc[i].stereoPhaseDetuningKnob->setRange( 0.0f, 360.0f, @@ -593,20 +597,15 @@ void tripleOscillator::saveSettings( QDomDocument & _doc, QDomElement & _this ) for( int i = 0; i < NUM_OF_OSCILLATORS; ++i ) { QString is = QString::number( i ); - _this.setAttribute( "vol" + is, QString::number( - m_osc[i].volKnob->value() ) ); - _this.setAttribute( "pan" + is, QString::number( - m_osc[i].panKnob->value() ) ); - _this.setAttribute( "coarse" + is, QString::number( - m_osc[i].coarseKnob->value() ) ); - _this.setAttribute( "finel" + is, QString::number( - m_osc[i].fineLKnob->value() ) ); - _this.setAttribute( "finer" + is, QString::number( - m_osc[i].fineRKnob->value() ) ); - _this.setAttribute( "phoffset" + is, QString::number( - m_osc[i].phaseOffsetKnob->value() ) ); - _this.setAttribute( "stphdetun" + is, QString::number( - m_osc[i].stereoPhaseDetuningKnob->value() ) ); + m_osc[i].volKnob->saveSettings( _doc, _this, "vol" + is ); + m_osc[i].panKnob->saveSettings( _doc, _this, "pan" + is ); + m_osc[i].coarseKnob->saveSettings( _doc, _this, "coarse" + is ); + m_osc[i].fineLKnob->saveSettings( _doc, _this, "finel" + is ); + m_osc[i].fineRKnob->saveSettings( _doc, _this, "finer" + is ); + m_osc[i].phaseOffsetKnob->saveSettings( _doc, _this, + "phoffset" + is ); + m_osc[i].stereoPhaseDetuningKnob->saveSettings( _doc, _this, + "stphdetun" + is ); _this.setAttribute( "wavetype" + is, QString::number( m_osc[i].waveShape ) ); _this.setAttribute( "userwavefile" + is, @@ -630,20 +629,15 @@ void tripleOscillator::loadSettings( const QDomElement & _this ) for( int i = 0; i < NUM_OF_OSCILLATORS; ++i ) { QString is = QString::number( i ); - m_osc[i].volKnob->setValue( _this.attribute( "vol" + is ). - toFloat() ); - m_osc[i].panKnob->setValue( _this.attribute( "pan" + is ). - toFloat() ); - m_osc[i].coarseKnob->setValue( _this.attribute( "coarse" + is ). - toFloat() ); - m_osc[i].fineLKnob->setValue( _this.attribute( "finel" + is ). - toFloat() ); - m_osc[i].fineRKnob->setValue( _this.attribute( "finer" + is ). - toFloat() ); - m_osc[i].phaseOffsetKnob->setValue( _this.attribute( - "phoffset" + is ).toFloat() ); - m_osc[i].stereoPhaseDetuningKnob->setValue( _this.attribute( - "stphdetun" + is ).toFloat() ); + m_osc[i].volKnob->loadSettings( _this, "vol" + is ); + m_osc[i].panKnob->loadSettings( _this, "pan" + is ); + m_osc[i].coarseKnob->loadSettings( _this, "coarse" + is ); + m_osc[i].fineLKnob->loadSettings( _this, "finel" + is ); + m_osc[i].fineRKnob->loadSettings( _this, "finer" + is ); + m_osc[i].phaseOffsetKnob->loadSettings( _this, + "phoffset" + is ); + m_osc[i].stereoPhaseDetuningKnob->loadSettings( _this, + "stphdetun" + is ); m_osc[i].m_sampleBuffer->setAudioFile( _this.attribute( "userwavefile" + is ) ); m_osc[i].waveBtnGrp->setValue( _this.attribute( "wavetype" + diff --git a/plugins/vibed/vibed.cpp b/plugins/vibed/vibed.cpp index 21940bd73..21920a324 100644 --- a/plugins/vibed/vibed.cpp +++ b/plugins/vibed/vibed.cpp @@ -118,8 +118,7 @@ vibed::vibed( instrumentTrack * _channel_track ) : "The 'N' button will normalize the waveform.") ); m_volumeKnob = new volumeKnob( knobBright_26, this, - tr( "Volume" ), - eng() ); + tr( "Volume" ), eng(), _channel_track ); m_volumeKnob->setRange( MIN_VOLUME, MAX_VOLUME, 1.0f ); m_volumeKnob->setInitValue( DEFAULT_VOLUME ); m_volumeKnob->move( 103, 142 ); @@ -135,8 +134,8 @@ vibed::vibed( instrumentTrack * _channel_track ) : "The 'V' knob sets the volume of the selected string." ) ); m_stiffnessKnob = new knob( knobBright_26, this, - tr( "String stiffness" ), - eng() ); + tr( "String stiffness" ), + eng(), _channel_track ); m_stiffnessKnob->setRange( 0.0f, 0.05f, 0.001f ); m_stiffnessKnob->setInitValue( 0.0f ); m_stiffnessKnob->move( 129, 142 ); @@ -156,8 +155,8 @@ vibed::vibed( instrumentTrack * _channel_track ) : m_pickKnob = new knob( knobBright_26, this, - tr( "Pick position" ), - eng() ); + tr( "Pick position" ), + eng(), _channel_track ); m_pickKnob->setRange( 0.0f, 0.5f, 0.005f ); m_pickKnob->setInitValue( 0.0f ); m_pickKnob->move( 153, 142 ); @@ -174,8 +173,8 @@ vibed::vibed( instrumentTrack * _channel_track ) : "The lower the setting the closer the pick is to the bridge." ) ); m_pickupKnob = new knob( knobBright_26, this, - tr( "Pickup position" ), - eng() ); + tr( "Pickup position" ), + eng(), _channel_track ); m_pickupKnob->setRange( 0.0f, 0.5f, 0.005f ); m_pickupKnob->setInitValue( 0.05f ); m_pickupKnob->move( 177, 142 ); @@ -194,8 +193,7 @@ vibed::vibed( instrumentTrack * _channel_track ) : "pickup is to the bridge." ) ); m_panKnob = new knob( knobBright_26, this, - tr( "Pan" ), - eng() ); + tr( "Pan" ), eng(), _channel_track ); m_panKnob->setRange( -1.0f, 1.0f, 0.01f ); m_panKnob->setInitValue( 0.0f ); m_panKnob->move( 105, 187 ); @@ -212,8 +210,8 @@ vibed::vibed( instrumentTrack * _channel_track ) : "field." ) ); m_detuneKnob = new knob( knobBright_26, this, - tr( "Detune" ), - eng() ); + tr( "Detune" ), + eng(), _channel_track ); m_detuneKnob->setRange( -0.1f, 0.1f, 0.001f ); m_detuneKnob->setInitValue( 0.0f ); m_detuneKnob->move( 150, 187 ); @@ -231,8 +229,8 @@ vibed::vibed( instrumentTrack * _channel_track ) : "will cause the string to sound sharp." ) ); m_randomKnob = new knob( knobBright_26, this, - tr( "Fuzziness" ), - eng() ); + tr( "Fuzziness" ), + eng(), _channel_track ); m_randomKnob->setRange( 0.0f, 0.75f, 0.01f ); m_randomKnob->setInitValue( 0.0f ); m_randomKnob->move( 194, 187 ); @@ -251,8 +249,7 @@ vibed::vibed( instrumentTrack * _channel_track ) : "sound more 'metallic'.") ); m_lengthKnob = new knob( knobBright_26, this, - tr( "Length" ), - eng() ); + tr( "Length" ), eng(), _channel_track ); m_lengthKnob->setRange( 1, 16, 1 ); m_lengthKnob->setInitValue( 1 ); m_lengthKnob->move( 23, 193 ); @@ -430,40 +427,32 @@ void vibed::saveSettings( QDomDocument & _doc, if( m_editors[i]->isOn() ) { name = "volume" + QString::number( i ); - _this.setAttribute( name, QString::number( - m_volumeKnobs[i]->value() ) ); + m_volumeKnobs[i]->saveSettings( _doc, _this, name ); name = "stiffness" + QString::number( i ); - _this.setAttribute( name, QString::number( - m_stiffnessKnobs[i]->value() ) ); + m_stiffnessKnobs[i]->saveSettings( _doc, _this, name ); name = "pick" + QString::number( i ); - _this.setAttribute( name, QString::number( - m_pickKnobs[i]->value() ) ); + m_pickKnobs[i]->saveSettings( _doc, _this, name ); name = "pickup" + QString::number( i ); - _this.setAttribute( name, QString::number( - m_pickupKnobs[i]->value() ) ); + m_pickupKnobs[i]->saveSettings( _doc, _this, name ); name = "octave" + QString::number( i ); _this.setAttribute( name, QString::number( m_harmonics[i]->getSelected() ) ); name = "length" + QString::number( i ); - _this.setAttribute( name, QString::number( - m_lengthKnobs[i]->value() ) ); + m_lengthKnobs[i]->saveSettings( _doc, _this, name ); name = "pan" + QString::number( i ); - _this.setAttribute( name, QString::number( - m_panKnobs[i]->value() ) ); + m_panKnobs[i]->saveSettings( _doc, _this, name ); name = "detune" + QString::number( i ); - _this.setAttribute( name, QString::number( - m_detuneKnobs[i]->value() ) ); + m_detuneKnobs[i]->saveSettings( _doc, _this, name ); name = "slap" + QString::number( i ); - _this.setAttribute( name, QString::number( - m_randomKnobs[i]->value() ) ); + m_randomKnobs[i]->saveSettings( _doc, _this, name ); name = "impulse" + QString::number( i ); _this.setAttribute( name, QString::number( @@ -495,40 +484,32 @@ void vibed::loadSettings( const QDomElement & _this ) if( m_editors[i]->isOn() ) { name = "volume" + QString::number( i ); - m_volumeKnobs[i]->setValue( - _this.attribute( name ).toFloat() ); + m_volumeKnobs[i]->loadSettings( _this, name ); name = "stiffness" + QString::number( i ); - m_stiffnessKnobs[i]->setValue( - _this.attribute( name ).toFloat() ); + m_stiffnessKnobs[i]->loadSettings( _this, name ); name = "pick" + QString::number( i ); - m_pickKnobs[i]->setValue( - _this.attribute( name ).toFloat() ); + m_pickKnobs[i]->loadSettings( _this, name ); name = "pickup" + QString::number( i ); - m_pickupKnobs[i]->setValue( - _this.attribute( name ).toFloat() ); + m_pickupKnobs[i]->loadSettings( _this, name ); name = "octave" + QString::number( i ); m_harmonics[i]->setSelected( _this.attribute( name ).toInt() ); name = "length" + QString::number( i ); - m_lengthKnobs[i]->setValue( - _this.attribute( name ).toFloat() ); + m_lengthKnobs[i]->loadSettings( _this, name ); name = "pan" + QString::number( i ); - m_panKnobs[i]->setValue( - _this.attribute( name ).toFloat() ); + m_panKnobs[i]->loadSettings( _this, name ); name = "detune" + QString::number( i ); - m_detuneKnobs[i]->setValue( - _this.attribute( name ).toFloat() ); + m_detuneKnobs[i]->loadSettings( _this, name ); name = "slap" + QString::number( i ); - m_randomKnobs[i]->setValue( - _this.attribute( name ).toFloat() ); + m_randomKnobs[i]->loadSettings( _this, name ); name = "impulse" + QString::number( i ); m_impulses[i]->setChecked( diff --git a/src/core/arp_and_chords_tab_widget.cpp b/src/core/arp_and_chords_tab_widget.cpp index 2958ebf22..9f4506bf6 100644 --- a/src/core/arp_and_chords_tab_widget.cpp +++ b/src/core/arp_and_chords_tab_widget.cpp @@ -217,7 +217,8 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( instrumentTrack * _instrument_trac } m_chordRangeKnob = new knob( knobBright_26, m_chordsGroupBox, - tr( "Chord range" ), eng() ); + tr( "Chord range" ), + eng(), _instrument_track ); m_chordRangeKnob->setLabel( tr( "RANGE" ) ); m_chordRangeKnob->setRange( 1.0f, 9.0f, 1.0f ); m_chordRangeKnob->setInitValue( 1.0f ); @@ -269,7 +270,8 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( instrumentTrack * _instrument_trac m_arpRangeKnob = new knob( knobBright_26, m_arpGroupBox, - tr( "Arpeggio range" ), eng() ); + tr( "Arpeggio range" ), + eng(), _instrument_track ); m_arpRangeKnob->setLabel( tr( "RANGE" ) ); m_arpRangeKnob->setRange( 1.0f, 9.0f, 1.0f ); m_arpRangeKnob->setInitValue( 1.0f ); @@ -286,7 +288,8 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( instrumentTrack * _instrument_trac "amount of octaves." ) ); m_arpTimeKnob = new tempoSyncKnob( knobBright_26, m_arpGroupBox, - tr( "Arpeggio time" ), eng() ); + tr( "Arpeggio time" ), + eng(), _instrument_track ); m_arpTimeKnob->setLabel( tr( "TIME" ) ); m_arpTimeKnob->setRange( 25.0f, 2000.0f, 1.0f ); m_arpTimeKnob->setInitValue( 100.0f ); @@ -303,7 +306,8 @@ arpAndChordsTabWidget::arpAndChordsTabWidget( instrumentTrack * _instrument_trac "each arpeggio-tone should be played." ) ); m_arpGateKnob = new knob( knobBright_26, m_arpGroupBox, - tr( "Arpeggio gate" ), eng() ); + tr( "Arpeggio gate" ), + eng(), _instrument_track ); m_arpGateKnob->setLabel( tr( "GATE" ) ); m_arpGateKnob->setRange( 1.0f, 200.0f, 1.0f ); m_arpGateKnob->setInitValue( 100.0f ); @@ -649,13 +653,13 @@ void arpAndChordsTabWidget::saveSettings( QDomDocument & _doc, { _this.setAttribute( "chorddisabled", !m_chordsGroupBox->isActive() ); _this.setAttribute( "chord", m_chordsComboBox->value() ); - _this.setAttribute( "chordrange", m_chordRangeKnob->value() ); + m_chordRangeKnob->saveSettings( _doc, _this, "chordrange" ); _this.setAttribute( "arpdisabled", !m_arpGroupBox->isActive() ); _this.setAttribute( "arp", m_arpComboBox->value() ); - _this.setAttribute( "arprange", m_arpRangeKnob->value() ); - _this.setAttribute( "arptime", m_arpTimeKnob->value() ); - _this.setAttribute( "arpgate", m_arpGateKnob->value() ); + m_arpRangeKnob->saveSettings( _doc, _this, "arprange" ); + m_arpTimeKnob->saveSettings( _doc, _this, "arptime" ); + m_arpGateKnob->saveSettings( _doc, _this, "arpgate" ); _this.setAttribute( "arpdir", m_arpDirectionBtnGrp->value() + 1 ); _this.setAttribute( "arpsyncmode", ( int ) m_arpTimeKnob->getSyncMode() ); @@ -671,11 +675,11 @@ void arpAndChordsTabWidget::loadSettings( const QDomElement & _this ) m_chordsGroupBox->setState( !_this.attribute ( "chorddisabled" ).toInt() ); m_chordsComboBox->setValue( _this.attribute( "chord" ).toInt() ); - m_chordRangeKnob->setValue( _this.attribute( "chordrange" ).toFloat() ); + m_chordRangeKnob->loadSettings( _this, "chordrange" ); m_arpComboBox->setValue( _this.attribute( "arp" ).toInt() ); - m_arpRangeKnob->setValue( _this.attribute( "arprange" ).toFloat() ); - m_arpTimeKnob->setValue( _this.attribute( "arptime" ).toFloat() ); - m_arpGateKnob->setValue( _this.attribute( "arpgate" ).toFloat() ); + m_arpRangeKnob->loadSettings( _this, "arprange" ); + m_arpTimeKnob->loadSettings( _this, "arptime" ); + m_arpGateKnob->loadSettings( _this, "arpgate" ); m_arpDirectionBtnGrp->setInitValue( _this.attribute( "arpdir" ).toInt() - 1 ); m_arpTimeKnob->setSyncMode( diff --git a/src/core/envelope_tab_widget.cpp b/src/core/envelope_tab_widget.cpp index f0679509e..f9b37b327 100644 --- a/src/core/envelope_tab_widget.cpp +++ b/src/core/envelope_tab_widget.cpp @@ -121,7 +121,8 @@ envelopeTabWidget::envelopeTabWidget( instrumentTrack * _instrument_track ) : m_envLFOWidgets[i] = new envelopeAndLFOWidget( value_for_zero_amount, m_targetsTabWidget, - eng() ); + eng(), + _instrument_track ); m_targetsTabWidget->addTab( m_envLFOWidgets[i], tr( targetNames[i][0] #ifdef QT4 @@ -173,8 +174,9 @@ envelopeTabWidget::envelopeTabWidget( instrumentTrack * _instrument_track ) : "for changing the characteristics of a sound." ) ); - m_filterCutKnob = new knob( knobBright_26, m_filterGroupBox, tr( - "cutoff-frequency" ), eng() ); + m_filterCutKnob = new knob( knobBright_26, m_filterGroupBox, + tr( "cutoff-frequency" ), + eng(), _instrument_track ); m_filterCutKnob->setLabel( tr( "CUTOFF" ) ); m_filterCutKnob->setRange( 0.0, 14000.0, 1.0 ); m_filterCutKnob->move( 140, 18 ); @@ -193,8 +195,9 @@ envelopeTabWidget::envelopeTabWidget( instrumentTrack * _instrument_track ) : "the cutoff-frequency. A highpass-filter cuts all " "frequencies below cutoff-frequency and so on..." ) ); - m_filterResKnob = new knob( knobBright_26, m_filterGroupBox, tr( - "Q/Resonance" ), eng() ); + m_filterResKnob = new knob( knobBright_26, m_filterGroupBox, + tr( "Q/Resonance" ), + eng(), _instrument_track ); m_filterResKnob->setLabel( tr( "Q/RESO" ) ); m_filterResKnob->setRange( 0.01, 10.0, 0.01 ); m_filterResKnob->move( 190, 18 ); @@ -502,8 +505,8 @@ f_cnt_t envelopeTabWidget::releaseFrames( const bool _only_vol ) void envelopeTabWidget::saveSettings( QDomDocument & _doc, QDomElement & _this ) { _this.setAttribute( "ftype", m_filterComboBox->value() ); - _this.setAttribute( "fcut", m_filterCutKnob->value() ); - _this.setAttribute( "fres", m_filterResKnob->value() ); + m_filterCutKnob->saveSettings( _doc, _this, "fcut" ); + m_filterResKnob->saveSettings( _doc, _this, "fres" ); _this.setAttribute( "fwet", m_filterGroupBox->isActive() ); for( int i = 0; i < TARGET_COUNT; ++i ) @@ -520,8 +523,8 @@ void envelopeTabWidget::saveSettings( QDomDocument & _doc, QDomElement & _this ) void envelopeTabWidget::loadSettings( const QDomElement & _this ) { m_filterComboBox->setValue( _this.attribute( "ftype" ).toInt() ); - m_filterCutKnob->setValue( _this.attribute( "fcut" ).toFloat() ); - m_filterResKnob->setValue( _this.attribute( "fres" ).toFloat() ); + m_filterCutKnob->loadSettings( _this, "fcut" ); + m_filterResKnob->loadSettings( _this, "fres" ); /* m_filterState->setChecked( _this.attribute( "fwet" ).toInt() );*/ m_filterGroupBox->setState( _this.attribute( "fwet" ).toInt() );