A lightweight data structure that stores a pointer to an audio buffer. More...
#include <ame_AudioBuffer.hpp>
Public Member Functions | |
AudioBlockView (std::span< ElementType, Extent > view, const uint_fast32_t numChannels) noexcept | |
Constructor. More... | |
uint_fast32_t | getNumChannels () const noexcept |
Returns the number of channels. | |
uint_fast32_t | getNumSamplesPerChannel () const noexcept |
Returns the number of samples per channel. | |
void | setSample (const uint_fast32_t destChannel, const uint_fast32_t destSample, const ElementType newValue) |
Set a sample in the buffer. More... | |
void | addSample (const uint_fast32_t destChannel, const uint_fast32_t destSample, const ElementType valueToAdd) |
Add a value to a sample in the buffer. More... | |
void | clear () |
Set all samples to 0. | |
void | applyGain (const float gain) |
Applies a gain multiple to all the audio data. | |
float | getPeak (const uint_fast32_t channel) const |
Finds the highest absolute sample value within a region of a channel. More... | |
float | getRMSLevel (const uint_fast32_t channel) const |
Returns the root mean squared level for a region of a channel. More... | |
auto | subView (uint_fast32_t offset, uint_fast32_t size) |
Returns an AudioBlockView that references N elements from an arbitrary position. More... | |
Public Attributes | |
std::span< ElementType, Extent > | view |
A lightweight data structure that stores a pointer to an audio buffer.
This class doesn't own any of the data which it points to, it's simply a view into data that is owned elsewhere. You can construct one from some raw data that you've allocated yourself, or give it an AudioBuffer which it can refer to, but in all cases the user is responsible for making sure that the data doesn't get deleted while there's still an AudioBlock using it.
|
inlinenoexcept |
Constructor.
buffer | Interleaved audio buffer view. |
numChannels | the number of channels. |
numSamples | the number of samples in each of the buffer's channels. |
|
inline |
Add a value to a sample in the buffer.
destChannel | |
destSample | |
valueToAdd |
|
inline |
Finds the highest absolute sample value within a region of a channel.
channel |
|
inline |
Returns the root mean squared level for a region of a channel.
channel |
|
inline |
Set a sample in the buffer.
destChannel | |
destSample | |
value |
|
inline |
Returns an AudioBlockView that references N elements from an arbitrary position.
offset | Start location |
size | Number of elements |