1 /*
2 * delaycontrols.cpp - definition of DelayControls class.
3 *
4 * Copyright (c) 2014 David French <dave/dot/french3/at/googlemail/dot/com>
5 *
6 * This file is part of LMMS - https://lmms.io
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public
19 * License along with this program (see COPYING); if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 * Boston, MA 02110-1301 USA.
22 *
23 */
24
25 #include <QtXml/QDomElement>
26
27 #include "DelayControls.h"
28 #include "DelayEffect.h"
29 #include "Engine.h"
30 #include "Song.h"
31
DelayControls(DelayEffect * effect)32 DelayControls::DelayControls( DelayEffect* effect ):
33 EffectControls( effect ),
34 m_effect ( effect ),
35 m_delayTimeModel( 0.5, 0.01, 5.0, 0.0001, 5000.0, this, tr( "Delay Samples" )) ,
36 m_feedbackModel(0.0f,0.0f,1.0f,0.01f,this,tr( "Feedback" ) ),
37 m_lfoTimeModel(2.0, 0.01, 5.0, 0.0001, 20000.0, this, tr( "Lfo Frequency" ) ),
38 m_lfoAmountModel(0.0, 0.0, 0.5, 0.0001, 2000.0, this, tr ( "Lfo Amount" ) ),
39 m_outGainModel( 0.0, -60.0, 20.0, 0.01, this, tr( "Output gain" ) )
40 {
41 connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( changeSampleRate() ) );
42 m_outPeakL = 0.0;
43 m_outPeakR = 0.0;
44 }
45
46
47
48
loadSettings(const QDomElement & _this)49 void DelayControls::loadSettings( const QDomElement &_this )
50 {
51 m_delayTimeModel.loadSettings(_this, "DelayTimeSamples" );
52 m_feedbackModel.loadSettings( _this, "FeebackAmount" );
53 m_lfoTimeModel.loadSettings( _this , "LfoFrequency");
54 m_lfoAmountModel.loadSettings( _this, "LfoAmount");
55 m_outGainModel.loadSettings( _this, "OutGain" );
56 }
57
58
59
60
saveSettings(QDomDocument & doc,QDomElement & _this)61 void DelayControls::saveSettings( QDomDocument& doc, QDomElement& _this )
62 {
63 m_delayTimeModel.saveSettings( doc, _this, "DelayTimeSamples" );
64 m_feedbackModel.saveSettings( doc, _this ,"FeebackAmount" );
65 m_lfoTimeModel.saveSettings( doc, _this, "LfoFrequency" );
66 m_lfoAmountModel.saveSettings( doc, _this ,"LfoAmount" );
67 m_outGainModel.saveSettings( doc, _this, "OutGain" );
68 }
69
70
71
changeSampleRate()72 void DelayControls::changeSampleRate()
73 {
74 m_effect->changeSampleRate();
75 }
76