Use a flexible array for the front stablizer delay buffers
This commit is contained in:
+4
-1
@@ -2095,7 +2095,10 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList)
|
||||
case DevFmtX71:
|
||||
if(GetConfigValueBool(device->DeviceName.c_str(), nullptr, "front-stablizer", 0))
|
||||
{
|
||||
auto stablizer = std::make_unique<FrontStablizer>();
|
||||
auto stablizer = FrontStablizer::Create(device->channelsFromFmt());
|
||||
for(auto &buf : stablizer->DelayBuf)
|
||||
std::fill(buf.begin(), buf.end(), 0.0f);
|
||||
|
||||
/* Initialize band-splitting filter for the mid signal, with a
|
||||
* crossover at 5khz (could be higher).
|
||||
*/
|
||||
|
||||
+15
-7
@@ -1,25 +1,33 @@
|
||||
#ifndef ALC_FRONT_STABLIZER_H
|
||||
#define ALC_FRONT_STABLIZER_H
|
||||
|
||||
#include <array>
|
||||
#include <memory>
|
||||
|
||||
#include "alcmain.h"
|
||||
#include "almalloc.h"
|
||||
#include "devformat.h"
|
||||
#include "filters/splitter.h"
|
||||
|
||||
|
||||
struct FrontStablizer {
|
||||
static constexpr size_t DelayLength{256u};
|
||||
|
||||
FrontStablizer(size_t numchans) : DelayBuf{numchans} { }
|
||||
|
||||
BandSplitter MidFilter;
|
||||
alignas(16) float MidLF[BUFFERSIZE];
|
||||
alignas(16) float MidHF[BUFFERSIZE];
|
||||
alignas(16) float Side[BUFFERSIZE];
|
||||
alignas(16) float MidLF[BUFFERSIZE]{};
|
||||
alignas(16) float MidHF[BUFFERSIZE]{};
|
||||
alignas(16) float Side[BUFFERSIZE]{};
|
||||
|
||||
alignas(16) float TempBuf[BUFFERSIZE + DelayLength];
|
||||
alignas(16) float TempBuf[BUFFERSIZE + DelayLength]{};
|
||||
|
||||
alignas(16) float DelayBuf[MAX_OUTPUT_CHANNELS][DelayLength];
|
||||
using DelayLine = std::array<float,DelayLength>;
|
||||
al::FlexArray<DelayLine,16> DelayBuf;
|
||||
|
||||
DEF_NEWDEL(FrontStablizer)
|
||||
static std::unique_ptr<FrontStablizer> Create(size_t numchans)
|
||||
{ return std::unique_ptr<FrontStablizer>{new(FamCount{numchans}) FrontStablizer{numchans}}; }
|
||||
|
||||
DEF_FAM_NEWDEL(FrontStablizer, DelayBuf)
|
||||
};
|
||||
|
||||
#endif /* ALC_FRONT_STABLIZER_H */
|
||||
|
||||
Reference in New Issue
Block a user