getPCMScale() too large?

This commit is contained in:
Matthew Bellew
2020-02-02 12:26:34 -08:00
parent 8fd6b2d85c
commit 324a5c19f3
2 changed files with 12 additions and 12 deletions

View File

@ -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

View File

@ -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;