aboutsummaryrefslogtreecommitdiffstats
path: root/core/effectslot.cpp
blob: 6c80317ebfbc5afdf3677a54bbd07950b461d817 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21

#include "config.h"

#include "effectslot.h"

#include <cstddef>

#include "almalloc.h"
#include "context.h"


EffectSlotArray *EffectSlot::CreatePtrArray(size_t count) noexcept
{
    /* Allocate space for twice as many pointers, so the mixer has scratch
     * space to store a sorted list during mixing.
     */
    static constexpr auto AlignVal = std::align_val_t{alignof(EffectSlotArray)};
    if(gsl::owner<void*> ptr{::operator new[](EffectSlotArray::Sizeof(count*2), AlignVal)})
        return al::construct_at(static_cast<EffectSlotArray*>(ptr), count);
    return nullptr;
}