Moved defaultAlignment to config

This commit is contained in:
Paul Ferrand 2020-05-30 10:41:50 +02:00 committed by Jean Pierre Cimalando
parent ba07765133
commit 353dfa3973
5 changed files with 8 additions and 8 deletions

View file

@ -26,8 +26,8 @@ namespace sfz
* @tparam MaxChannels the maximum number of channels in the buffer * @tparam MaxChannels the maximum number of channels in the buffer
* @tparam Alignment the alignment for the buffers * @tparam Alignment the alignment for the buffers
*/ */
template <class Type, size_t MaxChannels = sfz::config::numChannels, template <class Type, size_t MaxChannels = config::numChannels,
unsigned int Alignment = SIMDConfig::defaultAlignment, unsigned int Alignment = config::defaultAlignment,
size_t PaddingLeft_ = 0, size_t PaddingRight_ = 0> size_t PaddingLeft_ = 0, size_t PaddingRight_ = 0>
class AudioBuffer { class AudioBuffer {
public: public:

View file

@ -119,9 +119,9 @@ private:
* *
* @tparam Type The buffer type * @tparam Type The buffer type
* @tparam Alignment the required alignment in bytes (defaults to * @tparam Alignment the required alignment in bytes (defaults to
* SIMDConfig::defaultAlignment) * config::defaultAlignment)
*/ */
template <class Type, unsigned int Alignment = SIMDConfig::defaultAlignment> template <class Type, unsigned int Alignment = config::defaultAlignment>
class Buffer { class Buffer {
public: public:
using value_type = typename std::remove_cv<Type>::type; using value_type = typename std::remove_cv<Type>::type;

View file

@ -58,6 +58,7 @@ namespace config {
constexpr uint16_t numCCs { 512 }; constexpr uint16_t numCCs { 512 };
constexpr int maxCurves { 256 }; constexpr int maxCurves { 256 };
constexpr int chunkSize { 1024 }; constexpr int chunkSize { 1024 };
constexpr unsigned int defaultAlignment { 16 };
constexpr int filtersInPool { maxVoices * 2 }; constexpr int filtersInPool { maxVoices * 2 };
constexpr int excessFileFrames { 8 }; constexpr int excessFileFrames { 8 };
/** /**
@ -98,7 +99,6 @@ namespace config {
// Enable or disable SIMD accelerators by default // Enable or disable SIMD accelerators by default
namespace SIMDConfig { namespace SIMDConfig {
constexpr unsigned int defaultAlignment { 16 };
constexpr bool writeInterleaved { true }; constexpr bool writeInterleaved { true };
constexpr bool readInterleaved { true }; constexpr bool readInterleaved { true };
constexpr bool fill { true }; constexpr bool fill { true };

View file

@ -43,7 +43,7 @@
#include <mutex> #include <mutex>
namespace sfz { namespace sfz {
using FileAudioBuffer = AudioBuffer<float, 2, SIMDConfig::defaultAlignment, using FileAudioBuffer = AudioBuffer<float, 2, config::defaultAlignment,
sfz::config::excessFileFrames, sfz::config::excessFileFrames>; sfz::config::excessFileFrames, sfz::config::excessFileFrames>;
using FileAudioBufferPtr = std::shared_ptr<FileAudioBuffer>; using FileAudioBufferPtr = std::shared_ptr<FileAudioBuffer>;

View file

@ -41,8 +41,8 @@ template <class Type>
void checkBoundaries(sfz::Buffer<Type>& buffer, int expectedSize) void checkBoundaries(sfz::Buffer<Type>& buffer, int expectedSize)
{ {
REQUIRE((int)buffer.size() == expectedSize); REQUIRE((int)buffer.size() == expectedSize);
REQUIRE(((size_t)buffer.data() & (sfz::SIMDConfig::defaultAlignment - 1)) == 0); REQUIRE(((size_t)buffer.data() & (sfz::config::defaultAlignment - 1)) == 0);
REQUIRE(((size_t)buffer.alignedEnd() & (sfz::SIMDConfig::defaultAlignment - 1)) == 0); REQUIRE(((size_t)buffer.alignedEnd() & (sfz::config::defaultAlignment - 1)) == 0);
REQUIRE(std::distance(buffer.begin(), buffer.end()) == expectedSize); REQUIRE(std::distance(buffer.begin(), buffer.end()) == expectedSize);
REQUIRE(std::distance(buffer.begin(), buffer.alignedEnd()) >= expectedSize); REQUIRE(std::distance(buffer.begin(), buffer.alignedEnd()) >= expectedSize);
} }