HephAudio v3.0.6
A cross-platform C++ library for recording, playing, and processing audio on Windows, Android, Linux, iOS, and macOS.
|
base class for buffers. Provides basic buffer operations and methods. More...
#include <BufferBase.h>
Public Member Functions | |
virtual | ~BufferBase () |
virtual Tself | operator<< (size_t rhs) const |
virtual Tself & | operator<<= (size_t rhs) |
virtual Tself | operator>> (size_t rhs) const |
virtual Tself & | operator>>= (size_t rhs) |
virtual bool | operator== (const Tself &rhs) const |
virtual bool | operator!= (const Tself &rhs) const |
Tdata & | operator[] (size_t index) const |
size_t | Size () const |
size_t | SizeAsByte () const |
Tdata & | At (size_t index) const |
virtual bool | IsEmpty () const |
virtual void | Reset () |
virtual void | Release () |
virtual Tself | SubBuffer (size_t index, size_t size) const |
virtual void | Prepend (const Tself &rhs) |
virtual void | Append (const Tself &rhs) |
virtual void | Insert (const Tself &rhs, size_t index) |
virtual void | Cut (size_t index, size_t size) |
virtual void | Replace (const Tself &rhs, size_t index) |
virtual void | Replace (const Tself &rhs, size_t index, size_t size) |
virtual void | Resize (size_t newSize) |
virtual void | Reverse () |
Tdata * | begin () const |
Tdata * | end () const |
Protected Member Functions | |
BufferBase () | |
BufferBase (size_t size) | |
BufferBase (size_t size, BufferFlags flags) | |
BufferBase (const std::initializer_list< Tdata > &rhs) | |
BufferBase (const BufferBase &rhs) | |
BufferBase (BufferBase &&rhs) noexcept | |
Tself & | operator= (const std::initializer_list< Tdata > &rhs) |
Tself & | operator= (const Tself &rhs) |
Tself & | operator= (Tself &&rhs) noexcept |
Static Protected Member Functions | |
static size_t | SizeAsByte (size_t size) |
template<typename U = Tdata> | |
static std::enable_if< std::is_class< U >::value >::type | Initialize (U *pData, U *pDataEnd) |
template<typename U = Tdata> | |
static std::enable_if<!std::is_class< U >::value >::type | Initialize (U *pData, U *pDataEnd) |
static Tdata * | Allocate (size_t size_byte) |
static Tdata * | AllocateUninitialized (size_t size_byte) |
static Tdata * | SubBuffer (Tdata *pThisData, size_t thisSize_byte, size_t index_byte, size_t subBufferSize_byte) |
static Tdata * | Prepend (Tdata *pThisData, size_t thisSize_byte, Tdata *pRhsData, size_t rhsSize_byte) |
static Tdata * | Append (Tdata *pThisData, size_t thisSize_byte, Tdata *pRhsData, size_t rhsSize_byte) |
static Tdata * | Insert (Tdata *pThisData, size_t thisSize_byte, Tdata *pRhsData, size_t rhsSize_byte, size_t index_byte) |
static Tdata * | Cut (Tdata *pThisData, size_t thisSize_byte, size_t index_byte, size_t &cutSize_byte) |
static void | Replace (Tdata *pThisData, size_t thisSize_byte, Tdata *pRhsData, size_t rhsSize_byte, size_t index_byte) |
Protected Attributes | |
Tdata * | pData |
size_t | size |
base class for buffers. Provides basic buffer operations and methods.
Tself | Type of the final buffer that inherits from this class (CRTP). |
Tdata | Type of the data the buffer stores. |
|
inlineprotected |
creates a new instance and initializes it with default values.
|
inlineexplicitprotected |
creates a new instance and initializes it with the provided values.
size | number of elements the buffer will store. |
|
inlineprotected |
creates a new instance and initializes it with the provided values.
size | number of elements the buffer will store. |
flags | flags. |
|
inlineprotected |
creates a new instance and initializes it with the provided values.
rhs | a list of elements the buffer will store. |
|
inlineprotected |
creates a new instance and copies the rhs's data to it.
rhs | instance whose data will be copied. |
|
inlineprotectednoexcept |
creates a new instance and moves the rhs's data to it.
rhs | instance whose data will be moved. |
|
inlinevirtual |
releases the resources and destroys the instance.
|
inlinevirtual |
creates a copy of the current buffer that is shifted to the left.
rhs | number of elements to shift. |
InsufficientMemoryException |
Reimplemented in HephAudio::AudioBuffer.
|
inlinevirtual |
shifts the current buffer to the left.
rhs | number of elements to shift. |
Reimplemented in HephAudio::AudioBuffer.
|
inlinevirtual |
creates a copy of the current buffer that is shifted to the right.
rhs | number of elements to shift. |
InsufficientMemoryException |
Reimplemented in HephAudio::AudioBuffer.
|
inlinevirtual |
shifts the current buffer to the right.
rhs | number of elements to shift. |
Reimplemented in HephAudio::AudioBuffer.
|
inline |
gets the element at the provided index.
|
inline |
gets the number of elements stored.
|
inline |
gets the size of the buffer in bytes.
|
inline |
gets the element at the provided index.
InvalidArgumentException |
|
inlinevirtual |
checks whether the buffer is empty.
|
inlinevirtual |
sets all elements to their default value.
|
inlinevirtual |
releases the resources.
Reimplemented in HephAudio::AudioBuffer, HephAudio::EncodedAudioBuffer, and HephAudio::FFmpegEncodedAudioBuffer.
|
inlinevirtual |
gets the desired part of the buffer as a new instance.
index | index of the first element of the sub buffer. |
size | number of elements the sub buffer will store. |
Reimplemented in HephAudio::AudioBuffer.
|
inlinevirtual |
adds the elements of the rhs to the start of the current buffer.
rhs | the buffer whose elements will be added. |
|
inlinevirtual |
adds the elements of the rhs to the end of the current buffer.
rhs | the buffer whose elements will be added. |
|
inlinevirtual |
adds the elements of the rhs to the provided position of the current buffer.
rhs | the buffer whose elements will be added. |
|
inlinevirtual |
removes the desired portion of the buffer.
index | index of the first element that will be removed. |
size | number of elements to remove. |
InvalidArgumentException |
Reimplemented in HephAudio::AudioBuffer.
|
inlinevirtual |
replaces the desired portion of the buffer with the contents of the rhs.
rhs | the buffer whose elements will be used to replace the current buffer's elements. |
index | index of the first element that will be replaced. |
InvalidArgumentException |
|
inlinevirtual |
replaces the desired portion of the buffer with the contents of the rhs.
rhs | the buffer whose elements will be used to replace the current buffer's elements. |
index | index of the first element that will be replaced. |
size | number of elements to replace. |
InvalidArgumentException |
|
inlinevirtual |
changes the size of the buffer.
if new size is less than the old, excess elements from the end will be removed.
InsufficientMemoryException |
Reimplemented in HephAudio::AudioBuffer.
|
inlinevirtual |
reverses the buffer (first element to last and vice versa).
Reimplemented in HephAudio::AudioBuffer.
|
inline |
gets the pointer to the first element if buffer is not empty, otherwise nullptr.
|
inline |
gets the pointer to the end of the buffer (not the last element!) if buffer is not empty, otherwise nullptr.
|
inlinestaticprotected |
calculates the size in bytes.
size | number of elements. |
|
inlinestaticprotected |
initializes the provided memory region.
pData | start of the memory region. |
pDataEnd | end of the memory region. |
|
inlinestaticprotected |
initializes the provided memory region.
pData | start of the memory region. |
pDataEnd | end of the memory region. |
|
inlinestaticprotected |
allocates memory and initializes it.
size_byte | number of bytes to allocate. |
InsufficientMemoryException |
|
inlinestaticprotected |
allocates memory but does not initialize it.
size_byte | number of bytes to allocate. |
InsufficientMemoryException |
|
protected |
pointer to the first element of the buffer, or nullptr if the buffer is empty.
|
protected |
number of elements the buffer stores.