diff --git a/src/libprojectM/Renderer/BeatDetect.cpp b/src/libprojectM/Renderer/BeatDetect.cpp index 52be0ed34..a3c7c8831 100755 --- a/src/libprojectM/Renderer/BeatDetect.cpp +++ b/src/libprojectM/Renderer/BeatDetect.cpp @@ -38,41 +38,19 @@ BeatDetect::BeatDetect(PCM* _pcm) + : pcm(_pcm) { - this->pcm = _pcm; - - this->vol_instant = 0; - this->vol_history = 0; for (unsigned y = 0; y < this->vol_buffer.size(); y++) this->vol_buffer[y] = 0; - this->beat_buffer_pos = 0; - - this->bass_instant = 0; - this->bass_history = 0; for (unsigned y = 0; y < this->bass_buffer.size(); y++) this->bass_buffer[y] = 0; - this->mid_instant = 0; - this->mid_history = 0; for (unsigned y = 0; y < this->mid_buffer.size(); y++) this->mid_buffer[y] = 0; - this->treb_instant = 0; - this->treb_history = 0; for (unsigned y = 0; y < this->treb_buffer.size(); y++) this->treb_buffer[y] = 0; - - this->treb = 0; - this->mid = 0; - this->bass = 0; - this->vol_old = 0; - this->beatSensitivity = 1.00; - this->treb_att = 0; - this->mid_att = 0; - this->bass_att = 0; - this->vol_att = 0; - this->vol = 0; } diff --git a/src/libprojectM/Renderer/BeatDetect.hpp b/src/libprojectM/Renderer/BeatDetect.hpp index 1a76a93b2..5bd546203 100755 --- a/src/libprojectM/Renderer/BeatDetect.hpp +++ b/src/libprojectM/Renderer/BeatDetect.hpp @@ -40,18 +40,18 @@ class BeatDetect { public: // Does this really belong here? maybe belongs on projectM.Settings? - float beatSensitivity; + float beatSensitivity = 1.f; - float treb; - float mid; - float bass; - float vol_old; + float treb = 0.f; + float mid = 0.f; + float bass = 0.f; + float vol_old = 0.f; - float treb_att; - float mid_att; - float bass_att; - float vol; - float vol_att; + float treb_att = 0.f; + float mid_att = 0.f; + float bass_att = 0.f; + float vol = 0.f; + float vol_att = 0.f; PCM* pcm; @@ -74,23 +74,23 @@ private: // the actual time represented in the history depends on FPS static size_t constexpr BEAT_HISTORY_LENGTH = 80; - int beat_buffer_pos; + int beat_buffer_pos = 0; std::array bass_buffer; - float bass_history; - float bass_instant; + float bass_history = 0.f; + float bass_instant = 0.f; std::array mid_buffer; - float mid_history; - float mid_instant; + float mid_history = 0.f; + float mid_instant = 0.f; std::array treb_buffer; - float treb_history; - float treb_instant; + float treb_history = 0.f; + float treb_instant = 0.f; std::array vol_buffer; - float vol_history; - float vol_instant; + float vol_history = 0.f; + float vol_instant = 0.f; }; #endif /** !_BEAT_DETECT_H */