Add implicit conversions to AudioBuffer
This commit is contained in:
parent
2fcd231062
commit
f0b527525f
1 changed files with 26 additions and 0 deletions
|
|
@ -9,6 +9,7 @@
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Debug.h"
|
#include "Debug.h"
|
||||||
#include "LeakDetector.h"
|
#include "LeakDetector.h"
|
||||||
|
#include "SIMDHelpers.h"
|
||||||
#include "absl/types/span.h"
|
#include "absl/types/span.h"
|
||||||
#include "absl/memory/memory.h"
|
#include "absl/memory/memory.h"
|
||||||
#include <array>
|
#include <array>
|
||||||
|
|
@ -259,6 +260,15 @@ public:
|
||||||
numChannels = 0;
|
numChannels = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes zeros in the buffer
|
||||||
|
*/
|
||||||
|
void clear()
|
||||||
|
{
|
||||||
|
for (size_t i = 0; i < numChannels; ++i)
|
||||||
|
fill<Type>(getSpan(i), Type{ 0.0 });
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Add a positive number of channels to the buffer
|
* @brief Add a positive number of channels to the buffer
|
||||||
*
|
*
|
||||||
|
|
@ -271,6 +281,22 @@ public:
|
||||||
addChannel();
|
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:
|
private:
|
||||||
using buffer_type = Buffer<Type, Alignment>;
|
using buffer_type = Buffer<Type, Alignment>;
|
||||||
using buffer_ptr = std::unique_ptr<buffer_type>;
|
using buffer_ptr = std::unique_ptr<buffer_type>;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue