Go to the documentation of this file.
34 template <AkMemID T_MEMID>
39 return AkAlloc(T_MEMID, in_uSize);
44 AkFree(T_MEMID, in_pAddress);
48 template <AkMemID T_MEMID>
58 AkFree(T_MEMID, in_pAddress);
66 template <
class T,
class TAlloc = AkRingBufferAllocatorDefault>
76 , m_nbReadableItems(0)
85 m_nbReadableItems = 0;
87 m_data =
reinterpret_cast<T*
>(TAlloc::Alloc(m_nbItems *
sizeof(T)));
100 m_nbReadableItems = 0;
114 m_nbReadableItems = 0;
126 return &m_data[m_writeIndex];
133 m_writeIndex = (m_writeIndex + nbItems) % m_nbItems;
147 return &m_data[m_readIndex];
154 AkUInt32 uReadIndex = (m_readIndex + uOffset) % m_nbItems;
155 return &m_data[uReadIndex];
162 m_readIndex = (m_readIndex + nbItems) % m_nbItems;
186 AkUInt32 uTargetItems = m_nbItems + in_uGrowBy;
187 if (T* pNewData =
reinterpret_cast<T*
>(TAlloc::Alloc(uTargetItems *
sizeof(T))))
192 if (m_readIndex >= m_writeIndex)
197 memcpy(pNewData, m_data,
sizeof(T) * m_writeIndex);
199 memcpy(pNewData + m_readIndex + in_uGrowBy, m_data + m_readIndex,
sizeof(T) * (m_nbItems - m_readIndex));
200 m_readIndex += in_uGrowBy;
206 memcpy(pNewData + m_readIndex, m_data + m_readIndex,
sizeof(T) * uReadableItems);
212 m_nbItems = uTargetItems;
const T * Peek(AkUInt32 uOffset) const
AkUInt32 GetReadIndex() const
const T * GetReadPtr() const
AkUInt32 GetWriteIndex() const
#define AkFree(_pool, _pvmem)
static AkForceInline void Free(void *in_pAddress)
AKSOUNDENGINE_API void Free(AkMemPoolId in_poolId, void *in_pMemAddress)
static AkForceInline void * Alloc(size_t in_uSize)
AKRESULT
Standard function call result.
AkRingBufferAllocatorAligned< AkMemID_Processing > AkRingBufferAllocatorLEngineAligned
static AkForceInline void * Alloc(size_t in_uSize)
volatile int32_t AkAtomic32
AkRingBufferAllocatorNoAlign< AkMemID_Object > AkRingBufferAllocatorDefault
#define AkAlloc(_pool, _size)
@ AK_Success
The operation was successful.
static AkForceInline void Free(void *in_pAddress)
void IncrementReadIndex(AkUInt32 nbItems)
AkUInt32 GetNbReadableItems() const
AkUInt32 GetNbWritableItems() const
#define AKASSERT(Condition)
AKRESULT Init(AkUInt32 nbItems)
#define AkMalign(_pool, _size, _align)
void IncrementWriteIndex(AkUInt32 nbItems)
uint32_t AkUInt32
Unsigned 32-bit integer.
@ AK_InsufficientMemory
Memory error.
bool Grow(AkUInt32 in_uGrowBy)
AkRingBufferAllocatorNoAlign< AkMemID_Processing > AkRingBufferAllocatorLEngine
Tell us about your project. We're here to help.
Register your project and we'll help you get started with no strings attached!
Get started with Wwise