From bc8896b4efc90ceed26f4f7dd6bbbd44ed8d4e10 Mon Sep 17 00:00:00 2001 From: dave Date: Wed, 26 Nov 2014 19:59:57 +0000 Subject: [PATCH] inital commit, with new lmms class names --- plugins/CMakeLists.txt | 1 + plugins/flanger/CMakeLists.txt | 3 + plugins/flanger/artwork.png | Bin 0 -> 10590 bytes plugins/flanger/flangercontrols.cpp | 83 ++++++++++++ plugins/flanger/flangercontrols.h | 75 +++++++++++ plugins/flanger/flangercontrolsdialog.cpp | 82 ++++++++++++ plugins/flanger/flangercontrolsdialog.h | 41 ++++++ plugins/flanger/flangereffect.cpp | 150 ++++++++++++++++++++++ plugins/flanger/flangereffect.h | 57 ++++++++ plugins/flanger/logo.png | Bin 0 -> 3225 bytes plugins/flanger/monodelay.cpp | 89 +++++++++++++ plugins/flanger/monodelay.h | 60 +++++++++ plugins/flanger/noise.cpp | 39 ++++++ plugins/flanger/noise.h | 37 ++++++ plugins/flanger/quadraturelfo.cpp | 49 +++++++ plugins/flanger/quadraturelfo.h | 81 ++++++++++++ 16 files changed, 847 insertions(+) create mode 100644 plugins/flanger/CMakeLists.txt create mode 100644 plugins/flanger/artwork.png create mode 100644 plugins/flanger/flangercontrols.cpp create mode 100644 plugins/flanger/flangercontrols.h create mode 100644 plugins/flanger/flangercontrolsdialog.cpp create mode 100644 plugins/flanger/flangercontrolsdialog.h create mode 100644 plugins/flanger/flangereffect.cpp create mode 100644 plugins/flanger/flangereffect.h create mode 100644 plugins/flanger/logo.png create mode 100644 plugins/flanger/monodelay.cpp create mode 100644 plugins/flanger/monodelay.h create mode 100644 plugins/flanger/noise.cpp create mode 100644 plugins/flanger/noise.h create mode 100644 plugins/flanger/quadraturelfo.cpp create mode 100644 plugins/flanger/quadraturelfo.h diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 4f4a668e7..bb028b49e 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -8,6 +8,7 @@ ADD_SUBDIRECTORY(carlarack) ADD_SUBDIRECTORY(delay) ADD_SUBDIRECTORY(DualFilter) ADD_SUBDIRECTORY(dynamics_processor) +ADD_SUBDIRECTORY(flanger) ADD_SUBDIRECTORY(flp_import) ADD_SUBDIRECTORY(HydrogenImport) ADD_SUBDIRECTORY(kicker) diff --git a/plugins/flanger/CMakeLists.txt b/plugins/flanger/CMakeLists.txt new file mode 100644 index 000000000..bb3579e73 --- /dev/null +++ b/plugins/flanger/CMakeLists.txt @@ -0,0 +1,3 @@ +INCLUDE(BuildPlugin) + +BUILD_PLUGIN(flanger flangereffect.cpp flangercontrols.cpp flangercontrolsdialog.cpp noise.cpp quadraturelfo.cpp monodelay.cpp MOCFILES flangercontrols.h EMBEDDED_RESOURCES "${CMAKE_CURRENT_SOURCE_DIR}/*.png") diff --git a/plugins/flanger/artwork.png b/plugins/flanger/artwork.png new file mode 100644 index 0000000000000000000000000000000000000000..239bc219e696d254ea21c735b5a938523828df57 GIT binary patch literal 10590 zcmV-kDWTShP)e zSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{03ZNKL_t(|+UDI0003XV?abOWZV}3i2NG>h6o^1-&t!RH~E>F)v?U1 zUi0tLAHeL+W5xGC*vDWnz>L9KfWx_Lwm;oJGsChwHtdu4%gp|Lx(48n6`K*y69>tU z6B##lL~!E-Lf`jpf7mCF0io**0MftruK+L_jodR3V2p|T38co4#Jr?AB^W=aVV^Pj zp5-&-8xh5Ech^E3A3bJ%>;bUV<24LJ{0#xHY{8cGxN`b_uolb~*0MkU5b42Mi(#2(&W{gZi_Bb;mJBnsC>&=)=H;r)J3rtjA0eIah|W?|Mb>L{u4| zwQZ76TU*z4={eW{{y`xoW9l`)k=PmsWa9y(M`W0;bApBlPJS3qgoLx*h=A4A)kxTm z*v0t?81q(6fv;?9=Nc*GY5?X|r!Nl=5`E4-^2BK1Puw{Qc3}S*Y7S=iq z!C)8|{rutDApa~V_gTOi_Z*|qC^Dcir3Q*xgDCq;S`|Xu1i|R$MKXK2S<9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7|3d$bhM zFd4*plCT=l#Bm*&QNbv!ZeXow{r}6&`5;Xl8>SO49IUJz|6BkPVOh0|n*_g? zd3Ni(st6Qca-MUA6crB|ni)W6V$~Aq%Nm~z96l4XEOI6wC)duSz z24(AEQthgk)ZqloWDtQvk?tM{I0$I}J2JjzE_=;mTq2>b6Y2=uzk(T~P_{<|5M`Vr s#6d!IeKHJSU%|yCP07*qoM6N<$f&?o#wEzGB literal 0 HcmV?d00001 diff --git a/plugins/flanger/flangercontrols.cpp b/plugins/flanger/flangercontrols.cpp new file mode 100644 index 000000000..d7271c833 --- /dev/null +++ b/plugins/flanger/flangercontrols.cpp @@ -0,0 +1,83 @@ +/* + * flangercontrols.cpp - defination of FlangerControls class. + * + * Copyright (c) 2014 David French + * + * This file is part of LMMS - http://lmms.io + * + * 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 "flangercontrols.h" +#include "flangereffect.h" +#include "Engine.h" +#include "Song.h" + + + +FlangerControls::FlangerControls( FlangerEffect *effect ) : + EffectControls ( effect ), + m_effect ( effect ), + m_delayTimeModel(0.001, 0.0001, 0.050, 0.0001, this, tr( "Delay Samples" ) ) , + m_lfoFrequencyModel( 0.25, 0.01, 5, 0.0001, this, tr( "Lfo Frequency" ) ), + m_lfoAmountModel( 0.1, 0.0, 1.0 , 0.001 , this , tr( "Amount" ) ), + m_feedbackModel( 0.0 , 0.0 , 1.0 , 0.0001, this, tr( "Regen" ) ), + m_whiteNoiseAmountModel( 0.0 , 0.0 , 0.05 , 0.0001, this, tr( "Noise" ) ), + m_invertFeedbackModel ( false , this, tr( "Invert" ) ) + +{ + connect( Engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( changedSampleRate() ) ); +} + + + + +void FlangerControls::loadSettings( const QDomElement &_this ) +{ + m_delayTimeModel.loadSettings( _this, "DelayTimeSamples" ); + m_lfoFrequencyModel.loadSettings( _this, "LfoFrequency" ); + m_lfoAmountModel.loadSettings( _this, "LfoAmount" ); + m_feedbackModel.loadSettings( _this, "Feedback" ); + m_whiteNoiseAmountModel.loadSettings( _this, "WhiteNoise" ); + m_invertFeedbackModel.loadSettings( _this, "Invert" ); + +} + + + + +void FlangerControls::saveSettings( QDomDocument &doc, QDomElement &parent ) +{ + m_delayTimeModel.saveSettings( doc , parent, "DelayTimeSamples" ); + m_lfoFrequencyModel.saveSettings( doc, parent , "LfoFrequency" ); + m_lfoAmountModel.saveSettings( doc, parent , "LfoAmount" ); + m_feedbackModel.saveSettings( doc, parent, "Feedback" ) ; + m_whiteNoiseAmountModel.saveSettings( doc, parent , "WhiteNoise" ) ; + m_invertFeedbackModel.saveSettings( doc, parent, "Invert" ); +} + + + + +void FlangerControls::changedSampleRate() +{ + m_effect->changeSampleRate(); +} + + diff --git a/plugins/flanger/flangercontrols.h b/plugins/flanger/flangercontrols.h new file mode 100644 index 000000000..864119678 --- /dev/null +++ b/plugins/flanger/flangercontrols.h @@ -0,0 +1,75 @@ +/* + * flangercontrols.h - defination of StereoDelay class. + * + * Copyright (c) 2014 David French + * + * This file is part of LMMS - http://lmms.io + * + * 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 FLANGERCONTROLS_H +#define FLANGERCONTROLS_H + +#include "EffectControls.h" +#include "Knob.h" +#include "flangercontrolsdialog.h" + + +class FlangerEffect; + +class FlangerControls : public EffectControls +{ + Q_OBJECT +public: + FlangerControls( FlangerEffect* effect ); + virtual ~FlangerControls() + { + } + virtual void saveSettings ( QDomDocument& doc, QDomElement& parent ); + virtual void loadSettings ( const QDomElement &_this ); + inline virtual QString nodeName() const + { + return "Flanger"; + } + virtual int controlCount() + { + return 5; + } + virtual EffectControlDialog* createView() + { + return new FlangerControlsDialog( this ); + } + +private slots: + void changedSampleRate(); + +private: + FlangerEffect* m_effect; + FloatModel m_delayTimeModel; + FloatModel m_lfoFrequencyModel; + FloatModel m_lfoAmountModel; + FloatModel m_feedbackModel; + FloatModel m_whiteNoiseAmountModel; + BoolModel m_invertFeedbackModel; + + friend class FlangerControlsDialog; + friend class FlangerEffect; + +}; + +#endif // FLANGERCONTROLS_H diff --git a/plugins/flanger/flangercontrolsdialog.cpp b/plugins/flanger/flangercontrolsdialog.cpp new file mode 100644 index 000000000..a00e524f5 --- /dev/null +++ b/plugins/flanger/flangercontrolsdialog.cpp @@ -0,0 +1,82 @@ +/* + * flangercontrolsdialog.cpp - defination of FlangerControlsDialog class. + * + * Copyright (c) 2014 David French + * + * This file is part of LMMS - http://lmms.io + * + * 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 "flangercontrolsdialog.h" +#include "flangercontrols.h" +#include "embed.h" +#include "LedCheckbox.h" + + + + +FlangerControlsDialog::FlangerControlsDialog( FlangerControls *controls ) : + EffectControlDialog( controls ) +{ + setAutoFillBackground( true ); + QPalette pal; + pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); + setPalette( pal ); + setFixedSize( 200, 75 ); + + Knob* delayKnob = new Knob( knobBright_26, this ); + delayKnob->move( 20,10 ); + delayKnob->setVolumeKnob( false ); + delayKnob->setModel( &controls->m_delayTimeModel ); + delayKnob->setLabel( tr( "Delay" ) ); + delayKnob->setHintText( tr( "Delay Time :" ) + " ", "" ); + + Knob * lfoFreqKnob = new Knob( knobBright_26, this ); + lfoFreqKnob->move( 53,10 ); + lfoFreqKnob->setVolumeKnob( false ); + lfoFreqKnob->setModel( &controls->m_lfoFrequencyModel ); + lfoFreqKnob->setLabel( tr( "Lfo Hz" ) ); + lfoFreqKnob->setHintText( tr ( "Lfo Hz:" ) + " ", "" ); + + Knob * lfoAmtKnob = new Knob( knobBright_26, this ); + lfoAmtKnob->move( 86,10 ); + lfoAmtKnob->setVolumeKnob( false ); + lfoAmtKnob->setModel( &controls->m_lfoAmountModel ); + lfoAmtKnob->setLabel( tr( "Amt" ) ); + lfoAmtKnob->setHintText( tr ( "Amt" ) + " ", "" ); + + Knob * feedbackKnob = new Knob( knobBright_26, this ); + feedbackKnob->move( 119,10 ); + feedbackKnob->setVolumeKnob( true) ; + feedbackKnob->setModel( &controls->m_feedbackModel ); + feedbackKnob->setLabel( tr( "Regen" ) ); + feedbackKnob->setHintText( tr ( "Feedback Amount:" ) + " ", "" ); + + Knob * whiteNoiseKnob = new Knob( knobBright_26, this ); + whiteNoiseKnob->move( 150,10 ); + whiteNoiseKnob->setVolumeKnob( true) ; + whiteNoiseKnob->setModel( &controls->m_whiteNoiseAmountModel ); + whiteNoiseKnob->setLabel( tr( "Noise" ) ); + whiteNoiseKnob->setHintText( tr ( "White Noise Amount:" ) + " ", "" ); + + LedCheckBox* invertCb = new LedCheckBox( tr( "" ), this ); + invertCb->move( 15,55 ); + + + +} diff --git a/plugins/flanger/flangercontrolsdialog.h b/plugins/flanger/flangercontrolsdialog.h new file mode 100644 index 000000000..bdfa90d45 --- /dev/null +++ b/plugins/flanger/flangercontrolsdialog.h @@ -0,0 +1,41 @@ +/* + * flangercontrolsdialog.h - defination of FlangerControlsDialog class. + * + * Copyright (c) 2014 David French + * + * This file is part of LMMS - http://lmms.io + * + * 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 FLANGERCONTROLSDIALOG_H +#define FLANGERCONTROLSDIALOG_H + +#include "EffectControlDialog.h" + +class FlangerControls; + +class FlangerControlsDialog : public EffectControlDialog +{ +public: + FlangerControlsDialog( FlangerControls* controls ); + virtual ~FlangerControlsDialog() + { + } +}; + +#endif // FLANGERCONTROLSDIALOG_H diff --git a/plugins/flanger/flangereffect.cpp b/plugins/flanger/flangereffect.cpp new file mode 100644 index 000000000..70ac8c0df --- /dev/null +++ b/plugins/flanger/flangereffect.cpp @@ -0,0 +1,150 @@ +/* + * flangereffect.cpp - defination of FlangerEffect class. + * + * Copyright (c) 2014 David French + * + * This file is part of LMMS - http://lmms.io + * + * 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 "flangereffect.h" +#include "Engine.h" +#include "embed.cpp" + +extern "C" +{ + +Plugin::Descriptor PLUGIN_EXPORT flanger_plugin_descriptor = +{ + STRINGIFY( PLUGIN_NAME ), + "Flanger", + QT_TRANSLATE_NOOP( "pluginBrowser", "A native flanger plugin" ), + "Dave French ", + 0x0100, + Plugin::Effect, + new PluginPixmapLoader( "logo" ), + NULL, + NULL +} ; + + + + +FlangerEffect::FlangerEffect( Model *parent, const Plugin::Descriptor::SubPluginFeatures::Key *key ) : + Effect( &flanger_plugin_descriptor, parent, key ), + m_flangerControls( this ) +{ + m_lfo = new QuadratureLfo( Engine::mixer()->processingSampleRate() ); + m_lDelay = new MonoDelay( 1, Engine::mixer()->processingSampleRate() ); + m_rDelay = new MonoDelay( 1, Engine::mixer()->processingSampleRate() ); + m_noise = new Noise; +} + + + + +FlangerEffect::~FlangerEffect() +{ + if(m_lDelay ) + { + delete m_lDelay; + } + if( m_rDelay ) + { + delete m_rDelay; + } + if(m_lfo ) + { + delete m_lfo; + } + if(m_noise) + { + delete m_noise; + } +} + + + + +bool FlangerEffect::processAudioBuffer( sampleFrame *buf, const fpp_t frames ) +{ + if( !isEnabled() || !isRunning () ) + { + return( false ); + } + double outSum = 0.0; + const float d = dryLevel(); + const float w = wetLevel(); + const float length = m_flangerControls.m_delayTimeModel.value() * Engine::mixer()->processingSampleRate(); + const float noise = m_flangerControls.m_whiteNoiseAmountModel.value(); + m_lfo->setAmplitude( m_flangerControls.m_lfoAmountModel.value() ); + m_lfo->setFrequency( m_flangerControls.m_lfoFrequencyModel.value() ); + m_lDelay->setFeedback( m_flangerControls.m_feedbackModel.value() ); + m_rDelay->setFeedback( m_flangerControls.m_feedbackModel.value() ); + sample_t dryS[2]; + float leftLfo; + float rightLfo; + for( fpp_t f = 0; f < frames; ++f ) + { + buf[f][0] += m_noise->tick() * noise; + buf[f][1] += m_noise->tick() * noise; + dryS[0] = buf[f][0]; + dryS[1] = buf[f][1]; + m_lfo->tick(&leftLfo, &rightLfo); + m_lDelay->setLength( ( float )length * leftLfo ); + m_rDelay->setLength( ( float )length * rightLfo ); + if(m_flangerControls.m_invertFeedbackModel.value()) + { + m_lDelay->tick( &buf[f][1] ); + m_rDelay->tick(&buf[f][0] ); + } else + { + m_lDelay->tick( &buf[f][0] ); + m_rDelay->tick( &buf[f][1] ); + } + + buf[f][0] = ( d * dryS[0] ) + ( w * buf[f][0] ); + buf[f][1] = ( d * dryS[1] ) + ( w * buf[f][1] ); + outSum += buf[f][0]*buf[f][0] + buf[f][1]*buf[f][1]; + } + checkGate( outSum / frames ); + return isRunning(); +} + + + + +void FlangerEffect::changeSampleRate() +{ + m_lfo->setSampleRate( Engine::mixer()->processingSampleRate() ); + m_lDelay->setSampleRate( Engine::mixer()->processingSampleRate() ); + m_rDelay->setSampleRate( Engine::mixer()->processingSampleRate() ); +} + + + +extern "C" +{ + +//needed for getting plugin out of shared lib +Plugin * PLUGIN_EXPORT lmms_plugin_main( Model* parent, void* data ) +{ + return new FlangerEffect( parent , static_cast( data ) ); +} + +}} diff --git a/plugins/flanger/flangereffect.h b/plugins/flanger/flangereffect.h new file mode 100644 index 000000000..d476a056a --- /dev/null +++ b/plugins/flanger/flangereffect.h @@ -0,0 +1,57 @@ +/* + * flangereffect.h - defination of FlangerEffect class. + * + * Copyright (c) 2014 David French + * + * This file is part of LMMS - http://lmms.io + * + * 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 FLANGEREFFECT_H +#define FLANGEREFFECT_H + +#include "Effect.h" +#include "flangercontrols.h" +#include "quadraturelfo.h" +#include "monodelay.h" +#include "noise.h" + + +class FlangerEffect : public Effect +{ +public: + FlangerEffect( Model* parent , const Descriptor::SubPluginFeatures::Key* key ); + virtual ~FlangerEffect(); + virtual bool processAudioBuffer( sampleFrame *buf, const fpp_t frames ); + virtual EffectControls* controls() + { + return &m_flangerControls; + } + void changeSampleRate(); + +private: + FlangerControls m_flangerControls; + MonoDelay* m_lDelay; + MonoDelay* m_rDelay; + QuadratureLfo* m_lfo; + Noise* m_noise; + +}; + +#endif // FLANGEREFFECT_H diff --git a/plugins/flanger/logo.png b/plugins/flanger/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..89e9f3680118931dd86f065a8f6bc0b4c631a585 GIT binary patch literal 3225 zcmV;K3}*9*P)`#WFm#_KhbhiGA@U*^o_ z?)UBYo!>dX?|kR%N`_(3mE2^y!khFt%vlIo2DuiJ53xXoA?=VokVZ)2as;qQmgTQk zRaM=vc=6&zGiJEI(qbI$Du=q8bYDa-!T4lNbqv-;`L=^Wjh{! z{PDzr0|$(OfdS*wS|X7!+S=NTZQHgPH{X17r=lo7!t?I`l?SGwJ#pWC_ib3WZk^=u zcnAs-2L-lzW^j-sNr=^ICA-}&`giTxMVmKoKG)dT_#F&+=ZgeTk(ZbE`g6}cx3Ipx zo-7uNP>z*~#bN|6ki+2+_tF7m0%D3qqfy$lX%lVVzMZ}ClP?0mRdD@VPe1*1pFK+ofU!5YF*p_;mk!1RdhfmW(!qlVx8m0KCZmipN#!dc z@2y(3s(kh8)x@-MI-L{_hlM5C`Ybk^jnrh4`uqE7cz9SyBoY<$@dK>i=M!W2nLr>w znx+x<5$)KqV+jB{u*S}bDrA|2@=nO_ATw%fYsI2$>8`F$;YgF?CjYsg_e4i$2W4kv zQ$az2piC0LhJr!i2?oSK+S}VHFE5vP-rc)*{}2eF>pfud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Nn z?bv%b)^fNdajLabYfUAJwlU}#1#ah@8A@60HIBJU7rL&VUg{`-ajZ;8HLe;x-SNT3 zW6_p<|Bf9!(w1!L4;dXPW+YM{#`__m6o^lpK1ym~M+&VqCF%X#=a5q1j1hMxQ*&8U z&r9Q+?rKUQ@l0w5a9o3-iQgN>QWTLg#`FDn>bG&Rm%C + * + * This file is part of LMMS - http://lmms.io + * + * 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 "monodelay.h" +#include "interpolation.h" +#include "lmms_math.h" + +MonoDelay::MonoDelay( int maxTime , int sampleRate ) +{ + m_buffer = 0; + m_maxTime = maxTime; + m_maxLength = maxTime * sampleRate; + m_length = m_maxLength; + + m_index = 0; + m_feedback = 0.0f; + setSampleRate( sampleRate ); +} + + + + +MonoDelay::~MonoDelay() +{ + if( m_buffer ) + { + delete m_buffer; + } +} + + + + +void MonoDelay::tick( sample_t* sample ) +{ + m_buffer[m_index] = *sample; + int readIndex = m_index - ( int )m_length; + if(readIndex < 0) + { + readIndex += m_maxLength; + } + float fract = fraction( m_length ); + if(readIndex != m_maxLength-1 ) + { + *sample = linearInterpolate(m_buffer[readIndex] , + m_buffer[readIndex+1], fract ); + } else + { + *sample = linearInterpolate(m_buffer[readIndex] , + m_buffer[0], fract ); + } + m_buffer[m_index] += *sample * m_feedback; + m_index = ( m_index +1 ) % m_maxLength; +} + + + + +void MonoDelay::setSampleRate( int sampleRate ) +{ + if( m_buffer ) + { + delete m_buffer; + } + + + m_buffer = new sample_t[( int )( sampleRate * m_maxTime )]; +} diff --git a/plugins/flanger/monodelay.h b/plugins/flanger/monodelay.h new file mode 100644 index 000000000..8c544fd6c --- /dev/null +++ b/plugins/flanger/monodelay.h @@ -0,0 +1,60 @@ +/* + * monodelay.h - defination of MonoDelay class. + * + * Copyright (c) 2014 David French + * + * This file is part of LMMS - http://lmms.io + * + * 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 MONODELAY_H +#define MONODELAY_H + +#include "lmms_basics.h" + +class MonoDelay +{ +public: + MonoDelay( int maxTime , int sampleRate ); + ~MonoDelay(); + inline void setLength( float length ) + { + if( length <= m_maxLength && length >= 0 ) + { + m_length = length; + } + } + + inline void setFeedback( float feedback ) + { + m_feedback = feedback; + } + + void tick( sample_t* sample ); + void setSampleRate( int sampleRate ); + +private: + sample_t* m_buffer; + int m_maxLength; + float m_length; + int m_index; + float m_feedback; + float m_maxTime; +}; + +#endif // MONODELAY_H diff --git a/plugins/flanger/noise.cpp b/plugins/flanger/noise.cpp new file mode 100644 index 000000000..d7e7423a5 --- /dev/null +++ b/plugins/flanger/noise.cpp @@ -0,0 +1,39 @@ +/* + * noise.cpp - defination of Noise class. + * + * Copyright (c) 2014 David French + * + * This file is part of LMMS - http://lmms.io + * + * 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 "noise.h" +#include "lmms_math.h" + +Noise::Noise() +{ + inv_randmax = 1.0/RAND_MAX; /* for range of 0 - 1.0 */ +} + + + + +float Noise::tick() +{ + return (float) ((2.0 * rand() * inv_randmax) - 1.0); +} diff --git a/plugins/flanger/noise.h b/plugins/flanger/noise.h new file mode 100644 index 000000000..008700ed7 --- /dev/null +++ b/plugins/flanger/noise.h @@ -0,0 +1,37 @@ +/* + * noise.h - defination of Noise class. + * + * Copyright (c) 2014 David French + * + * This file is part of LMMS - http://lmms.io + * + * 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 NOISE_H +#define NOISE_H + +class Noise +{ +public: + Noise(); + float tick(); +private: + double inv_randmax; +}; + +#endif // NOISE_H diff --git a/plugins/flanger/quadraturelfo.cpp b/plugins/flanger/quadraturelfo.cpp new file mode 100644 index 000000000..b11850bec --- /dev/null +++ b/plugins/flanger/quadraturelfo.cpp @@ -0,0 +1,49 @@ +/* + * quadraturelfo.cpp - defination of QuadratureLfo class. + * + * Copyright (c) 2014 David French + * + * This file is part of LMMS - http://lmms.io + * + * 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 "quadraturelfo.h" + +QuadratureLfo::QuadratureLfo( int sampleRate ) +{ + setSampleRate(sampleRate); +} + +void QuadratureLfo::tick( float *s, float *c ) +{ + *s = sinf( m_phase ); + *c = cosf( m_phase ); + m_phase += m_increment; + + if( m_amplitude < 0.0001 ) + { + *s = 1; + *c = 1; + } else + { + *s = ( ( *s * m_amplitude + 1.0 ) * 0.5 ); + *c = ( ( *c * m_amplitude + 1.0 ) * 0.5 ); + } + + +} diff --git a/plugins/flanger/quadraturelfo.h b/plugins/flanger/quadraturelfo.h new file mode 100644 index 000000000..0a3c6c823 --- /dev/null +++ b/plugins/flanger/quadraturelfo.h @@ -0,0 +1,81 @@ +/* + * quadraturelfo.h - defination of QuadratureLfo class. + * + * Copyright (c) 2014 David French + * + * This file is part of LMMS - http://lmms.io + * + * 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 QUADRATURELFO_H +#define QUADRATURELFO_H + +#include "lmms_math.h" + +class QuadratureLfo +{ +public: + QuadratureLfo( int sampleRate ); + ~QuadratureLfo() + { + } + + inline void setFrequency( double frequency ) + { + if( frequency < 0 || frequency > ( m_samplerate / 2.0 ) || frequency == m_frequency ) + { + return; + } + m_frequency = frequency; + m_increment = m_frequency * m_twoPiOverSr; + + if( m_phase >= F_2PI ) + { + m_phase -= F_2PI; + } + } + + inline void setAmplitude( float amplitude ) + { + if( amplitude < 0.0 || amplitude > 1.0 ) + { + return; + } + m_amplitude = amplitude; + } + + inline void setSampleRate ( int samplerate ) + { + m_samplerate = samplerate; + m_twoPiOverSr = F_2PI / samplerate; + m_increment = m_frequency * m_twoPiOverSr; + } + + void tick( float *s, float *c ); + +private: + double m_frequency; + double m_phase; + double m_increment; + double m_amplitude; + double m_twoPiOverSr; + int m_samplerate; + +}; + +#endif // QUADRATURELFO_H