16-bit PCM audio buffer used for all audio operations More...
Public Member Functions | |
Buffer () noexcept | |
Default constructs an empty, 16kHz mono channel buffer. More... | |
Buffer (int sampleRate, int channelCount) | |
Constructs an empty buffer with specified sample rate and channel count. More... | |
Buffer (int16_t const *data, std::size_t sz, int sampleRate, int channelCount) | |
Buffer (std::vector< int16_t > data, int sampleRate, int channelCount) | |
Buffer (std::vector< float > const &data, int sampleRate, int channelCount) | |
Converts a floating-point audio buffer into a 16-bit audio buffer. More... | |
void | append (std::vector< int16_t > const &data) |
void | append (int16_t const *data, std::size_t sz) |
auto | sampleRate () const -> int |
auto | channelCount () const -> int |
auto | maxSize () const -> std::size_t |
auto | size () const -> std::size_t |
auto | data () const -> std::vector< int16_t > const & |
auto | data () -> std::vector< int16_t > & |
auto | rawData () -> int16_t * |
auto | rawData () const -> int16_t const * |
auto | takeData () -> std::vector< int16_t > && |
bool | empty () const |
void | clear () |
void | setMaxSize (std::size_t sz) |
Sets the maximum amount of int16_t values this buffer can hold. More... | |
void | setSampleRate (int rate) |
void | setChannelCount (int count) |
void | saveToFile (std::string const &path, bool truncate=true) const |
Saves the buffer to a headerless (PCM) 16-bit audio file. More... | |
16-bit PCM audio buffer used for all audio operations
|
noexcept |
Default constructs an empty, 16kHz mono channel buffer.
Buffer::Buffer | ( | int | sampleRate, |
int | channelCount | ||
) |
Constructs an empty buffer with specified sample rate and channel count.
Buffer::Buffer | ( | int16_t const * | data, |
std::size_t | sz, | ||
int | sampleRate, | ||
int | channelCount | ||
) |
nullptr
into data!
Use Buffer(int, int) instead Buffer::Buffer | ( | std::vector< int16_t > | data, |
int | sampleRate, | ||
int | channelCount | ||
) |
Buffer::Buffer | ( | std::vector< float > const & | data, |
int | sampleRate, | ||
int | channelCount | ||
) |
Converts a floating-point audio buffer into a 16-bit audio buffer.
void Buffer::append | ( | std::vector< int16_t > const & | data | ) |
void Buffer::append | ( | int16_t const * | data, |
std::size_t | sz | ||
) |
auto Buffer::sampleRate | ( | ) | const -> int |
auto Buffer::channelCount | ( | ) | const -> int |
auto Buffer::maxSize | ( | ) | const -> std::size_t |
auto Buffer::size | ( | ) | const -> std::size_t |
auto Buffer::data | ( | ) | const -> std::vector<int16_t> const & |
auto Vsdk::Audio::Buffer::data | ( | ) | -> std::vector< int16_t > & |
auto Buffer::rawData | ( | ) | -> int16_t * |
auto Vsdk::Audio::Buffer::rawData | ( | ) | const -> int16_t const * |
auto Buffer::takeData | ( | ) | -> std::vector<int16_t> && |
bool Buffer::empty | ( | ) | const |
void Buffer::clear | ( | ) |
void Buffer::setMaxSize | ( | std::size_t | sz | ) |
Sets the maximum amount of int16_t
values this buffer can hold.
std::vector::max_size()
) ; Vsdk::Exception | if sz > std::vector::max_size() |
void Buffer::setSampleRate | ( | int | rate | ) |
void Buffer::setChannelCount | ( | int | count | ) |
void Buffer::saveToFile | ( | std::string const & | path, |
bool | truncate = true |
||
) | const |
Saves the buffer to a headerless (PCM) 16-bit audio file.