From 9b0925432aa66f2c1a2d369f1a1fc04b63e9207c Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Mon, 17 May 2010 23:19:41 +0200 Subject: [PATCH] SpectrumAnalyzer: skip processing if UI is not visible There's currently no need for analyzing the sound data if SpectrumAnalyzer's view is not visible. This saves some CPU time if SpectrumAnalyzer's view is not shown. (cherry picked from commit 70b80efec18f2e5a6812818658fabb0b899cb5c0) --- plugins/spectrum_analyzer/spectrum_analyzer.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/spectrum_analyzer/spectrum_analyzer.cpp b/plugins/spectrum_analyzer/spectrum_analyzer.cpp index eb0c151a3..5ce6c067f 100644 --- a/plugins/spectrum_analyzer/spectrum_analyzer.cpp +++ b/plugins/spectrum_analyzer/spectrum_analyzer.cpp @@ -1,8 +1,8 @@ /* * spectrum_analyzer.cpp - spectrum analyzer plugin * - * Copyright (c) 2008-2009 Tobias Doerffel - * + * Copyright (c) 2008-2010 Tobias Doerffel + * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * * This program is free software; you can redistribute it and/or @@ -82,6 +82,11 @@ bool spectrumAnalyzer::processAudioBuffer( sampleFrame * _buf, return( false ); } + if( !m_saControls.isViewVisible() ) + { + return true; + } + fpp_t f = 0; if( _frames > FFT_BUFFER_SIZE ) {