diff --git a/include/knob.h b/include/knob.h index 2c6d8de07..81141220d 100644 --- a/include/knob.h +++ b/include/knob.h @@ -58,6 +58,8 @@ class EXPORT knob : public QWidget, public FloatModelView // correctly so we need to do this: Q_PROPERTY(QColor outerColor READ outerColor WRITE setOuterColor) mapPropertyFromModel(bool,isVolumeKnob,setVolumeKnob,m_volumeKnob); + mapPropertyFromModel(float,volumeRatio,setVolumeRatio,m_volumeRatio); + public: knob( int _knob_num, QWidget * _parent = NULL, const QString & _name = QString() ); virtual ~knob(); @@ -149,6 +151,7 @@ private: QPixmap * m_knobPixmap; BoolModel m_volumeKnob; + FloatModel m_volumeRatio; QPoint m_mouseOffset; QPoint m_origMousePos; diff --git a/plugins/Amplifier/Amplifier.cpp b/plugins/Amplifier/Amplifier.cpp new file mode 100644 index 000000000..380fde0ef --- /dev/null +++ b/plugins/Amplifier/Amplifier.cpp @@ -0,0 +1,125 @@ +/* + * Amplifier.cpp - A native amplifier effect plugin with sample-exact amplification + * + * Copyright (c) 2014 Vesa Kivimäki + * Copyright (c) 2006-2014 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include "Amplifier.h" + +#include "embed.cpp" + + +extern "C" +{ + +Plugin::Descriptor PLUGIN_EXPORT amplifier_plugin_descriptor = +{ + STRINGIFY( PLUGIN_NAME ), + "Amplifier", + QT_TRANSLATE_NOOP( "pluginBrowser", "A native amplifier plugin" ), + "Vesa Kivimäki ", + 0x0100, + Plugin::Effect, + new PluginPixmapLoader( "logo" ), + NULL, + NULL +} ; + +} + + + +AmplifierEffect::AmplifierEffect( Model* parent, const Descriptor::SubPluginFeatures::Key* key ) : + Effect( &lifier_plugin_descriptor, parent, key ), + m_ampControls( this ) +{ +} + + + + +AmplifierEffect::~AmplifierEffect() +{ +} + + + + +bool AmplifierEffect::processAudioBuffer( sampleFrame* buf, const fpp_t frames ) +{ + if( !isEnabled() || !isRunning () ) + { + return( false ); + } + + double outSum = 0.0; + const float d = dryLevel(); + const float w = wetLevel(); + for( fpp_t f = 0; f < frames; ++f ) + { +// qDebug( "offset %d, value %f", f, m_ampControls.m_volumeModel.value( f ) ); + + sample_t s[2] = { buf[f][0], buf[f][1] }; + + // convert vol/pan values to left/right values + const float left1 = m_ampControls.m_volumeModel.value( f ) * + ( m_ampControls.m_panModel.value( f ) <= 0 + ? 1.0 + : 1.0 - m_ampControls.m_panModel.value( f ) / 100.0 ); + const float right1 = m_ampControls.m_volumeModel.value( f ) * + ( m_ampControls.m_panModel.value( f ) >= 0 + ? 1.0 + : 1.0 + m_ampControls.m_panModel.value( f ) / 100.0 ); + + // first stage amplification + s[0] *= ( left1 / 100.0 ); + s[1] *= ( right1 / 100.0 ); + + // second stage amplification + s[0] *= ( m_ampControls.m_leftModel.value( f ) / 100.0 ); + s[1] *= ( m_ampControls.m_rightModel.value( f ) / 100.0 ); + + buf[f][0] = d * buf[f][0] + w * s[0]; + buf[f][1] = d * buf[f][1] + w * s[1]; + outSum += buf[f][0]*buf[f][0] + buf[f][1]*buf[f][1]; + } + + checkGate( outSum / frames ); + + return isRunning(); +} + + + + + +extern "C" +{ + +// necessary for getting instance out of shared lib +Plugin * PLUGIN_EXPORT lmms_plugin_main( Model* parent, void* data ) +{ + return new AmplifierEffect( parent, static_cast( data ) ); +} + +} + diff --git a/plugins/Amplifier/Amplifier.h b/plugins/Amplifier/Amplifier.h new file mode 100644 index 000000000..e9a78e9d5 --- /dev/null +++ b/plugins/Amplifier/Amplifier.h @@ -0,0 +1,54 @@ +/* + * Amplifier.h - amplifier-effect-plugin + * + * Copyright (c) 2014 Vesa Kivimäki + * Copyright (c) 2006-2014 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef AMPLIFIER_H +#define AMPLIFIER_H + +#include "Effect.h" +#include "AmplifierControls.h" + + +class AmplifierEffect : public Effect +{ +public: + AmplifierEffect( Model* parent, const Descriptor::SubPluginFeatures::Key* key ); + virtual ~AmplifierEffect(); + virtual bool processAudioBuffer( sampleFrame* buf, const fpp_t frames ); + + virtual EffectControls* controls() + { + return &m_ampControls; + } + + +private: + AmplifierControls m_ampControls; + + friend class AmplifierControls; + +} ; + +#endif diff --git a/plugins/Amplifier/AmplifierControlDialog.cpp b/plugins/Amplifier/AmplifierControlDialog.cpp new file mode 100644 index 000000000..752601765 --- /dev/null +++ b/plugins/Amplifier/AmplifierControlDialog.cpp @@ -0,0 +1,69 @@ +/* + * AmplifierControlDialog.cpp - control dialog for amplifier effect + * + * Copyright (c) 2014 Vesa Kivimäki + * Copyright (c) 2006-2014 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include + +#include "AmplifierControlDialog.h" +#include "AmplifierControls.h" +#include "embed.h" + + + +AmplifierControlDialog::AmplifierControlDialog( AmplifierControls* controls ) : + EffectControlDialog( controls ) +{ + setAutoFillBackground( true ); + QPalette pal; + pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); + setPalette( pal ); + setFixedSize( 100, 125 ); + + knob * volumeKnob = new knob( knobBright_26, this); + volumeKnob -> move( 20, 30 ); + volumeKnob -> setVolumeKnob( true ); + volumeKnob->setModel( &controls->m_volumeModel ); + volumeKnob->setLabel( tr( "VOL" ) ); + volumeKnob->setHintText( tr( "Volume:" ) + " ", "%" ); + + knob * panKnob = new knob( knobBright_26, this); + panKnob -> move( 60, 30 ); + panKnob->setModel( &controls->m_panModel ); + panKnob->setLabel( tr( "PAN" ) ); + panKnob->setHintText( tr( "Panning:" ) + " ", "" ); + + knob * leftKnob = new knob( knobBright_26, this); + leftKnob -> move( 20, 80 ); + leftKnob -> setVolumeKnob( true ); + leftKnob->setModel( &controls->m_leftModel ); + leftKnob->setLabel( tr( "LEFT" ) ); + leftKnob->setHintText( tr( "Left gain:" ) + " ", "%" ); + + knob * rightKnob = new knob( knobBright_26, this); + rightKnob -> move( 60, 80 ); + rightKnob -> setVolumeKnob( true ); + rightKnob->setModel( &controls->m_rightModel ); + rightKnob->setLabel( tr( "RIGHT" ) ); + rightKnob->setHintText( tr( "Right gain:" ) + " ", "%" ); +} diff --git a/plugins/Amplifier/AmplifierControlDialog.h b/plugins/Amplifier/AmplifierControlDialog.h new file mode 100644 index 000000000..41409c674 --- /dev/null +++ b/plugins/Amplifier/AmplifierControlDialog.h @@ -0,0 +1,45 @@ +/* + * AmplifierControlDialog.h - control dialog for amplifier effect + * + * Copyright (c) 2014 Vesa Kivimäki + * Copyright (c) 2006-2014 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#ifndef AMPLIFIER_CONTROL_DIALOG_H +#define AMPLIFIER_CONTROL_DIALOG_H + +#include "EffectControlDialog.h" + + +class AmplifierControls; + + +class AmplifierControlDialog : public EffectControlDialog +{ +public: + AmplifierControlDialog( AmplifierControls* controls ); + virtual ~AmplifierControlDialog() + { + } + +} ; + +#endif diff --git a/plugins/Amplifier/AmplifierControls.cpp b/plugins/Amplifier/AmplifierControls.cpp new file mode 100644 index 000000000..f06876e1e --- /dev/null +++ b/plugins/Amplifier/AmplifierControls.cpp @@ -0,0 +1,82 @@ +/* + * AmplifierControls.cpp - controls for amplifier effect + * + * Copyright (c) 2014 Vesa Kivimäki + * Copyright (c) 2008-2014 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include + +#include "AmplifierControls.h" +#include "Amplifier.h" +#include "engine.h" +#include "song.h" + + +AmplifierControls::AmplifierControls( AmplifierEffect* effect ) : + EffectControls( effect ), + m_effect( effect ), + m_volumeModel( 100.0f, 0.0f, 200.0f, 0.1f, this, tr( "Volume" ) ), + m_panModel( 0.0f, -100.0f, 100.0f, 0.1f, this, tr( "Panning" ) ), + m_leftModel( 100.0f, 0.0f, 200.0f, 0.1f, this, tr( "Left gain" ) ), + m_rightModel( 100.0f, 0.0f, 200.0f, 0.1f, this, tr( "Right gain" ) ) +{ + connect( &m_volumeModel, SIGNAL( dataChanged() ), this, SLOT( changeControl() ) ); + connect( &m_panModel, SIGNAL( dataChanged() ), this, SLOT( changeControl() ) ); + connect( &m_leftModel, SIGNAL( dataChanged() ), this, SLOT( changeControl() ) ); + connect( &m_rightModel, SIGNAL( dataChanged() ), this, SLOT( changeControl() ) ); +} + + + + +void AmplifierControls::changeControl() +{ + engine::getSong()->setModified(); +} + + + + +void AmplifierControls::loadSettings( const QDomElement& _this ) +{ + m_volumeModel.loadSettings( _this, "volume" ); + m_panModel.loadSettings( _this, "pan" ); + m_leftModel.loadSettings( _this, "left" ); + m_rightModel.loadSettings( _this, "right" ); +} + + + + +void AmplifierControls::saveSettings( QDomDocument& doc, QDomElement& _this ) +{ + m_volumeModel.saveSettings( doc, _this, "volume" ); + m_panModel.saveSettings( doc, _this, "pan" ); + m_leftModel.saveSettings( doc, _this, "left" ); + m_rightModel.saveSettings( doc, _this, "right" ); +} + + + +#include "moc_AmplifierControls.cxx" + diff --git a/plugins/Amplifier/AmplifierControls.h b/plugins/Amplifier/AmplifierControls.h new file mode 100644 index 000000000..2640c8aca --- /dev/null +++ b/plugins/Amplifier/AmplifierControls.h @@ -0,0 +1,79 @@ +/* + * AmplifierControls.h - controls for bassboosterx -effect + * + * Copyright (c) 2014 Vesa Kivimäki + * Copyright (c) 2008-2014 Tobias Doerffel + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#ifndef AMPLIFIER_CONTROLS_H +#define AMPLIFIER_CONTROLS_H + +#include "EffectControls.h" +#include "AmplifierControlDialog.h" +#include "knob.h" + + +class AmplifierEffect; + + +class AmplifierControls : public EffectControls +{ + Q_OBJECT +public: + AmplifierControls( AmplifierEffect* effect ); + virtual ~AmplifierControls() + { + } + + virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent ); + virtual void loadSettings( const QDomElement & _this ); + inline virtual QString nodeName() const + { + return "AmplifierControls"; + } + + virtual int controlCount() + { + return 4; + } + + virtual EffectControlDialog* createView() + { + return new AmplifierControlDialog( this ); + } + + +private slots: + void changeControl(); + +private: + AmplifierEffect* m_effect; + FloatModel m_volumeModel; + FloatModel m_panModel; + FloatModel m_leftModel; + FloatModel m_rightModel; + + friend class AmplifierControlDialog; + friend class AmplifierEffect; + +} ; + +#endif diff --git a/plugins/Amplifier/CMakeLists.txt b/plugins/Amplifier/CMakeLists.txt new file mode 100644 index 000000000..8d9ac96c2 --- /dev/null +++ b/plugins/Amplifier/CMakeLists.txt @@ -0,0 +1,3 @@ +INCLUDE(BuildPlugin) + +BUILD_PLUGIN(amplifier Amplifier.cpp AmplifierControls.cpp AmplifierControlDialog.cpp MOCFILES AmplifierControls.h EMBEDDED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.png") diff --git a/plugins/Amplifier/artwork.png b/plugins/Amplifier/artwork.png new file mode 100644 index 000000000..9750296a9 Binary files /dev/null and b/plugins/Amplifier/artwork.png differ diff --git a/plugins/Amplifier/logo.png b/plugins/Amplifier/logo.png new file mode 100644 index 000000000..89e9f3680 Binary files /dev/null and b/plugins/Amplifier/logo.png differ diff --git a/plugins/BassBooster/BassBoosterControls.cpp b/plugins/BassBooster/BassBoosterControls.cpp index f1c7184c8..321d6dd22 100644 --- a/plugins/BassBooster/BassBoosterControls.cpp +++ b/plugins/BassBooster/BassBoosterControls.cpp @@ -81,9 +81,9 @@ void BassBoosterControls::changeRatio() void BassBoosterControls::loadSettings( const QDomElement& _this ) { - m_freqModel.setValue( _this.attribute( "freq" ).toFloat() ); - m_gainModel.setValue( _this.attribute( "gain" ).toFloat() ); - m_ratioModel.setValue( _this.attribute( "ratio" ).toFloat() ); + m_freqModel.loadSettings( _this, "freq" ); + m_gainModel.loadSettings( _this, "gain" ); + m_ratioModel.loadSettings( _this, "ratio"); } @@ -91,9 +91,9 @@ void BassBoosterControls::loadSettings( const QDomElement& _this ) void BassBoosterControls::saveSettings( QDomDocument& doc, QDomElement& _this ) { - _this.setAttribute( "freq", m_freqModel.value() ); - _this.setAttribute( "gain", m_gainModel.value() ); - _this.setAttribute( "ratio", m_ratioModel.value() ); + m_freqModel.saveSettings( doc, _this, "freq" ); + m_gainModel.saveSettings( doc, _this, "gain" ); + m_ratioModel.saveSettings( doc, _this, "ratio"); } diff --git a/plugins/BassBooster/artwork.png b/plugins/BassBooster/artwork.png index 23e2be7b3..55ef058ff 100644 Binary files a/plugins/BassBooster/artwork.png and b/plugins/BassBooster/artwork.png differ diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 71c07501e..e8027e2ba 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -1,3 +1,4 @@ +ADD_SUBDIRECTORY(Amplifier) ADD_SUBDIRECTORY(audio_file_processor) ADD_SUBDIRECTORY(BassBooster) ADD_SUBDIRECTORY(bit_invader) diff --git a/plugins/dynamics_processor/dynamics_processor_control_dialog.cpp b/plugins/dynamics_processor/dynamics_processor_control_dialog.cpp index 6fcb1d1d6..e92e8e6d0 100644 --- a/plugins/dynamics_processor/dynamics_processor_control_dialog.cpp +++ b/plugins/dynamics_processor/dynamics_processor_control_dialog.cpp @@ -58,12 +58,16 @@ dynProcControlDialog::dynProcControlDialog( waveGraph -> setMaximumSize( 204, 205 ); knob * inputKnob = new knob( knobBright_26, this); + inputKnob -> setVolumeKnob( true ); + inputKnob -> setVolumeRatio( 1.0 ); inputKnob -> move( 14, 251 ); inputKnob->setModel( &_controls->m_inputModel ); inputKnob->setLabel( tr( "INPUT" ) ); inputKnob->setHintText( tr( "Input gain:" ) + " ", "" ); knob * outputKnob = new knob( knobBright_26, this ); + outputKnob -> setVolumeKnob( true ); + outputKnob -> setVolumeRatio( 1.0 ); outputKnob -> move( 54, 251 ); outputKnob->setModel( &_controls->m_outputModel ); outputKnob->setLabel( tr( "OUTPUT" ) ); diff --git a/plugins/dynamics_processor/dynamics_processor_controls.cpp b/plugins/dynamics_processor/dynamics_processor_controls.cpp index 614aed8e9..6d0a34672 100644 --- a/plugins/dynamics_processor/dynamics_processor_controls.cpp +++ b/plugins/dynamics_processor/dynamics_processor_controls.cpp @@ -86,11 +86,11 @@ void dynProcControls::samplesChanged( int _begin, int _end) void dynProcControls::loadSettings( const QDomElement & _this ) { //load knobs, stereomode - m_inputModel.setValue( _this.attribute( "inputGain" ).toFloat() ); - m_outputModel.setValue( _this.attribute( "outputGain" ).toFloat() ); - m_attackModel.setValue( _this.attribute( "attack" ).toFloat() ); - m_releaseModel.setValue( _this.attribute( "release" ).toFloat() ); - m_stereomodeModel.setValue( _this.attribute( "stereoMode" ).toInt() ); + m_inputModel.loadSettings( _this, "inputGain" ); + m_outputModel.loadSettings( _this, "outputGain" ); + m_attackModel.loadSettings( _this, "attack" ); + m_releaseModel.loadSettings( _this, "release" ); + m_stereomodeModel.loadSettings( _this, "stereoMode" ); //load waveshape int size = 0; @@ -109,11 +109,11 @@ void dynProcControls::saveSettings( QDomDocument & _doc, QDomElement & _this ) { //save input, output knobs - _this.setAttribute( "inputGain", m_inputModel.value() ); - _this.setAttribute( "outputGain", m_outputModel.value() ); - _this.setAttribute( "attack", m_attackModel.value() ); - _this.setAttribute( "release", m_releaseModel.value() ); - _this.setAttribute( "stereoMode", m_stereomodeModel.value() ); + m_inputModel.saveSettings( _doc, _this, "inputGain" ); + m_outputModel.saveSettings( _doc, _this, "outputGain" ); + m_attackModel.saveSettings( _doc, _this, "attack" ); + m_releaseModel.saveSettings( _doc, _this, "release" ); + m_stereomodeModel.saveSettings( _doc, _this, "stereoMode" ); //save waveshape diff --git a/plugins/stereo_enhancer/stereoenhancer_controls.cpp b/plugins/stereo_enhancer/stereoenhancer_controls.cpp index 8f6941156..4ea92c65e 100644 --- a/plugins/stereo_enhancer/stereoenhancer_controls.cpp +++ b/plugins/stereo_enhancer/stereoenhancer_controls.cpp @@ -51,7 +51,7 @@ void stereoEnhancerControls::changeWideCoeff() void stereoEnhancerControls::loadSettings( const QDomElement & _this ) { - m_widthModel.setValue( _this.attribute( "width" ).toFloat() ); + m_widthModel.loadSettings( _this, "width" ); } @@ -60,7 +60,7 @@ void stereoEnhancerControls::loadSettings( const QDomElement & _this ) void stereoEnhancerControls::saveSettings( QDomDocument & _doc, QDomElement & _this ) { - _this.setAttribute( "width", m_widthModel.value() ); + m_widthModel.saveSettings( _doc, _this, "width" ); } diff --git a/plugins/stereo_matrix/stereomatrix_controls.cpp b/plugins/stereo_matrix/stereomatrix_controls.cpp index 6353063fd..69f60e7c9 100644 --- a/plugins/stereo_matrix/stereomatrix_controls.cpp +++ b/plugins/stereo_matrix/stereomatrix_controls.cpp @@ -59,10 +59,10 @@ void stereoMatrixControls::changeMatrix() void stereoMatrixControls::loadSettings( const QDomElement & _this ) { - m_llModel.setValue( _this.attribute( "l-l" ).toFloat() ); - m_lrModel.setValue( _this.attribute( "l-r" ).toFloat() ); - m_rlModel.setValue( _this.attribute( "r-l" ).toFloat() ); - m_rrModel.setValue( _this.attribute( "r-r" ).toFloat() ); + m_llModel.loadSettings( _this, "l-l" ); + m_lrModel.loadSettings( _this, "l-r" ); + m_rlModel.loadSettings( _this, "r-l" ); + m_rrModel.loadSettings( _this, "r-r" ); } @@ -71,10 +71,10 @@ void stereoMatrixControls::loadSettings( const QDomElement & _this ) void stereoMatrixControls::saveSettings( QDomDocument & _doc, QDomElement & _this ) { - _this.setAttribute( "l-l", m_llModel.value() ); - _this.setAttribute( "l-r", m_lrModel.value() ); - _this.setAttribute( "r-l", m_rlModel.value() ); - _this.setAttribute( "r-r", m_rrModel.value() ); + m_llModel.saveSettings( _doc, _this, "l-l" ); + m_lrModel.saveSettings( _doc, _this, "l-r" ); + m_rlModel.saveSettings( _doc, _this, "r-l" ); + m_rrModel.saveSettings( _doc, _this, "r-r" ); } diff --git a/plugins/waveshaper/waveshaper_control_dialog.cpp b/plugins/waveshaper/waveshaper_control_dialog.cpp index 5adb373de..b32b5b211 100644 --- a/plugins/waveshaper/waveshaper_control_dialog.cpp +++ b/plugins/waveshaper/waveshaper_control_dialog.cpp @@ -58,12 +58,16 @@ waveShaperControlDialog::waveShaperControlDialog( waveGraph -> setMaximumSize( 204, 205 ); knob * inputKnob = new knob( knobBright_26, this); + inputKnob -> setVolumeKnob( true ); + inputKnob -> setVolumeRatio( 1.0 ); inputKnob -> move( 14, 251 ); inputKnob->setModel( &_controls->m_inputModel ); inputKnob->setLabel( tr( "INPUT" ) ); inputKnob->setHintText( tr( "Input gain:" ) + " ", "" ); knob * outputKnob = new knob( knobBright_26, this ); + outputKnob -> setVolumeKnob( true ); + outputKnob -> setVolumeRatio( 1.0 ); outputKnob -> move( 54, 251 ); outputKnob->setModel( &_controls->m_outputModel ); outputKnob->setLabel( tr( "OUTPUT" ) ); diff --git a/plugins/waveshaper/waveshaper_controls.cpp b/plugins/waveshaper/waveshaper_controls.cpp index dd06f75e4..39e30d273 100644 --- a/plugins/waveshaper/waveshaper_controls.cpp +++ b/plugins/waveshaper/waveshaper_controls.cpp @@ -88,8 +88,8 @@ void waveShaperControls::samplesChanged( int _begin, int _end) void waveShaperControls::loadSettings( const QDomElement & _this ) { //load input, output knobs - m_inputModel.setValue( _this.attribute( "inputGain" ).toFloat() ); - m_outputModel.setValue( _this.attribute( "outputGain" ).toFloat() ); + m_inputModel.loadSettings( _this, "inputGain" ); + m_outputModel.loadSettings( _this, "outputGain" ); m_clipModel.loadSettings( _this, "clipInput" ); @@ -110,9 +110,9 @@ void waveShaperControls::saveSettings( QDomDocument & _doc, QDomElement & _this ) { //save input, output knobs - _this.setAttribute( "inputGain", m_inputModel.value() ); - _this.setAttribute( "outputGain", m_outputModel.value() ); - + m_inputModel.saveSettings( _doc, _this, "inputGain" ); + m_outputModel.saveSettings( _doc, _this, "outputGain" ); + m_clipModel.saveSettings( _doc, _this, "clipInput" ); //save waveshape diff --git a/src/gui/widgets/knob.cpp b/src/gui/widgets/knob.cpp index 074f32813..73f00d84a 100644 --- a/src/gui/widgets/knob.cpp +++ b/src/gui/widgets/knob.cpp @@ -61,6 +61,7 @@ knob::knob( int _knob_num, QWidget * _parent, const QString & _name ) : m_label( "" ), m_knobPixmap( NULL ), m_volumeKnob( false ), + m_volumeRatio( 100.0, 0.0, 1000000.0 ), m_buttonPressed( false ), m_angle( -10 ), m_outerColor( NULL ) @@ -668,7 +669,7 @@ QString knob::displayValue() const configManager::inst()->value( "app", "displaydbv" ).toInt() ) { return m_description.trimmed() + QString( " %1 dBV" ). - arg( 20.0 * log10( model()->value() / 100.0 ), + arg( 20.0 * log10( model()->value() / volumeRatio() ), 3, 'f', 2 ); } return m_description.trimmed() + QString( " %1" ).