34#include <memory_resource>
47 static constexpr uint32 cScratchSize = 480;
102 mutable ERState State;
106 class RealtimeData
final
109 RealtimeData() =
default;
110 ~RealtimeData() =
default;
113 RealtimeData(
const RealtimeData&) =
delete;
114 RealtimeData& operator=(
const RealtimeData&) =
delete;
126 float* ChannelGains =
nullptr;
129 std::atomic<ERState> State;
134 TargetERData TargetData;
135 RealtimeData* RealtimeState;
140 return other.Id == Id;
145 return other.Id == Id;
161 ERStorage() =
delete;
163 explicit ERStorage(std::pmr::memory_resource&
resource);
166 ERStorage(
const ERStorage&
other);
167 ERStorage& operator=(
const ERStorage&
other);
169 ERStorage(ERStorage&&
other)
noexcept;
170 ERStorage& operator=(ERStorage&&
other)
noexcept;
174 using AllocatorType = std::pmr::polymorphic_allocator<>;
175 AllocatorType GetAllocator()
const {
return mAllocator; }
178 float* AllocateCopyChannelGains(
const float*
source);
179 void DeallocateChannelGains(
float*
gains);
181 const std::pmr::vector<ER>& GetERs()
const {
return ERs; }
182 std::pmr::vector<ER>& GetERs() {
return ERs; }
184 ER* FindERByID(
uint32 id);
186 template<std::ranges::range UpdateData>
194 void UpdateTargetERData(TargetERData&
er,
201 template <
class Predicate>
205 template <
class Predicate>
208 std::size_t Erase(std::size_t begin, std::size_t
count);
211 std::size_t InsertNewERs(std::pmr::vector<ER>&&
newERs);
214 float* AllocateChannelGains();
215 void AllocateCopyChannelGains(
const std::pmr::vector<ER>&
source);
218 std::pmr::polymorphic_allocator<float> mAllocator;
219 std::pmr::vector<ER> ERs;
224 using SafeERsWrite =
typename SafeERs::ScopedAccess<JPL::ThreadType::nonRealtime>;
225 using SafeERsRead =
typename SafeERs::ScopedAccess<JPL::ThreadType::realtime>;
228 RealtimeData* AllocateRTData();
230 void DeallocateRTData(RealtimeData* data);
234 std::pmr::unsynchronized_pool_resource mPool;
243 float mSampleRate = 48'000.0f;
Forward declaration.
Definition DelayLine.h:131
Definition EarlyReflectionsBus.h:46
void SetTaps(std::span< const ERUpdateData > newERs)
Must be called from the same non-audio thread.
ERBus(float sampleRate, uint32 numChannels)
void Prepare(float sampleRate, uint32 numChannels)
Must be called from single non-audio thread.
uint32 GetNumChannels() const
Definition EarlyReflectionsBus.h:75
void ProcessInterleaved(std::span< const float > input, std::span< float > output, uint32 numInputChannels, uint32 numFrames)
uint32 GetNumTaps() const
Definition EarlyReflectionsBus.h:83
Definition RealtimeObject.h:69
Definition AcousticMaterial.h:36
std::uint32_t uint32
Definition Core.h:311
JPL_INLINE constexpr bool operator==(const Vec2 &A, const Vec2 &B) noexcept
Definition MinimalVec2.h:59
JPL_INLINE simd min(const simd &a, const simd &b) noexcept
Element-wise min.
Definition SIMD.h:1813
Definition DelayLine.h:45
Definition EarlyReflectionsBus.h:52
std::vector< float > Gains
Definition EarlyReflectionsBus.h:54
float Delay
Definition EarlyReflectionsBus.h:55
JPL::simd FilterGains
Definition EarlyReflectionsBus.h:53
uint32 Id
Definition EarlyReflectionsBus.h:56
4th order Linkwitz-Riley 4-band crossover
Definition CrossoverFilter.h:417
Definition SmoothedValue.h:29
Minimal 4-wide 32-bit float vector implementation for SIMD.
Definition SIMD.h:60