mirror of
https://github.com/projectM-visualizer/projectm.git
synced 2026-02-10 10:35:25 +00:00
Move method definitions to .cpp
This commit is contained in:
committed by
Kai Blaschke
parent
8be7f4589c
commit
0d8bb362bc
@ -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;
|
||||
}
|
||||
|
||||
@ -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};
|
||||
|
||||
Reference in New Issue
Block a user