|
SampleType | absoluteMax () const |
|
| Channel (AudioBuffers &iBuffers, int32 iChannel) |
|
void | clear () |
| Clears the channel (and sets the silence flag) More...
|
|
tresult | copyFrom (Channel const &fromChannel) |
| Copy the content of the provided channel to THIS channel (up to num samples) More...
|
|
template<typename UnaryOperation > |
UnaryOperation | copyFrom (Channel const &iFromChannel, UnaryOperation f) |
| Copy iFromChannel to this channel, applying f to each sample or in other words, for each sample. More...
|
|
tresult | copyTo (Channel &toChannel) const |
| Copy the content of THIS channel to the provided channel (up to num samples) More...
|
|
template<typename UnaryOperation > |
UnaryOperation | copyTo (Channel &oToChannel, 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 (if the channel is active). More...
|
|
template<typename UnaryFunction > |
UnaryFunction | forEachSample (UnaryFunction f) const |
| Applies the provided unary function to each sample (if the channel is active). More...
|
|
SampleType * | getBuffer () |
| Note that this pointer is NOT guaranteed to be not null as demonstrated by this piece of logic in the Audio Unit wrapper code: More...
|
|
SampleType const * | getBuffer () const |
| Note that this pointer is NOT guaranteed to be not null as demonstrated by this piece of logic in the Audio Unit wrapper code: More...
|
|
int32 | getNumSamples () const |
|
bool | isActive () const |
|
bool | isSilent () const |
|
void | setSilenceFlag (bool iSilent) |
| Sets a single channel silence flag. More...
|
|
template<typename SampleType>
class pongasoft::VST::AudioBuffers< SampleType >::Channel
Represents a single channel (for example left audio channel).
Note an instance of this class may represent an invalid/non active channel in which case the various methods will react accordingly (ex: getBuffer
returns nullptr
, forEachSample
doesn't do anything, etc...)
UnaryOperation copyFrom |
( |
Channel const & |
iFromChannel, |
|
|
UnaryOperation |
f |
|
) |
| |
|
inline |
Copy iFromChannel
to this channel, applying f
to each sample or in other words, for each sample.
getBuffer[i] = f(iFromChannel.getBuffer[i]);
This handles properly inactive channels (nothing done if either of the channel is inactive) and channels of different sizes.
Example:
AudioBuffers<SampleType> in(data.inputs[0], data.numSamples);
AudioBuffers<SampleType> out(data.outputs[0], data.numSamples);
double gain = 0.5;
out.getLeftChannel().copyFrom(in.getLeftChannel(), [gain](SampleType iSample) { return iSample * gain; });
- Template Parameters
-
UnaryOperation | can be a lambda, a function object (etc...) but should provide an api similar to std::function<SampleType(SampleType)> |
- Returns
- the function provided