From 35f350eeffdeb3f0f280ad03b95520421d80c593 Mon Sep 17 00:00:00 2001 From: Rossmaxx <74815851+Rossmaxx@users.noreply.github.com> Date: Thu, 29 Aug 2024 01:16:48 +0530 Subject: [PATCH] Remove Noise class from flanger (#7473) --- plugins/Flanger/CMakeLists.txt | 2 +- plugins/Flanger/FlangerEffect.cpp | 11 ++------ plugins/Flanger/FlangerEffect.h | 3 -- plugins/Flanger/Noise.cpp | 46 ------------------------------- plugins/Flanger/Noise.h | 44 ----------------------------- 5 files changed, 4 insertions(+), 102 deletions(-) delete mode 100644 plugins/Flanger/Noise.cpp delete mode 100644 plugins/Flanger/Noise.h diff --git a/plugins/Flanger/CMakeLists.txt b/plugins/Flanger/CMakeLists.txt index 92a9198e58e..e74b2838ff5 100644 --- a/plugins/Flanger/CMakeLists.txt +++ b/plugins/Flanger/CMakeLists.txt @@ -1,7 +1,7 @@ INCLUDE(BuildPlugin) BUILD_PLUGIN( - flanger FlangerEffect.cpp FlangerControls.cpp FlangerControlsDialog.cpp Noise.cpp MonoDelay.cpp + flanger FlangerEffect.cpp FlangerControls.cpp FlangerControlsDialog.cpp MonoDelay.cpp MOCFILES FlangerControls.h FlangerControlsDialog.h EMBEDDED_RESOURCES artwork.png logo.png ) diff --git a/plugins/Flanger/FlangerEffect.cpp b/plugins/Flanger/FlangerEffect.cpp index b8bb9d692a0..184df161e3b 100644 --- a/plugins/Flanger/FlangerEffect.cpp +++ b/plugins/Flanger/FlangerEffect.cpp @@ -25,10 +25,10 @@ #include "FlangerEffect.h" #include "Engine.h" #include "MonoDelay.h" -#include "Noise.h" #include "QuadratureLfo.h" #include "embed.h" +#include "lmms_math.h" #include "plugin_export.h" namespace lmms @@ -61,7 +61,6 @@ FlangerEffect::FlangerEffect( Model *parent, const Plugin::Descriptor::SubPlugin m_lfo = new QuadratureLfo( Engine::audioEngine()->outputSampleRate() ); m_lDelay = new MonoDelay( 1, Engine::audioEngine()->outputSampleRate() ); m_rDelay = new MonoDelay( 1, Engine::audioEngine()->outputSampleRate() ); - m_noise = new Noise; } @@ -81,10 +80,6 @@ FlangerEffect::~FlangerEffect() { delete m_lfo; } - if(m_noise) - { - delete m_noise; - } } @@ -113,8 +108,8 @@ bool FlangerEffect::processAudioBuffer( SampleFrame* buf, const fpp_t frames ) float leftLfo; float rightLfo; - buf[f][0] += m_noise->tick() * noise; - buf[f][1] += m_noise->tick() * noise; + buf[f][0] += (fastRandf(2.0f) - 1.0f) * noise; + buf[f][1] += (fastRandf(2.0f) - 1.0f) * noise; dryS[0] = buf[f][0]; dryS[1] = buf[f][1]; m_lfo->tick(&leftLfo, &rightLfo); diff --git a/plugins/Flanger/FlangerEffect.h b/plugins/Flanger/FlangerEffect.h index c4afb8841be..4b0246e7e17 100644 --- a/plugins/Flanger/FlangerEffect.h +++ b/plugins/Flanger/FlangerEffect.h @@ -33,7 +33,6 @@ namespace lmms { class MonoDelay; -class Noise; class QuadratureLfo; @@ -55,8 +54,6 @@ class FlangerEffect : public Effect MonoDelay* m_lDelay; MonoDelay* m_rDelay; QuadratureLfo* m_lfo; - Noise* m_noise; - }; diff --git a/plugins/Flanger/Noise.cpp b/plugins/Flanger/Noise.cpp deleted file mode 100644 index b05324fd22c..00000000000 --- a/plugins/Flanger/Noise.cpp +++ /dev/null @@ -1,46 +0,0 @@ -/* - * noise.cpp - defination of Noise class. - * - * Copyright (c) 2014 David French - * - * This file is part of LMMS - https://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" - -namespace lmms -{ - - -Noise::Noise() -{ - inv_randmax = FAST_RAND_RATIO; /* for range of 0 - 1.0 */ -} - - - - -float Noise::tick() -{ - return fastRandf(2.0f) - 1.0f; -} - - -} // namespace lmms \ No newline at end of file diff --git a/plugins/Flanger/Noise.h b/plugins/Flanger/Noise.h deleted file mode 100644 index 9f6e2f2e1eb..00000000000 --- a/plugins/Flanger/Noise.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * noise.h - defination of Noise class. - * - * Copyright (c) 2014 David French - * - * This file is part of LMMS - https://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 - -namespace lmms -{ - - -class Noise -{ -public: - Noise(); - float tick(); -private: - double inv_randmax; -}; - - -} // namespace lmms - -#endif // NOISE_H