|
tracktion-engine 3.0-10-g034fdde4aa5
Tracktion Engine — High level data model for audio applications
« « « Anklang Documentation |
A stack of audio buffers. More...
#include "tracktion_AudioBufferStack.h"
Public Member Functions | |
| AudioBufferStack ()=default | |
| Create an empty stack. | |
| choc::buffer::ChannelArrayBuffer< float > | allocate (choc::buffer::Size) |
| Returns an allocated buffer for a given size from the stack. | |
| void | release (choc::buffer::ChannelArrayBuffer< float > &&) |
| Releases an allocated buffer back to the stack. | |
| void | reset () |
| Releases all the internal allocated storage. | |
| void | reserve (size_t numBuffers, choc::buffer::Size) |
| Reserves a number of buffers of a given size, preallocating them. | |
| size_t | getNumBuffers () |
| Returns the current number of buffers in the stack. | |
| size_t | getAllocatedSize () |
| Returns the currently allocated size of all the buffers in bytes. | |
A stack of audio buffers.
If you need to quickly create and then return some audio buffers this class enables you to do that.
Note that the buffers can be pre-allocated but if you ask for a buffer which isn't in the pool, it will either resize an existing one or allocate a new one.
After processing a constant audio graph for a while though this should be completely allocation and lock-free.
However, it is not thread safe so you should use a different stack for each thread!
Definition at line 31 of file tracktion_AudioBufferStack.h.
|
default |
Create an empty stack.
You won't be able to use this pool right away, you must reserve some a number of buffers for it to use first.
| choc::buffer::ChannelArrayBuffer< float > tracktion::graph::AudioBufferStack::allocate | ( | choc::buffer::Size | size | ) |
Returns an allocated buffer for a given size from the stack.
This will attempt to get a buffer from the pre-allocated pool that can fit the size but if one can't easily be found, it will allocate one with new and return it.
Additionally, the returned buffer may be bigger than the size asked for so be sure to only use a view of it but retain ownership of the whole buffer. You can release it back to the pool later. It will also contain junk so be sure to clear or initialise the view required before use.
Definition at line 87 of file tracktion_AudioBufferStack.h.
| size_t tracktion::graph::AudioBufferStack::getAllocatedSize | ( | ) |
Returns the currently allocated size of all the buffers in bytes.
Definition at line 157 of file tracktion_AudioBufferStack.h.
| size_t tracktion::graph::AudioBufferStack::getNumBuffers | ( | ) |
Returns the current number of buffers in the stack.
Definition at line 152 of file tracktion_AudioBufferStack.h.
| void tracktion::graph::AudioBufferStack::release | ( | choc::buffer::ChannelArrayBuffer< float > && | buffer | ) |
Releases an allocated buffer back to the stack.
Definition at line 111 of file tracktion_AudioBufferStack.h.
| void tracktion::graph::AudioBufferStack::reserve | ( | size_t | numBuffers, |
| choc::buffer::Size | size | ||
| ) |
Reserves a number of buffers of a given size, preallocating them.
Definition at line 117 of file tracktion_AudioBufferStack.h.