Loading...
Searching...
No Matches
dsp::AudioBlock< SampleType > Class Template Reference

Minimal and lightweight data-structure which contains a list of pointers to channels containing some kind of sample data. More...

#include <juce_AudioBlock.h>

Public Types

using NumericType = typename SampleTypeHelpers::ElementType<SampleType>::Type
 

Public Member Functions

 AudioBlock () noexcept=default
 Create a zero-sized AudioBlock.
 
constexpr AudioBlock (SampleType *const *channelData, size_t numberOfChannels, size_t numberOfSamples) noexcept
 Creates an AudioBlock from a pointer to an array of channels.
 
constexpr AudioBlock (SampleType *const *channelData, size_t numberOfChannels, size_t startSampleIndex, size_t numberOfSamples) noexcept
 Creates an AudioBlock from a pointer to an array of channels.
 
 AudioBlock (HeapBlock< char > &heapBlockToUseForAllocation, size_t numberOfChannels, size_t numberOfSamples, size_t alignmentInBytes=defaultAlignment) noexcept
 Allocates a suitable amount of space in a HeapBlock, and initialises this object to point into it.
 
template<typename OtherSampleType >
constexpr AudioBlock (AudioBuffer< OtherSampleType > &buffer) noexcept
 Creates an AudioBlock that points to the data in an AudioBuffer.
 
template<typename OtherSampleType >
constexpr AudioBlock (const AudioBuffer< OtherSampleType > &buffer) noexcept
 Creates an AudioBlock that points to the data in an AudioBuffer.
 
template<typename OtherSampleType >
 AudioBlock (AudioBuffer< OtherSampleType > &buffer, size_t startSampleIndex) noexcept
 Creates an AudioBlock that points to the data in an AudioBuffer.
 
 AudioBlock (const AudioBlock &other) noexcept=default
 
AudioBlockoperator= (const AudioBlock &other) noexcept=default
 
template<typename OtherSampleType , MayUseConvertingConstructor< OtherSampleType > = 0>
 AudioBlock (const AudioBlock< OtherSampleType > &other) noexcept
 
template<typename OtherSampleType , MayUseConvertingConstructor< OtherSampleType > = 0>
AudioBlockoperator= (const AudioBlock< OtherSampleType > &other) noexcept
 
void swap (AudioBlock &other) noexcept
 
template<typename OtherSampleType >
constexpr bool operator== (const AudioBlock< OtherSampleType > &other) const noexcept
 
template<typename OtherSampleType >
constexpr bool operator!= (const AudioBlock< OtherSampleType > &other) const noexcept
 
constexpr size_t getNumChannels () const noexcept
 Returns the number of channels referenced by this block.
 
constexpr size_t getNumSamples () const noexcept
 Returns the number of samples referenced by this block.
 
SampleType * getChannelPointer (size_t channel) const noexcept
 Returns a raw pointer into one of the channels in this block.
 
AudioBlock getSingleChannelBlock (size_t channel) const noexcept
 Returns an AudioBlock that represents one of the channels in this block.
 
AudioBlock getSubsetChannelBlock (size_t channelStart, size_t numChannelsToUse) const noexcept
 Returns a subset of contiguous channels.
 
SampleType getSample (int channel, int sampleIndex) const noexcept
 Returns a sample from the buffer.
 
void setSample (int destChannel, int destSample, SampleType newValue) const noexcept
 Modifies a sample in the buffer.
 
void addSample (int destChannel, int destSample, SampleType valueToAdd) const noexcept
 Adds a value to a sample in the buffer.
 
AudioBlockclear () noexcept
 Clears the memory referenced by this AudioBlock.
 
const AudioBlockclear () const noexcept
 
AudioBlock &JUCE_VECTOR_CALLTYPE fill (NumericType value) noexcept
 Fills the memory referenced by this AudioBlock with value.
 
const AudioBlock &JUCE_VECTOR_CALLTYPE fill (NumericType value) const noexcept
 
template<typename OtherSampleType >
AudioBlockcopyFrom (const AudioBlock< OtherSampleType > &src) noexcept
 Copies the values in src to this block.
 
template<typename OtherSampleType >
const AudioBlockcopyFrom (const AudioBlock< OtherSampleType > &src) const noexcept
 
template<typename OtherNumericType >
AudioBlockcopyFrom (const AudioBuffer< OtherNumericType > &src, size_t srcPos=0, size_t dstPos=0, size_t numElements=std::numeric_limits< size_t >::max())
 Copy the values from an AudioBuffer to this block.
 
template<typename OtherNumericType >
const AudioBlockcopyFrom (const AudioBuffer< OtherNumericType > &src, size_t srcPos=0, size_t dstPos=0, size_t numElements=std::numeric_limits< size_t >::max()) const
 
void copyTo (AudioBuffer< std::remove_const_t< NumericType > > &dst, size_t srcPos=0, size_t dstPos=0, size_t numElements=std::numeric_limits< size_t >::max()) const
 Copies the values from this block to an AudioBuffer.
 
AudioBlockmove (size_t srcPos, size_t dstPos, size_t numElements=std::numeric_limits< size_t >::max()) noexcept
 Move memory within this block from the position srcPos to the position dstPos.
 
const AudioBlockmove (size_t srcPos, size_t dstPos, size_t numElements=std::numeric_limits< size_t >::max()) const noexcept
 
AudioBlock getSubBlock (size_t newOffset, size_t newLength) const noexcept
 Return a new AudioBlock pointing to a sub-block inside this block.
 
AudioBlock getSubBlock (size_t newOffset) const noexcept
 Return a new AudioBlock pointing to a sub-block inside this block.
 
AudioBlock &JUCE_VECTOR_CALLTYPE add (NumericType value) noexcept
 Adds a fixed value to the elements in this block.
 
const AudioBlock &JUCE_VECTOR_CALLTYPE add (NumericType value) const noexcept
 
template<typename OtherSampleType >
AudioBlockadd (AudioBlock< OtherSampleType > src) noexcept
 Adds the elements in the src block to the elements in this block.
 
template<typename OtherSampleType >
const AudioBlockadd (AudioBlock< OtherSampleType > src) const noexcept
 
template<typename OtherSampleType >
AudioBlock &JUCE_VECTOR_CALLTYPE replaceWithSumOf (AudioBlock< OtherSampleType > src, NumericType value) noexcept
 Adds a fixed value to each source value and replaces the contents of this block.
 
template<typename OtherSampleType >
const AudioBlock &JUCE_VECTOR_CALLTYPE replaceWithSumOf (AudioBlock< OtherSampleType > src, NumericType value) const noexcept
 
template<typename Src1SampleType , typename Src2SampleType >
AudioBlockreplaceWithSumOf (AudioBlock< Src1SampleType > src1, AudioBlock< Src2SampleType > src2) noexcept
 Adds each source1 value to the corresponding source2 value and replaces the contents of this block.
 
template<typename Src1SampleType , typename Src2SampleType >
const AudioBlockreplaceWithSumOf (AudioBlock< Src1SampleType > src1, AudioBlock< Src2SampleType > src2) const noexcept
 
AudioBlock &JUCE_VECTOR_CALLTYPE subtract (NumericType value) noexcept
 Subtracts a fixed value from the elements in this block.
 
const AudioBlock &JUCE_VECTOR_CALLTYPE subtract (NumericType value) const noexcept
 
template<typename OtherSampleType >
AudioBlocksubtract (AudioBlock< OtherSampleType > src) noexcept
 Subtracts the source values from the elements in this block.
 
template<typename OtherSampleType >
const AudioBlocksubtract (AudioBlock< OtherSampleType > src) const noexcept
 
template<typename OtherSampleType >
AudioBlock &JUCE_VECTOR_CALLTYPE replaceWithDifferenceOf (AudioBlock< OtherSampleType > src, NumericType value) noexcept
 Subtracts a fixed value from each source value and replaces the contents of this block.
 
template<typename OtherSampleType >
const AudioBlock &JUCE_VECTOR_CALLTYPE replaceWithDifferenceOf (AudioBlock< OtherSampleType > src, NumericType value) const noexcept
 
template<typename Src1SampleType , typename Src2SampleType >
AudioBlockreplaceWithDifferenceOf (AudioBlock< Src1SampleType > src1, AudioBlock< Src2SampleType > src2) noexcept
 Subtracts each source2 value from the corresponding source1 value and replaces the contents of this block.
 
template<typename Src1SampleType , typename Src2SampleType >
const AudioBlockreplaceWithDifferenceOf (AudioBlock< Src1SampleType > src1, AudioBlock< Src2SampleType > src2) const noexcept
 
AudioBlock &JUCE_VECTOR_CALLTYPE multiplyBy (NumericType value) noexcept
 Multiplies the elements in this block by a fixed value.
 
const AudioBlock &JUCE_VECTOR_CALLTYPE multiplyBy (NumericType value) const noexcept
 
template<typename OtherSampleType >
AudioBlockmultiplyBy (AudioBlock< OtherSampleType > src) noexcept
 Multiplies the elements in this block by the elements in the src block.
 
template<typename OtherSampleType >
const AudioBlockmultiplyBy (AudioBlock< OtherSampleType > src) const noexcept
 
template<typename OtherSampleType >
AudioBlock &JUCE_VECTOR_CALLTYPE replaceWithProductOf (AudioBlock< OtherSampleType > src, NumericType value) noexcept
 Replaces the elements in this block with the product of the elements in the source src block and a fixed value.
 
template<typename OtherSampleType >
const AudioBlock &JUCE_VECTOR_CALLTYPE replaceWithProductOf (AudioBlock< OtherSampleType > src, NumericType value) const noexcept
 
template<typename Src1SampleType , typename Src2SampleType >
AudioBlockreplaceWithProductOf (AudioBlock< Src1SampleType > src1, AudioBlock< Src2SampleType > src2) noexcept
 Replaces the elements in this block with the product of the elements in the src1 and scr2 blocks.
 
template<typename Src1SampleType , typename Src2SampleType >
const AudioBlockreplaceWithProductOf (AudioBlock< Src1SampleType > src1, AudioBlock< Src2SampleType > src2) const noexcept
 
template<typename OtherSampleType , typename SmoothingType >
AudioBlockmultiplyBy (SmoothedValue< OtherSampleType, SmoothingType > &value) noexcept
 Multiplies each channels of this block by a smoothly changing value.
 
template<typename OtherSampleType , typename SmoothingType >
const AudioBlockmultiplyBy (SmoothedValue< OtherSampleType, SmoothingType > &value) const noexcept
 
template<typename BlockSampleType , typename SmootherSampleType , typename SmoothingType >
AudioBlockreplaceWithProductOf (AudioBlock< BlockSampleType > src, SmoothedValue< SmootherSampleType, SmoothingType > &value) noexcept
 Replaces each channel of this block with the product of the src block and a smoothed value.
 
template<typename BlockSampleType , typename SmootherSampleType , typename SmoothingType >
const AudioBlockreplaceWithProductOf (AudioBlock< BlockSampleType > src, SmoothedValue< SmootherSampleType, SmoothingType > &value) const noexcept
 
template<typename OtherSampleType >
AudioBlock &JUCE_VECTOR_CALLTYPE addProductOf (AudioBlock< OtherSampleType > src, NumericType factor) noexcept
 Multiplies each value in src by a fixed value and adds the result to this block.
 
template<typename OtherSampleType >
const AudioBlock &JUCE_VECTOR_CALLTYPE addProductOf (AudioBlock< OtherSampleType > src, NumericType factor) const noexcept
 
template<typename Src1SampleType , typename Src2SampleType >
AudioBlockaddProductOf (AudioBlock< Src1SampleType > src1, AudioBlock< Src2SampleType > src2) noexcept
 Multiplies each value in srcA with the corresponding value in srcB and adds the result to this block.
 
template<typename Src1SampleType , typename Src2SampleType >
const AudioBlockaddProductOf (AudioBlock< Src1SampleType > src1, AudioBlock< Src2SampleType > src2) const noexcept
 
AudioBlocknegate () noexcept
 Negates each value of this block.
 
const AudioBlocknegate () const noexcept
 
template<typename OtherSampleType >
AudioBlockreplaceWithNegativeOf (AudioBlock< OtherSampleType > src) noexcept
 Replaces the contents of this block with the negative of the values in the src block.
 
template<typename OtherSampleType >
const AudioBlockreplaceWithNegativeOf (AudioBlock< OtherSampleType > src) const noexcept
 
template<typename OtherSampleType >
AudioBlockreplaceWithAbsoluteValueOf (AudioBlock< OtherSampleType > src) noexcept
 Replaces the contents of this block with the absolute values of the src block.
 
template<typename OtherSampleType >
const AudioBlockreplaceWithAbsoluteValueOf (AudioBlock< OtherSampleType > src) const noexcept
 
template<typename Src1SampleType , typename Src2SampleType >
AudioBlockreplaceWithMinOf (AudioBlock< Src1SampleType > src1, AudioBlock< Src2SampleType > src2) noexcept
 Replaces each element of this block with the minimum of the corresponding element of the source arrays.
 
template<typename Src1SampleType , typename Src2SampleType >
const AudioBlockreplaceWithMinOf (AudioBlock< Src1SampleType > src1, AudioBlock< Src2SampleType > src2) const noexcept
 
template<typename Src1SampleType , typename Src2SampleType >
AudioBlockreplaceWithMaxOf (AudioBlock< Src1SampleType > src1, AudioBlock< Src2SampleType > src2) noexcept
 Replaces each element of this block with the maximum of the corresponding element of the source arrays.
 
template<typename Src1SampleType , typename Src2SampleType >
const AudioBlockreplaceWithMaxOf (AudioBlock< Src1SampleType > src1, AudioBlock< Src2SampleType > src2) const noexcept
 
Range< std::remove_const_t< NumericType > > findMinAndMax () const noexcept
 Finds the minimum and maximum value of the buffer.
 
AudioBlock &JUCE_VECTOR_CALLTYPE operator+= (NumericType value) noexcept
 
const AudioBlock &JUCE_VECTOR_CALLTYPE operator+= (NumericType value) const noexcept
 
AudioBlockoperator+= (AudioBlock src) noexcept
 
const AudioBlockoperator+= (AudioBlock src) const noexcept
 
AudioBlock &JUCE_VECTOR_CALLTYPE operator-= (NumericType value) noexcept
 
const AudioBlock &JUCE_VECTOR_CALLTYPE operator-= (NumericType value) const noexcept
 
AudioBlockoperator-= (AudioBlock src) noexcept
 
const AudioBlockoperator-= (AudioBlock src) const noexcept
 
AudioBlock &JUCE_VECTOR_CALLTYPE operator*= (NumericType value) noexcept
 
const AudioBlock &JUCE_VECTOR_CALLTYPE operator*= (NumericType value) const noexcept
 
AudioBlockoperator*= (AudioBlock src) noexcept
 
const AudioBlockoperator*= (AudioBlock src) const noexcept
 
template<typename OtherSampleType , typename SmoothingType >
AudioBlockoperator*= (SmoothedValue< OtherSampleType, SmoothingType > &value) noexcept
 
template<typename OtherSampleType , typename SmoothingType >
const AudioBlockoperator*= (SmoothedValue< OtherSampleType, SmoothingType > &value) const noexcept
 

Static Public Member Functions

template<typename Src1SampleType , typename Src2SampleType , typename FunctionType >
static void process (AudioBlock< Src1SampleType > inBlock, AudioBlock< Src2SampleType > outBlock, FunctionType &&function)
 Applies a function to each value in an input block, putting the result into an output block.
 

Detailed Description

template<typename SampleType>
class dsp::AudioBlock< SampleType >

Minimal and lightweight data-structure which contains a list of pointers to channels containing some kind of sample data.

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 a HeapBlock to use, 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.

Member Typedef Documentation

◆ NumericType

template<typename SampleType >
using dsp::AudioBlock< SampleType >::NumericType = typename SampleTypeHelpers::ElementType<SampleType>::Type

Constructor & Destructor Documentation

◆ AudioBlock() [1/9]

template<typename SampleType >
dsp::AudioBlock< SampleType >::AudioBlock ( )
defaultnoexcept

Create a zero-sized AudioBlock.

◆ AudioBlock() [2/9]

template<typename SampleType >
dsp::AudioBlock< SampleType >::AudioBlock ( SampleType *const * channelData,
size_t numberOfChannels,
size_t numberOfSamples )
constexprnoexcept

Creates an AudioBlock from a pointer to an array of channels.

AudioBlock does not copy nor own the memory pointed to by dataToUse. Therefore it is the user's responsibility to ensure that the memory is retained throughout the life-time of the AudioBlock and released when no longer needed.

◆ AudioBlock() [3/9]

template<typename SampleType >
dsp::AudioBlock< SampleType >::AudioBlock ( SampleType *const * channelData,
size_t numberOfChannels,
size_t startSampleIndex,
size_t numberOfSamples )
constexprnoexcept

Creates an AudioBlock from a pointer to an array of channels.

AudioBlock does not copy nor own the memory pointed to by dataToUse. Therefore it is the user's responsibility to ensure that the memory is retained throughout the life-time of the AudioBlock and released when no longer needed.

◆ AudioBlock() [4/9]

template<typename SampleType >
dsp::AudioBlock< SampleType >::AudioBlock ( HeapBlock< char > & heapBlockToUseForAllocation,
size_t numberOfChannels,
size_t numberOfSamples,
size_t alignmentInBytes = defaultAlignment )
noexcept

Allocates a suitable amount of space in a HeapBlock, and initialises this object to point into it.

The HeapBlock must of course not be freed or re-allocated while this object is still in use, because it will be referencing its data.

References addBytesToPointer(), snapPointerToAlignment(), and unalignedPointerCast().

◆ AudioBlock() [5/9]

template<typename SampleType >
template<typename OtherSampleType >
dsp::AudioBlock< SampleType >::AudioBlock ( AudioBuffer< OtherSampleType > & buffer)
constexprnoexcept

Creates an AudioBlock that points to the data in an AudioBuffer.

AudioBlock does not copy nor own the memory pointed to by dataToUse. Therefore it is the user's responsibility to ensure that the buffer is retained throughout the life-time of the AudioBlock without being modified.

◆ AudioBlock() [6/9]

template<typename SampleType >
template<typename OtherSampleType >
dsp::AudioBlock< SampleType >::AudioBlock ( const AudioBuffer< OtherSampleType > & buffer)
constexprnoexcept

Creates an AudioBlock that points to the data in an AudioBuffer.

AudioBlock does not copy nor own the memory pointed to by dataToUse. Therefore it is the user's responsibility to ensure that the buffer is retained throughout the life-time of the AudioBlock without being modified.

◆ AudioBlock() [7/9]

template<typename SampleType >
template<typename OtherSampleType >
dsp::AudioBlock< SampleType >::AudioBlock ( AudioBuffer< OtherSampleType > & buffer,
size_t startSampleIndex )
noexcept

Creates an AudioBlock that points to the data in an AudioBuffer.

AudioBlock does not copy nor own the memory pointed to by dataToUse. Therefore it is the user's responsibility to ensure that the buffer is retained throughout the life-time of the AudioBlock without being modified.

References jassert.

◆ AudioBlock() [8/9]

template<typename SampleType >
dsp::AudioBlock< SampleType >::AudioBlock ( const AudioBlock< SampleType > & other)
defaultnoexcept

◆ AudioBlock() [9/9]

template<typename SampleType >
template<typename OtherSampleType , MayUseConvertingConstructor< OtherSampleType > = 0>
dsp::AudioBlock< SampleType >::AudioBlock ( const AudioBlock< OtherSampleType > & other)
noexcept

Member Function Documentation

◆ operator=() [1/2]

template<typename SampleType >
AudioBlock & dsp::AudioBlock< SampleType >::operator= ( const AudioBlock< SampleType > & other)
defaultnoexcept

◆ operator=() [2/2]

template<typename SampleType >
template<typename OtherSampleType , MayUseConvertingConstructor< OtherSampleType > = 0>
AudioBlock & dsp::AudioBlock< SampleType >::operator= ( const AudioBlock< OtherSampleType > & other)
noexcept

◆ swap()

template<typename SampleType >
void dsp::AudioBlock< SampleType >::swap ( AudioBlock< SampleType > & other)
noexcept

◆ operator==()

template<typename SampleType >
template<typename OtherSampleType >
bool dsp::AudioBlock< SampleType >::operator== ( const AudioBlock< OtherSampleType > & other) const
constexprnoexcept

◆ operator!=()

template<typename SampleType >
template<typename OtherSampleType >
bool dsp::AudioBlock< SampleType >::operator!= ( const AudioBlock< OtherSampleType > & other) const
constexprnoexcept

◆ getNumChannels()

template<typename SampleType >
size_t dsp::AudioBlock< SampleType >::getNumChannels ( ) const
constexprnoexcept

Returns the number of channels referenced by this block.

Referenced by dsp::AudioBlock< SampleType >::process().

◆ getNumSamples()

template<typename SampleType >
size_t dsp::AudioBlock< SampleType >::getNumSamples ( ) const
constexprnoexcept

Returns the number of samples referenced by this block.

Referenced by dsp::AudioBlock< SampleType >::getSubBlock(), and dsp::AudioBlock< SampleType >::process().

◆ getChannelPointer()

template<typename SampleType >
SampleType * dsp::AudioBlock< SampleType >::getChannelPointer ( size_t channel) const
noexcept

Returns a raw pointer into one of the channels in this block.

References jassert.

Referenced by dsp::AudioBlock< SampleType >::process().

◆ getSingleChannelBlock()

template<typename SampleType >
AudioBlock dsp::AudioBlock< SampleType >::getSingleChannelBlock ( size_t channel) const
noexcept

Returns an AudioBlock that represents one of the channels in this block.

References dsp::AudioBlock< SampleType >::AudioBlock, and jassert.

◆ getSubsetChannelBlock()

template<typename SampleType >
AudioBlock dsp::AudioBlock< SampleType >::getSubsetChannelBlock ( size_t channelStart,
size_t numChannelsToUse ) const
noexcept

Returns a subset of contiguous channels.

Parameters
channelStartFirst channel of the subset
numChannelsToUseCount of channels in the subset

References dsp::AudioBlock< SampleType >::AudioBlock, and jassert.

◆ getSample()

template<typename SampleType >
SampleType dsp::AudioBlock< SampleType >::getSample ( int channel,
int sampleIndex ) const
noexcept

Returns a sample from the buffer.

The channel and index are not checked - they are expected to be in-range. If not, an assertion will be thrown, but in a release build, you're into 'undefined behaviour' territory.

References isPositiveAndBelow(), and jassert.

◆ setSample()

template<typename SampleType >
void dsp::AudioBlock< SampleType >::setSample ( int destChannel,
int destSample,
SampleType newValue ) const
noexcept

Modifies a sample in the buffer.

The channel and index are not checked - they are expected to be in-range. If not, an assertion will be thrown, but in a release build, you're into 'undefined behaviour' territory.

References isPositiveAndBelow(), and jassert.

◆ addSample()

template<typename SampleType >
void dsp::AudioBlock< SampleType >::addSample ( int destChannel,
int destSample,
SampleType valueToAdd ) const
noexcept

Adds a value to a sample in the buffer.

The channel and index are not checked - they are expected to be in-range. If not, an assertion will be thrown, but in a release build, you're into 'undefined behaviour' territory.

References isPositiveAndBelow(), and jassert.

◆ clear() [1/2]

template<typename SampleType >
AudioBlock & dsp::AudioBlock< SampleType >::clear ( )
noexcept

Clears the memory referenced by this AudioBlock.

◆ clear() [2/2]

template<typename SampleType >
const AudioBlock & dsp::AudioBlock< SampleType >::clear ( ) const
noexcept

◆ fill() [1/2]

template<typename SampleType >
AudioBlock &JUCE_VECTOR_CALLTYPE dsp::AudioBlock< SampleType >::fill ( NumericType value)
noexcept

Fills the memory referenced by this AudioBlock with value.

◆ fill() [2/2]

template<typename SampleType >
const AudioBlock &JUCE_VECTOR_CALLTYPE dsp::AudioBlock< SampleType >::fill ( NumericType value) const
noexcept

◆ copyFrom() [1/4]

template<typename SampleType >
template<typename OtherSampleType >
AudioBlock & dsp::AudioBlock< SampleType >::copyFrom ( const AudioBlock< OtherSampleType > & src)
noexcept

Copies the values in src to this block.

◆ copyFrom() [2/4]

template<typename SampleType >
template<typename OtherSampleType >
const AudioBlock & dsp::AudioBlock< SampleType >::copyFrom ( const AudioBlock< OtherSampleType > & src) const
noexcept

◆ copyFrom() [3/4]

template<typename SampleType >
template<typename OtherNumericType >
AudioBlock & dsp::AudioBlock< SampleType >::copyFrom ( const AudioBuffer< OtherNumericType > & src,
size_t srcPos = 0,
size_t dstPos = 0,
size_t numElements = std::numeric_limits<size_t>::max() )

Copy the values from an AudioBuffer to this block.

All indices and sizes are in this AudioBlock's units, i.e. if SampleType is a SIMDRegister then incrementing srcPos by one will increase the sample position in the AudioBuffer's units by a factor of SIMDRegister<SampleType>::SIMDNumElements.

◆ copyFrom() [4/4]

template<typename SampleType >
template<typename OtherNumericType >
const AudioBlock & dsp::AudioBlock< SampleType >::copyFrom ( const AudioBuffer< OtherNumericType > & src,
size_t srcPos = 0,
size_t dstPos = 0,
size_t numElements = std::numeric_limits<size_t>::max() ) const

◆ copyTo()

template<typename SampleType >
void dsp::AudioBlock< SampleType >::copyTo ( AudioBuffer< std::remove_const_t< NumericType > > & dst,
size_t srcPos = 0,
size_t dstPos = 0,
size_t numElements = std::numeric_limits<size_t>::max() ) const

Copies the values from this block to an AudioBuffer.

All indices and sizes are in this AudioBlock's units, i.e. if SampleType is a SIMDRegister then incrementing dstPos by one will increase the sample position in the AudioBuffer's units by a factor of SIMDRegister<SampleType>::SIMDNumElements.

References jmin().

◆ move() [1/2]

template<typename SampleType >
AudioBlock & dsp::AudioBlock< SampleType >::move ( size_t srcPos,
size_t dstPos,
size_t numElements = std::numeric_limits<size_t>::max() )
noexcept

Move memory within this block from the position srcPos to the position dstPos.

If numElements is not specified then move will move the maximum amount of memory.

◆ move() [2/2]

template<typename SampleType >
const AudioBlock & dsp::AudioBlock< SampleType >::move ( size_t srcPos,
size_t dstPos,
size_t numElements = std::numeric_limits<size_t>::max() ) const
noexcept

◆ getSubBlock() [1/2]

template<typename SampleType >
AudioBlock dsp::AudioBlock< SampleType >::getSubBlock ( size_t newOffset,
size_t newLength ) const
noexcept

Return a new AudioBlock pointing to a sub-block inside this block.

This function does not copy the memory and you must ensure that the original memory pointed to by the receiver remains valid through-out the life-time of the returned sub-block.

Parameters
newOffsetThe index of an element inside the receiver which will will become the first element of the return value.
newLengthThe number of elements of the newly created sub-block.

References dsp::AudioBlock< SampleType >::AudioBlock, and jassert.

Referenced by dsp::AudioBlock< SampleType >::getSubBlock(), dsp::Chorus< SampleType >::process(), and dsp::Phaser< SampleType >::process().

◆ getSubBlock() [2/2]

template<typename SampleType >
AudioBlock dsp::AudioBlock< SampleType >::getSubBlock ( size_t newOffset) const
noexcept

Return a new AudioBlock pointing to a sub-block inside this block.

This function does not copy the memory and you must ensure that the original memory pointed to by the receiver remains valid through-out the life-time of the returned sub-block.

Parameters
newOffsetThe index of an element inside the block which will will become the first element of the return value. The return value will include all subsequent elements of the receiver.

References dsp::AudioBlock< SampleType >::getNumSamples(), and dsp::AudioBlock< SampleType >::getSubBlock().

◆ add() [1/4]

template<typename SampleType >
AudioBlock &JUCE_VECTOR_CALLTYPE dsp::AudioBlock< SampleType >::add ( NumericType value)
noexcept

◆ add() [2/4]

template<typename SampleType >
const AudioBlock &JUCE_VECTOR_CALLTYPE dsp::AudioBlock< SampleType >::add ( NumericType value) const
noexcept

◆ add() [3/4]

template<typename SampleType >
template<typename OtherSampleType >
AudioBlock & dsp::AudioBlock< SampleType >::add ( AudioBlock< OtherSampleType > src)
noexcept

Adds the elements in the src block to the elements in this block.

◆ add() [4/4]

template<typename SampleType >
template<typename OtherSampleType >
const AudioBlock & dsp::AudioBlock< SampleType >::add ( AudioBlock< OtherSampleType > src) const
noexcept

◆ replaceWithSumOf() [1/4]

template<typename SampleType >
template<typename OtherSampleType >
AudioBlock &JUCE_VECTOR_CALLTYPE dsp::AudioBlock< SampleType >::replaceWithSumOf ( AudioBlock< OtherSampleType > src,
NumericType value )
noexcept

Adds a fixed value to each source value and replaces the contents of this block.

◆ replaceWithSumOf() [2/4]

template<typename SampleType >
template<typename OtherSampleType >
const AudioBlock &JUCE_VECTOR_CALLTYPE dsp::AudioBlock< SampleType >::replaceWithSumOf ( AudioBlock< OtherSampleType > src,
NumericType value ) const
noexcept

◆ replaceWithSumOf() [3/4]

template<typename SampleType >
template<typename Src1SampleType , typename Src2SampleType >
AudioBlock & dsp::AudioBlock< SampleType >::replaceWithSumOf ( AudioBlock< Src1SampleType > src1,
AudioBlock< Src2SampleType > src2 )
noexcept

Adds each source1 value to the corresponding source2 value and replaces the contents of this block.

◆ replaceWithSumOf() [4/4]

template<typename SampleType >
template<typename Src1SampleType , typename Src2SampleType >
const AudioBlock & dsp::AudioBlock< SampleType >::replaceWithSumOf ( AudioBlock< Src1SampleType > src1,
AudioBlock< Src2SampleType > src2 ) const
noexcept

◆ subtract() [1/4]

template<typename SampleType >
AudioBlock &JUCE_VECTOR_CALLTYPE dsp::AudioBlock< SampleType >::subtract ( NumericType value)
noexcept

◆ subtract() [2/4]

template<typename SampleType >
const AudioBlock &JUCE_VECTOR_CALLTYPE dsp::AudioBlock< SampleType >::subtract ( NumericType value) const
noexcept

◆ subtract() [3/4]

template<typename SampleType >
template<typename OtherSampleType >
AudioBlock & dsp::AudioBlock< SampleType >::subtract ( AudioBlock< OtherSampleType > src)
noexcept

Subtracts the source values from the elements in this block.

◆ subtract() [4/4]

template<typename SampleType >
template<typename OtherSampleType >
const AudioBlock & dsp::AudioBlock< SampleType >::subtract ( AudioBlock< OtherSampleType > src) const
noexcept

◆ replaceWithDifferenceOf() [1/4]

template<typename SampleType >
template<typename OtherSampleType >
AudioBlock &JUCE_VECTOR_CALLTYPE dsp::AudioBlock< SampleType >::replaceWithDifferenceOf ( AudioBlock< OtherSampleType > src,
NumericType value )
noexcept

Subtracts a fixed value from each source value and replaces the contents of this block.

◆ replaceWithDifferenceOf() [2/4]

template<typename SampleType >
template<typename OtherSampleType >
const AudioBlock &JUCE_VECTOR_CALLTYPE dsp::AudioBlock< SampleType >::replaceWithDifferenceOf ( AudioBlock< OtherSampleType > src,
NumericType value ) const
noexcept

◆ replaceWithDifferenceOf() [3/4]

template<typename SampleType >
template<typename Src1SampleType , typename Src2SampleType >
AudioBlock & dsp::AudioBlock< SampleType >::replaceWithDifferenceOf ( AudioBlock< Src1SampleType > src1,
AudioBlock< Src2SampleType > src2 )
noexcept

Subtracts each source2 value from the corresponding source1 value and replaces the contents of this block.

◆ replaceWithDifferenceOf() [4/4]

template<typename SampleType >
template<typename Src1SampleType , typename Src2SampleType >
const AudioBlock & dsp::AudioBlock< SampleType >::replaceWithDifferenceOf ( AudioBlock< Src1SampleType > src1,
AudioBlock< Src2SampleType > src2 ) const
noexcept

◆ multiplyBy() [1/6]

◆ multiplyBy() [2/6]

template<typename SampleType >
const AudioBlock &JUCE_VECTOR_CALLTYPE dsp::AudioBlock< SampleType >::multiplyBy ( NumericType value) const
noexcept

◆ multiplyBy() [3/6]

template<typename SampleType >
template<typename OtherSampleType >
AudioBlock & dsp::AudioBlock< SampleType >::multiplyBy ( AudioBlock< OtherSampleType > src)
noexcept

Multiplies the elements in this block by the elements in the src block.

◆ multiplyBy() [4/6]

template<typename SampleType >
template<typename OtherSampleType >
const AudioBlock & dsp::AudioBlock< SampleType >::multiplyBy ( AudioBlock< OtherSampleType > src) const
noexcept

◆ replaceWithProductOf() [1/6]

template<typename SampleType >
template<typename OtherSampleType >
AudioBlock &JUCE_VECTOR_CALLTYPE dsp::AudioBlock< SampleType >::replaceWithProductOf ( AudioBlock< OtherSampleType > src,
NumericType value )
noexcept

Replaces the elements in this block with the product of the elements in the source src block and a fixed value.

◆ replaceWithProductOf() [2/6]

template<typename SampleType >
template<typename OtherSampleType >
const AudioBlock &JUCE_VECTOR_CALLTYPE dsp::AudioBlock< SampleType >::replaceWithProductOf ( AudioBlock< OtherSampleType > src,
NumericType value ) const
noexcept

◆ replaceWithProductOf() [3/6]

template<typename SampleType >
template<typename Src1SampleType , typename Src2SampleType >
AudioBlock & dsp::AudioBlock< SampleType >::replaceWithProductOf ( AudioBlock< Src1SampleType > src1,
AudioBlock< Src2SampleType > src2 )
noexcept

Replaces the elements in this block with the product of the elements in the src1 and scr2 blocks.

◆ replaceWithProductOf() [4/6]

template<typename SampleType >
template<typename Src1SampleType , typename Src2SampleType >
const AudioBlock & dsp::AudioBlock< SampleType >::replaceWithProductOf ( AudioBlock< Src1SampleType > src1,
AudioBlock< Src2SampleType > src2 ) const
noexcept

◆ multiplyBy() [5/6]

template<typename SampleType >
template<typename OtherSampleType , typename SmoothingType >
AudioBlock & dsp::AudioBlock< SampleType >::multiplyBy ( SmoothedValue< OtherSampleType, SmoothingType > & value)
noexcept

Multiplies each channels of this block by a smoothly changing value.

◆ multiplyBy() [6/6]

template<typename SampleType >
template<typename OtherSampleType , typename SmoothingType >
const AudioBlock & dsp::AudioBlock< SampleType >::multiplyBy ( SmoothedValue< OtherSampleType, SmoothingType > & value) const
noexcept

◆ replaceWithProductOf() [5/6]

template<typename SampleType >
template<typename BlockSampleType , typename SmootherSampleType , typename SmoothingType >
AudioBlock & dsp::AudioBlock< SampleType >::replaceWithProductOf ( AudioBlock< BlockSampleType > src,
SmoothedValue< SmootherSampleType, SmoothingType > & value )
noexcept

Replaces each channel of this block with the product of the src block and a smoothed value.

◆ replaceWithProductOf() [6/6]

template<typename SampleType >
template<typename BlockSampleType , typename SmootherSampleType , typename SmoothingType >
const AudioBlock & dsp::AudioBlock< SampleType >::replaceWithProductOf ( AudioBlock< BlockSampleType > src,
SmoothedValue< SmootherSampleType, SmoothingType > & value ) const
noexcept

◆ addProductOf() [1/4]

template<typename SampleType >
template<typename OtherSampleType >
AudioBlock &JUCE_VECTOR_CALLTYPE dsp::AudioBlock< SampleType >::addProductOf ( AudioBlock< OtherSampleType > src,
NumericType factor )
noexcept

Multiplies each value in src by a fixed value and adds the result to this block.

◆ addProductOf() [2/4]

template<typename SampleType >
template<typename OtherSampleType >
const AudioBlock &JUCE_VECTOR_CALLTYPE dsp::AudioBlock< SampleType >::addProductOf ( AudioBlock< OtherSampleType > src,
NumericType factor ) const
noexcept

◆ addProductOf() [3/4]

template<typename SampleType >
template<typename Src1SampleType , typename Src2SampleType >
AudioBlock & dsp::AudioBlock< SampleType >::addProductOf ( AudioBlock< Src1SampleType > src1,
AudioBlock< Src2SampleType > src2 )
noexcept

Multiplies each value in srcA with the corresponding value in srcB and adds the result to this block.

◆ addProductOf() [4/4]

template<typename SampleType >
template<typename Src1SampleType , typename Src2SampleType >
const AudioBlock & dsp::AudioBlock< SampleType >::addProductOf ( AudioBlock< Src1SampleType > src1,
AudioBlock< Src2SampleType > src2 ) const
noexcept

◆ negate() [1/2]

template<typename SampleType >
AudioBlock & dsp::AudioBlock< SampleType >::negate ( )
noexcept

Negates each value of this block.

◆ negate() [2/2]

template<typename SampleType >
const AudioBlock & dsp::AudioBlock< SampleType >::negate ( ) const
noexcept

◆ replaceWithNegativeOf() [1/2]

template<typename SampleType >
template<typename OtherSampleType >
AudioBlock & dsp::AudioBlock< SampleType >::replaceWithNegativeOf ( AudioBlock< OtherSampleType > src)
noexcept

Replaces the contents of this block with the negative of the values in the src block.

◆ replaceWithNegativeOf() [2/2]

template<typename SampleType >
template<typename OtherSampleType >
const AudioBlock & dsp::AudioBlock< SampleType >::replaceWithNegativeOf ( AudioBlock< OtherSampleType > src) const
noexcept

◆ replaceWithAbsoluteValueOf() [1/2]

template<typename SampleType >
template<typename OtherSampleType >
AudioBlock & dsp::AudioBlock< SampleType >::replaceWithAbsoluteValueOf ( AudioBlock< OtherSampleType > src)
noexcept

Replaces the contents of this block with the absolute values of the src block.

◆ replaceWithAbsoluteValueOf() [2/2]

template<typename SampleType >
template<typename OtherSampleType >
const AudioBlock & dsp::AudioBlock< SampleType >::replaceWithAbsoluteValueOf ( AudioBlock< OtherSampleType > src) const
noexcept

◆ replaceWithMinOf() [1/2]

template<typename SampleType >
template<typename Src1SampleType , typename Src2SampleType >
AudioBlock & dsp::AudioBlock< SampleType >::replaceWithMinOf ( AudioBlock< Src1SampleType > src1,
AudioBlock< Src2SampleType > src2 )
noexcept

Replaces each element of this block with the minimum of the corresponding element of the source arrays.

◆ replaceWithMinOf() [2/2]

template<typename SampleType >
template<typename Src1SampleType , typename Src2SampleType >
const AudioBlock & dsp::AudioBlock< SampleType >::replaceWithMinOf ( AudioBlock< Src1SampleType > src1,
AudioBlock< Src2SampleType > src2 ) const
noexcept

◆ replaceWithMaxOf() [1/2]

template<typename SampleType >
template<typename Src1SampleType , typename Src2SampleType >
AudioBlock & dsp::AudioBlock< SampleType >::replaceWithMaxOf ( AudioBlock< Src1SampleType > src1,
AudioBlock< Src2SampleType > src2 )
noexcept

Replaces each element of this block with the maximum of the corresponding element of the source arrays.

◆ replaceWithMaxOf() [2/2]

template<typename SampleType >
template<typename Src1SampleType , typename Src2SampleType >
const AudioBlock & dsp::AudioBlock< SampleType >::replaceWithMaxOf ( AudioBlock< Src1SampleType > src1,
AudioBlock< Src2SampleType > src2 ) const
noexcept

◆ findMinAndMax()

template<typename SampleType >
Range< std::remove_const_t< NumericType > > dsp::AudioBlock< SampleType >::findMinAndMax ( ) const
noexcept

Finds the minimum and maximum value of the buffer.

◆ operator+=() [1/4]

template<typename SampleType >
AudioBlock &JUCE_VECTOR_CALLTYPE dsp::AudioBlock< SampleType >::operator+= ( NumericType value)
noexcept

◆ operator+=() [2/4]

template<typename SampleType >
const AudioBlock &JUCE_VECTOR_CALLTYPE dsp::AudioBlock< SampleType >::operator+= ( NumericType value) const
noexcept

◆ operator+=() [3/4]

template<typename SampleType >
AudioBlock & dsp::AudioBlock< SampleType >::operator+= ( AudioBlock< SampleType > src)
noexcept

◆ operator+=() [4/4]

template<typename SampleType >
const AudioBlock & dsp::AudioBlock< SampleType >::operator+= ( AudioBlock< SampleType > src) const
noexcept

◆ operator-=() [1/4]

template<typename SampleType >
AudioBlock &JUCE_VECTOR_CALLTYPE dsp::AudioBlock< SampleType >::operator-= ( NumericType value)
noexcept

◆ operator-=() [2/4]

template<typename SampleType >
const AudioBlock &JUCE_VECTOR_CALLTYPE dsp::AudioBlock< SampleType >::operator-= ( NumericType value) const
noexcept

◆ operator-=() [3/4]

template<typename SampleType >
AudioBlock & dsp::AudioBlock< SampleType >::operator-= ( AudioBlock< SampleType > src)
noexcept

◆ operator-=() [4/4]

template<typename SampleType >
const AudioBlock & dsp::AudioBlock< SampleType >::operator-= ( AudioBlock< SampleType > src) const
noexcept

◆ operator*=() [1/6]

template<typename SampleType >
AudioBlock &JUCE_VECTOR_CALLTYPE dsp::AudioBlock< SampleType >::operator*= ( NumericType value)
noexcept

◆ operator*=() [2/6]

template<typename SampleType >
const AudioBlock &JUCE_VECTOR_CALLTYPE dsp::AudioBlock< SampleType >::operator*= ( NumericType value) const
noexcept

◆ operator*=() [3/6]

template<typename SampleType >
AudioBlock & dsp::AudioBlock< SampleType >::operator*= ( AudioBlock< SampleType > src)
noexcept

◆ operator*=() [4/6]

template<typename SampleType >
const AudioBlock & dsp::AudioBlock< SampleType >::operator*= ( AudioBlock< SampleType > src) const
noexcept

◆ operator*=() [5/6]

template<typename SampleType >
template<typename OtherSampleType , typename SmoothingType >
AudioBlock & dsp::AudioBlock< SampleType >::operator*= ( SmoothedValue< OtherSampleType, SmoothingType > & value)
noexcept

◆ operator*=() [6/6]

template<typename SampleType >
template<typename OtherSampleType , typename SmoothingType >
const AudioBlock & dsp::AudioBlock< SampleType >::operator*= ( SmoothedValue< OtherSampleType, SmoothingType > & value) const
noexcept

◆ process()

template<typename SampleType >
template<typename Src1SampleType , typename Src2SampleType , typename FunctionType >
static void dsp::AudioBlock< SampleType >::process ( AudioBlock< Src1SampleType > inBlock,
AudioBlock< Src2SampleType > outBlock,
FunctionType && function )
static

Applies a function to each value in an input block, putting the result into an output block.

The function supplied must take a SampleType as its parameter, and return a SampleType. The two blocks must have the same number of channels and samples.

References dsp::AudioBlock< SampleType >::getChannelPointer(), dsp::AudioBlock< SampleType >::getNumChannels(), dsp::AudioBlock< SampleType >::getNumSamples(), and jassert.

Referenced by dsp::WaveShaper< FloatType, Function >::process().


The documentation for this class was generated from the following file:
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram