Skip to content

Commit

Permalink
Fix preset preview issues with peak controllers (LMMS#3904)
Browse files Browse the repository at this point in the history
  • Loading branch information
PhysSong authored Apr 4, 2018
1 parent d30a224 commit 00f9590
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
3 changes: 2 additions & 1 deletion plugins/peak_controller_effect/peak_controller_effect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
#include "PeakController.h"
#include "peak_controller_effect_controls.h"
#include "peak_controller_effect.h"
#include "PresetPreviewPlayHandle.h"
#include "Song.h"


Expand Down Expand Up @@ -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;
}
}


Expand Down
7 changes: 1 addition & 6 deletions src/core/PeakController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -64,11 +63,7 @@ PeakController::PeakController( Model * _parent,

PeakController::~PeakController()
{
//EffectChain::loadSettings() appends effect to EffectChain::m_effects
//When it's previewing, EffectChain::loadSettings(<Controller Fx XML>) 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 );
}
Expand Down

0 comments on commit 00f9590

Please sign in to comment.