Plasma Engine  2.0
Loading...
Searching...
No Matches
AudioSystemAllocator.h
1#pragma once
2
3#include <AudioSystemPlugin/AudioSystemPluginDLL.h>
4
5#include <Foundation/Configuration/Singleton.h>
6#include <Foundation/Memory/CommonAllocators.h>
7
9#define PL_AUDIOSYSTEM_MEMORY_ALIGNMENT 16
10
14class PL_AUDIOSYSTEMPLUGIN_DLL plAudioSystemAllocator : public plAlignedHeapAllocator
15{
16 PL_DECLARE_SINGLETON(plAudioSystemAllocator);
17
18public:
20};
21
25class PL_AUDIOSYSTEMPLUGIN_DLL plAudioMiddlewareAllocator : public plAlignedHeapAllocator
26{
27 PL_DECLARE_SINGLETON(plAudioMiddlewareAllocator);
28
29public:
32 explicit plAudioMiddlewareAllocator(plAudioSystemAllocator* pParentAllocator);
33};
34
36{
37 PL_ALWAYS_INLINE static plAllocator* GetAllocator()
38 {
39 return plAudioSystemAllocator::GetSingleton();
40 }
41};
42
44{
45 PL_ALWAYS_INLINE static plAllocator* GetAllocator()
46 {
47 return plAudioMiddlewareAllocator::GetSingleton();
48 }
49};
50
52#define PL_AUDIOSYSTEM_NEW(type, ...) PL_NEW(plAudioSystemAllocatorWrapper::GetAllocator(), type, __VA_ARGS__)
53
55#define PL_AUDIOSYSTEM_DELETE(ptr) PL_DELETE(plAudioSystemAllocatorWrapper::GetAllocator(), ptr)
56
58#define PL_AUDIOSYSTEM_NEW_ARRAY(type, count) PL_NEW_ARRAY(plAudioSystemAllocatorWrapper::GetAllocator(), type, count)
59
61#define PL_AUDIOSYSTEM_DELETE_ARRAY(arrayPtr) PL_DELETE_ARRAY(plAudioSystemAllocatorWrapper::GetAllocator(), arrayPtr)
62
64#define PL_AUDIOSYSTEM_NEW_RAW_BUFFER(type, count) PL_NEW_RAW_BUFFER(plAudioSystemAllocatorWrapper::GetAllocator(), type, count)
65
67#define PL_AUDIOSYSTEM_DELETE_RAW_BUFFER(ptr) PL_DELETE_RAW_BUFFER(plAudioSystemAllocatorWrapper::GetAllocator(), ptr)
Base class for all memory allocators.
Definition Allocator.h:23
Policy based allocator implementation of the plAllocator interface.
Definition AllocatorWithPolicy.h:19
An allocator that uses the heap to allocate memory for use by the audio middleware....
Definition AudioSystemAllocator.h:26
An allocator that uses the heap to allocate memory for use by the audio system itself....
Definition AudioSystemAllocator.h:15
Definition AudioSystemAllocator.h:44
Definition AudioSystemAllocator.h:36