Move method definitions to .cpp

This commit is contained in:
Erik Präntare
2022-04-09 03:40:16 +02:00
committed by Kai Blaschke
parent 8be7f4589c
commit 0d8bb362bc
2 changed files with 26 additions and 17 deletions

View File

@ -58,6 +58,12 @@ void BeatDetect::Reset()
}
float BeatDetect::GetPCMScale()
{
return beatSensitivity;
}
void BeatDetect::CalculateBeatStatistics()
{
volOld = vol;
@ -97,3 +103,20 @@ void BeatDetect::CalculateBeatStatistics()
float const volIntensity = bassIntensity + midIntensity + trebIntensity;
updateBand(vol, volAtt, volSmoothed, volIntensity);
}
auto BeatDetect::LowPassFilter::Update(float nextValue) noexcept -> void
{
m_current -= m_buffer[m_bufferPos] / bufferLength;
m_current += nextValue / bufferLength;
m_buffer[m_bufferPos] = nextValue;
++m_bufferPos;
m_bufferPos %= bufferLength;
}
auto BeatDetect::LowPassFilter::Get() const noexcept -> float
{
return m_current;
}

View File

@ -48,10 +48,7 @@ public:
// 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()
{
return beatSensitivity;
}
float GetPCMScale();
float beatSensitivity{1.f};
@ -73,21 +70,10 @@ private:
{
public:
auto
Update(float nextValue) noexcept -> void
{
m_current -= m_buffer[m_bufferPos] / bufferLength;
m_current += nextValue / bufferLength;
m_buffer[m_bufferPos] = nextValue;
++m_bufferPos;
m_bufferPos %= bufferLength;
}
Update(float nextValue) noexcept -> void;
[[nodiscard]] auto
Get() const noexcept -> float
{
return m_current;
}
Get() const noexcept -> float;
private:
static size_t constexpr bufferLength{80};