diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-07 19:31:04 +1000 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-09-07 19:31:04 +1000 |
| commit | 73233b97c11c21609ff9d4700e18c9b9f32b32ec (patch) | |
| tree | d914a1d04abdcdd8373ee22da7e6ee68da20fc4e /plugin/src/Caelestia/audioprovider.cpp | |
| parent | plugin/cp: update values when bars changed (diff) | |
| download | caelestia-shell-73233b97c11c21609ff9d4700e18c9b9f32b32ec.tar.gz caelestia-shell-73233b97c11c21609ff9d4700e18c9b9f32b32ec.tar.bz2 caelestia-shell-73233b97c11c21609ff9d4700e18c9b9f32b32ec.zip | |
plugin/ap: don't load empty chunks
Diffstat (limited to '')
| -rw-r--r-- | plugin/src/Caelestia/audioprovider.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/plugin/src/Caelestia/audioprovider.cpp b/plugin/src/Caelestia/audioprovider.cpp index 3424e22..becfb63 100644 --- a/plugin/src/Caelestia/audioprovider.cpp +++ b/plugin/src/Caelestia/audioprovider.cpp @@ -12,6 +12,7 @@ #include <algorithm> #include <cstddef> #include <cstdint> +#include <cstdlib> namespace caelestia { @@ -73,7 +74,11 @@ void AudioCollector::loadChunk() { i += toCopy; if (m_chunkOffset == m_chunkSize) { - m_provider->loadChunk(m_chunk); + if (std::any_of(m_chunk.constBegin(), m_chunk.constEnd(), [](double d) { + return std::abs(d) > 1e-6; + })) { + m_provider->loadChunk(m_chunk); + } m_chunkOffset = 0; } } |