aboutsummaryrefslogtreecommitdiffstats
path: root/core/mastering.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/mastering.cpp')
-rw-r--r--core/mastering.cpp12
1 files changed, 5 insertions, 7 deletions
diff --git a/core/mastering.cpp b/core/mastering.cpp
index e0cb2ca7..3a577109 100644
--- a/core/mastering.cpp
+++ b/core/mastering.cpp
@@ -334,7 +334,7 @@ std::unique_ptr<Compressor> Compressor::Create(const size_t NumChans, const floa
size += sizeof(*Compressor::mHold);
}
- auto Comp = std::unique_ptr<Compressor>{new (al_calloc(16, size)) Compressor{}};
+ auto Comp = CompressorPtr{al::construct_at(static_cast<Compressor*>(al_calloc(16, size)))};
Comp->mNumChans = NumChans;
Comp->mAuto.Knee = AutoKnee;
Comp->mAuto.Attack = AutoAttack;
@@ -361,17 +361,15 @@ std::unique_ptr<Compressor> Compressor::Create(const size_t NumChans, const floa
{
if(hold > 1)
{
- Comp->mHold = ::new (static_cast<void*>(Comp.get() + 1)) SlidingHold{};
+ Comp->mHold = al::construct_at(reinterpret_cast<SlidingHold*>(Comp.get() + 1));
Comp->mHold->mValues[0] = -std::numeric_limits<float>::infinity();
Comp->mHold->mExpiries[0] = hold;
Comp->mHold->mLength = hold;
- Comp->mDelay = ::new(static_cast<void*>(Comp->mHold + 1)) FloatBufferLine[NumChans];
+ Comp->mDelay = reinterpret_cast<FloatBufferLine*>(Comp->mHold + 1);
}
else
- {
- Comp->mDelay = ::new(static_cast<void*>(Comp.get() + 1)) FloatBufferLine[NumChans];
- }
- std::fill_n(Comp->mDelay, NumChans, FloatBufferLine{});
+ Comp->mDelay = reinterpret_cast<FloatBufferLine*>(Comp.get() + 1);
+ std::uninitialized_fill_n(Comp->mDelay, NumChans, FloatBufferLine{});
}
Comp->mCrestCoeff = std::exp(-1.0f / (0.200f * SampleRate)); // 200ms