From 676810241053253ca3690b2fee99ba541054e0ff Mon Sep 17 00:00:00 2001 From: Hyunin Song Date: Mon, 23 Oct 2017 21:29:31 +0900 Subject: [PATCH] Fix preset preview issues with peak controllers --- plugins/peak_controller_effect/peak_controller_effect.cpp | 3 ++- .../peak_controller_effect_controls.cpp | 7 ------- src/core/PeakController.cpp | 7 +------ 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/plugins/peak_controller_effect/peak_controller_effect.cpp b/plugins/peak_controller_effect/peak_controller_effect.cpp index 59c91f3d18d..d4d81b13751 100644 --- a/plugins/peak_controller_effect/peak_controller_effect.cpp +++ b/plugins/peak_controller_effect/peak_controller_effect.cpp @@ -26,6 +26,7 @@ #include "Controller.h" #include "Song.h" +#include "PresetPreviewPlayHandle.h" #include "PeakController.h" #include "peak_controller_effect.h" #include "lmms_math.h" @@ -67,7 +68,7 @@ PeakControllerEffect::PeakControllerEffect( m_autoController( NULL ) { m_autoController = new PeakController( Engine::getSong(), this ); - if( !Engine::getSong()->isLoadingProject() ) + if( !Engine::getSong()->isLoadingProject() && !PresetPreviewPlayHandle::isPreviewing() ) { Engine::getSong()->addController( m_autoController ); } diff --git a/plugins/peak_controller_effect/peak_controller_effect_controls.cpp b/plugins/peak_controller_effect/peak_controller_effect_controls.cpp index 2f634cbeaa9..3508f869a65 100644 --- a/plugins/peak_controller_effect/peak_controller_effect_controls.cpp +++ b/plugins/peak_controller_effect/peak_controller_effect_controls.cpp @@ -29,7 +29,6 @@ #include "PeakController.h" #include "peak_controller_effect_controls.h" #include "peak_controller_effect.h" -#include "PresetPreviewPlayHandle.h" #include "Song.h" @@ -80,12 +79,6 @@ void PeakControllerEffectControls::loadSettings( const QDomElement & _this ) { m_effect->m_effectId = rand(); } - - if( m_effect->m_autoController && PresetPreviewPlayHandle::isPreviewing() == true ) - { - delete m_effect->m_autoController; - m_effect->m_autoController = 0; - } } diff --git a/src/core/PeakController.cpp b/src/core/PeakController.cpp index 976e3c96ef8..9e5e654a660 100644 --- a/src/core/PeakController.cpp +++ b/src/core/PeakController.cpp @@ -33,7 +33,6 @@ #include "Mixer.h" #include "EffectChain.h" #include "plugins/peak_controller_effect/peak_controller_effect.h" -#include "PresetPreviewPlayHandle.h" PeakControllerEffectVector PeakController::s_effects; int PeakController::m_getCount; @@ -64,11 +63,7 @@ PeakController::PeakController( Model * _parent, PeakController::~PeakController() { - //EffectChain::loadSettings() appends effect to EffectChain::m_effects - //When it's previewing, EffectChain::loadSettings() is not called - //Therefore, we shouldn't call removeEffect() as it is not even appended. - //NB: Most XML setting are loaded on preview, except controller fx. - if( m_peakEffect != NULL && m_peakEffect->effectChain() != NULL && PresetPreviewPlayHandle::isPreviewing() == false ) + if( m_peakEffect != NULL && m_peakEffect->effectChain() != NULL ) { m_peakEffect->effectChain()->removeEffect( m_peakEffect ); }