summaryrefslogtreecommitdiffstats
path: root/src/engine/enginevumeter.cpp
diff options
context:
space:
mode:
authorRJ Ryan <rryan@mixxx.org>2013-12-19 17:49:49 -0500
committerRJ Ryan <rryan@mixxx.org>2013-12-21 00:50:16 -0500
commit40e1e0eb903ee26dad3a03523675bd59f9c74d7a (patch)
treea7aeb7f2e6aee4f701586bda5d8220ed48dfacd4 /src/engine/enginevumeter.cpp
parentaf42c885bf538fc05b6bbd8780c3c59abcb9a94b (diff)
Refactor the engine to process samples in the range of [-1.0, 1.0]. Fixes Bug #1204039.
* Move Vinyl Control pre-amp to VinylControlXwax (no longer affects microphone/passthrough). * Switch PortAudio input sample format to paFloat32. * Remove SHRT_MAX conversions on input and output samples. * Update VUMeters, clipping, and dithering code to deal with the new ranges. * Clean up EngineMicrophone/EnginePassthrough/EngineDeck handling of inputs. * Update tests to deal with the new sample ranges. This does not change SoundSource. SoundSources still read 16-bit samples and we simply divide by SHRT_MAX in AnalyserQueue and CachingReaderWorker. A future performance improvement can remove this and use the native decoder API to request normalized samples directly.
Diffstat (limited to 'src/engine/enginevumeter.cpp')
-rw-r--r--src/engine/enginevumeter.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/engine/enginevumeter.cpp b/src/engine/enginevumeter.cpp
index eade65f06f..1acfe07fb8 100644
--- a/src/engine/enginevumeter.cpp
+++ b/src/engine/enginevumeter.cpp
@@ -58,10 +58,9 @@ void EngineVuMeter::process(const CSAMPLE* pIn, CSAMPLE*, const int iBufferSize)
m_iSamplesCalculated += iBufferSize/2;
// Are we ready to update the VU meter?:
- if (m_iSamplesCalculated > (44100/2/UPDATE_RATE) )
- {
- doSmooth(m_fRMSvolumeL, log10(m_fRMSvolumeSumL/(m_iSamplesCalculated*1000)+1));
- doSmooth(m_fRMSvolumeR, log10(m_fRMSvolumeSumR/(m_iSamplesCalculated*1000)+1));
+ if (m_iSamplesCalculated > (44100/2/UPDATE_RATE)) {
+ doSmooth(m_fRMSvolumeL, log10(SHRT_MAX * m_fRMSvolumeSumL/(m_iSamplesCalculated*1000)+1));
+ doSmooth(m_fRMSvolumeR, log10(SHRT_MAX * m_fRMSvolumeSumR/(m_iSamplesCalculated*1000)+1));
const double epsilon = .0001;