diff --git a/src/sfizz/AudioBuffer.h b/src/sfizz/AudioBuffer.h index 931402de..51500d0a 100644 --- a/src/sfizz/AudioBuffer.h +++ b/src/sfizz/AudioBuffer.h @@ -9,6 +9,7 @@ #include "Config.h" #include "Debug.h" #include "LeakDetector.h" +#include "SIMDHelpers.h" #include "absl/types/span.h" #include "absl/memory/memory.h" #include @@ -259,6 +260,15 @@ public: numChannels = 0; } + /** + * Writes zeros in the buffer + */ + void clear() + { + for (size_t i = 0; i < numChannels; ++i) + fill(getSpan(i), Type{ 0.0 }); + } + /** * @brief Add a positive number of channels to the buffer * @@ -271,6 +281,22 @@ public: addChannel(); } + /** + * @brief Convert implicitly to a pointer of channels + */ + operator const float* const*() const noexcept + { + return buffers.data(); + } + + /** + * @brief Convert implicitly to a pointer of channels + */ + operator float* const*() noexcept + { + return buffers.data(); + } + private: using buffer_type = Buffer; using buffer_ptr = std::unique_ptr;