diff --git a/src/libprojectM/Renderer/BeatDetect.cpp b/src/libprojectM/Renderer/BeatDetect.cpp index a8a51b55f..8ad19c62e 100755 --- a/src/libprojectM/Renderer/BeatDetect.cpp +++ b/src/libprojectM/Renderer/BeatDetect.cpp @@ -109,6 +109,17 @@ void BeatDetect::detectFromSamples() } + +float BeatDetect::getPCMScale() +{ + // the constant here just depends on the particulars of getBeatVals(), the + // range of vol_history, and what "looks right". + // larger value means larger, more jagged waveform. + return 1.5 / fmax(0.0001f,sqrtf(vol_history)); +} + + + void BeatDetect::getBeatVals( float samplerate, unsigned fft_length, float *vdataL, float *vdataR ) { assert( 512==fft_length || 1024==fft_length ); // should be power of 2, expect >= 512 diff --git a/src/libprojectM/Renderer/BeatDetect.hpp b/src/libprojectM/Renderer/BeatDetect.hpp index 653864267..7102a7764 100755 --- a/src/libprojectM/Renderer/BeatDetect.hpp +++ b/src/libprojectM/Renderer/BeatDetect.hpp @@ -67,18 +67,7 @@ class DLLEXPORT BeatDetect // getPCMScale() was added to address https://github.com/projectM-visualizer/projectm/issues/161 // Returning 1.0 results in using the raw PCM data, which can make the presets look pretty unresponsive // if the application volume is low. - float getPCMScale() - { - // the constant here just depends on the particulars of getBeatVals(), the - // range of vol_history, and what "looks right". - // larger value means larger, more jagged waveform. -#ifdef WIN32 -// this is broken? -#undef max - //work0around -#endif /** WIN32 */ - return 4.0f / std::max(0.0001f,sqrtf(vol_history)); - } + float getPCMScale(); private: int beat_buffer_pos;