Merge pull request #145 from wongcc966422/ghostPeakController

Fixes Ghost Peak Controller Bug
This commit is contained in:
Tobias Doerffel
2014-01-25 11:13:13 -08:00
4 changed files with 31 additions and 1 deletions

View File

@@ -51,6 +51,8 @@ public:
static ConstNotePlayHandleList nphsOfInstrumentTrack(
const InstrumentTrack * _ct );
static bool isPreviewing();
private:
static previewTrackContainer * s_previewTC;

View File

@@ -81,6 +81,7 @@ PeakControllerEffect::~PeakControllerEffect()
if( idx >= 0 )
{
PeakController::s_effects.remove( idx );
engine::getSong()->removeController( m_autoController );
}
}

View File

@@ -29,6 +29,7 @@
#include "PeakController.h"
#include "peak_controller_effect_controls.h"
#include "peak_controller_effect.h"
#include "preset_preview_play_handle.h"
PeakControllerEffectControls::
@@ -66,7 +67,7 @@ void PeakControllerEffectControls::loadSettings( const QDomElement & _this )
}
m_effect->m_effectId = effectId;
if( m_effect->m_autoController )
if( m_effect->m_autoController && presetPreviewPlayHandle::isPreviewing() == false )
{
delete m_effect->m_autoController;
m_effect->m_autoController = 0;

View File

@@ -89,12 +89,24 @@ public:
m_dataMutex.unlock();
}
bool isPreviewing()
{
bool ret = m_dataMutex.tryLock();
if( ret == true )
{
m_dataMutex.unlock();
}
return ret;
}
private:
InstrumentTrack * m_previewInstrumentTrack;
notePlayHandle * m_previewNote;
QMutex m_dataMutex;
friend class presetPreviewPlayHandle;
} ;
@@ -242,3 +254,17 @@ ConstNotePlayHandleList presetPreviewPlayHandle::nphsOfInstrumentTrack(
}
bool presetPreviewPlayHandle::isPreviewing()
{
bool ret = s_previewTC->m_dataMutex.tryLock();
if( ret == true )
{
s_previewTC->m_dataMutex.unlock();
}
return ret;
}