Jamba C++ API
6.2.0
|
Represents all the buffers (example for a stereo channel there is 2 underlying sample buffers) More...
#include <AudioBuffer.h>
Classes | |
struct | AbsoluteMaxOp |
Unary operator adapter for computing the absolute max. More... | |
class | Channel |
Represents a single channel (for example left audio channel). More... | |
Public Types | |
typedef AudioBuffers< SampleType > | class_type |
Public Member Functions | |
SampleType | absoluteMax () const |
bool | adjustSilenceFlags () |
Computes and adjust the silence flags. More... | |
AudioBuffers (AudioBusBuffers &buffer, int32 numSamples) | |
tresult | clear () |
Clears the buffer (and sets the silence flag) More... | |
void | clearSilentFlag () |
Makes the buffer NON silent (by setting the flag to 0). More... | |
tresult | copyFrom (class_type const &fromBuffer) |
Copy the content of the provided buffer to THIS buffer (up to num samples) More... | |
template<typename UnaryOperation > | |
UnaryOperation | copyFrom (class_type const &iFromBuffer, UnaryOperation f) |
Copy iFromBuffer to this buffer, applying f to each sample for each channel or in other words, for each channel c and each sample i. More... | |
tresult | copyTo (class_type &toBuffer) const |
Copy the content of THIS buffer to the provided buffer (up to num samples) More... | |
template<typename UnaryOperation > | |
UnaryOperation | copyTo (class_type &iToBuffer, UnaryOperation f) const |
Same as copyFrom with the roles reversed. More... | |
template<typename UnaryFunction > | |
UnaryFunction | forEachSample (UnaryFunction f) |
Applies the provided unary function to each sample of each channel. More... | |
template<typename UnaryFunction > | |
UnaryFunction | forEachSample (UnaryFunction f) const |
Applies the provided unary function to each sample of each channel. More... | |
AudioBusBuffers & | getAudioBusBuffers () |
Returns the AudioBusBuffers original buffer. More... | |
AudioBusBuffers const & | getAudioBusBuffers () const |
Returns the AudioBusBuffers original buffer (const version) More... | |
Channel | getAudioChannel (int32 iChannel) |
Return the audio channel for the provided channel. More... | |
const Channel | getAudioChannel (int32 iChannel) const |
Return the audio channel for the provided channel. More... | |
SampleType ** | getBuffer () |
Returns the underlying (sample) buffer. More... | |
SampleType const *const * | getBuffer () const |
template<> | |
Sample32 const *const * | getBuffer () const |
template<> | |
Sample64 const *const * | getBuffer () const |
template<> | |
Sample32 ** | getBuffer () |
template<> | |
Sample64 ** | getBuffer () |
Channel | getLeftChannel () |
const Channel | getLeftChannel () const |
int32 | getNumChannels () const |
int32 | getNumSamples () const |
Channel | getRightChannel () |
const Channel | getRightChannel () const |
uint64 | getSilenceFlags () const |
bool | isSilent () const |
bool | isSilent (int32 iChannel) const |
void | setSilenceFlag (int32 iChannel, bool iSilent) |
Sets a single channel silence flag. More... | |
void | setSilenceFlags (uint64 iFlags) const |
Private Attributes | |
AudioBusBuffers & | fBuffer |
const int32 | fNumSamples |
Represents all the buffers (example for a stereo channel there is 2 underlying sample buffers)
SampleType |
typedef AudioBuffers<SampleType> class_type |
|
inline |
|
inline |
|
inline |
Computes and adjust the silence flags.
|
inline |
Clears the buffer (and sets the silence flag)
|
inline |
Makes the buffer NON silent (by setting the flag to 0).
A flag is set to 1 when silent, so when set to 0 it is non silent...
|
inline |
Copy the content of the provided buffer to THIS buffer (up to num samples)
|
inline |
Copy iFromBuffer
to this buffer, applying f
to each sample for each channel or in other words, for each channel c and each sample i.
getChannel(c).getBuffer[i] = f(iFromBuffer.getChannel(c).getBuffer[i]);
Example:
AudioBuffers<SampleType> in(data.inputs[0], data.numSamples); AudioBuffers<SampleType> out(data.outputs[0], data.numSamples); double gain = 0.5; out.copyFrom(in, [gain](SampleType iSample) { return iSample * gain; });
UnaryOperation | can be a lambda, a function object (etc...) but should provide an api similar to std::function<SampleType(SampleType)> |
|
inline |
Copy the content of THIS buffer to the provided buffer (up to num samples)
|
inline |
Same as copyFrom
with the roles reversed.
|
inline |
Applies the provided unary function to each sample of each channel.
Example:
double gain = 0.5; out.forEachSample([gain](SampleType &iSample) { iSample *= gain; });
UnaryFunction | can be a lambda, a function object (etc...) but should provide an api similar to std::function<void(SampleType)> or std::function<void(SampleType &)> |
std::for_each
)
|
inline |
Applies the provided unary function to each sample of each channel.
Because the method is const, the unary function cannot modify the elements.
Example:
auto max = out.forEachSample(AbsoluteMaxOp()).fAbsoluteMax;
UnaryFunction | can be a lambda, a function object (etc...) but should provide an api similar to std::function<void(SampleType)> or std::function<void(SampleType const &)> |
std::for_each
)
|
inline |
Returns the AudioBusBuffers
original buffer.
|
inline |
Returns the AudioBusBuffers
original buffer (const version)
|
inline |
Return the audio channel for the provided channel.
Note that this method never fails and will return an object where Channel::isActive returns false
in the event the channel is not active.
|
inline |
Return the audio channel for the provided channel.
Note that this method never fails and will return an object where Channel::isActive returns false
in the event the channel is not active.
|
inline |
Returns the underlying (sample) buffer.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
Sets a single channel silence flag.
|
inline |
|
private |
|
private |