Equaliser, Disable analyser when not visible (#4399)

This commit is contained in:
Dave French
2018-06-08 17:26:07 +01:00
committed by Umcaruje
parent 7f284626e4
commit 0e98e03745
2 changed files with 3 additions and 4 deletions

View File

@@ -163,7 +163,7 @@ bool EqEffect::processAudioBuffer( sampleFrame *buf, const fpp_t frames )
const float outGain = m_outGain;
sampleFrame m_inPeak = { 0, 0 };
if(m_eqControls.m_analyseInModel.value( true ) && outSum > 0 )
if(m_eqControls.m_analyseInModel.value( true ) && outSum > 0 && m_eqControls.isViewVisible() )
{
m_eqControls.m_inFftBands.analyze( buf, frames );
}
@@ -274,7 +274,7 @@ bool EqEffect::processAudioBuffer( sampleFrame *buf, const fpp_t frames )
checkGate( outSum / frames );
if(m_eqControls.m_analyseOutModel.value( true ) && outSum > 0 )
if(m_eqControls.m_analyseOutModel.value( true ) && outSum > 0 && m_eqControls.isViewVisible() )
{
m_eqControls.m_outFftBands.analyze( buf, frames );
setBandPeaks( &m_eqControls.m_outFftBands , ( int )( sampleRate ) );

View File

@@ -196,8 +196,6 @@ EqSpectrumView::EqSpectrumView(EqAnalyser *b, QWidget *_parent) :
void EqSpectrumView::paintEvent(QPaintEvent *event)
{
//only analyse if the view is visible
m_analyser->setActive( isVisible() );
const float energy = m_analyser->getEnergy();
if( energy <= 0 && m_peakSum <= 0 )
{
@@ -291,5 +289,6 @@ float EqSpectrumView::bandToFreq( int index )
void EqSpectrumView::periodicalUpdate()
{
m_periodicalUpdate = true;
m_analyser->setActive( isVisible() );
update();
}