OpenShot Library | OpenShotAudio  0.2.2
juce::AudioBuffer< Type > Class Template Reference

A multi-channel buffer containing floating point audio samples. More...

#include <juce_AudioSampleBuffer.h>

Public Types

using SampleType = Type
 This allows templated code that takes an AudioBuffer to access its sample type.
 

Public Member Functions

 AudioBuffer () noexcept
 Creates an empty buffer with 0 channels and 0 length.
 
 AudioBuffer (int numChannelsToAllocate, int numSamplesToAllocate)
 Creates a buffer with a specified number of channels and samples. More...
 
 AudioBuffer (Type *const *dataToReferTo, int numChannelsToUse, int numSamples)
 Creates a buffer using a pre-allocated block of memory. More...
 
 AudioBuffer (Type *const *dataToReferTo, int numChannelsToUse, int startSample, int numSamples)
 Creates a buffer using a pre-allocated block of memory. More...
 
 AudioBuffer (const AudioBuffer &other)
 Copies another buffer. More...
 
AudioBufferoperator= (const AudioBuffer &other)
 Copies another buffer onto this one. More...
 
 ~AudioBuffer ()=default
 Destructor. More...
 
 AudioBuffer (AudioBuffer &&other) noexcept
 Move constructor.
 
AudioBufferoperator= (AudioBuffer &&other) noexcept
 Move assignment.
 
int getNumChannels () const noexcept
 Returns the number of channels of audio data that this buffer contains. More...
 
int getNumSamples () const noexcept
 Returns the number of samples allocated in each of the buffer's channels. More...
 
const Type * getReadPointer (int channelNumber) const noexcept
 Returns a pointer to an array of read-only samples in one of the buffer's channels. More...
 
const Type * getReadPointer (int channelNumber, int sampleIndex) const noexcept
 Returns a pointer to an array of read-only samples in one of the buffer's channels. More...
 
Type * getWritePointer (int channelNumber) noexcept
 Returns a writeable pointer to one of the buffer's channels. More...
 
Type * getWritePointer (int channelNumber, int sampleIndex) noexcept
 Returns a writeable pointer to one of the buffer's channels. More...
 
const Type ** getArrayOfReadPointers () const noexcept
 Returns an array of pointers to the channels in the buffer. More...
 
Type ** getArrayOfWritePointers () noexcept
 Returns an array of pointers to the channels in the buffer. More...
 
void setSize (int newNumChannels, int newNumSamples, bool keepExistingContent=false, bool clearExtraSpace=false, bool avoidReallocating=false)
 Changes the buffer's size or number of channels. More...
 
void setDataToReferTo (Type **dataToReferTo, int newNumChannels, int newStartSample, int newNumSamples)
 Makes this buffer point to a pre-allocated set of channel data arrays. More...
 
void setDataToReferTo (Type **dataToReferTo, int newNumChannels, int newNumSamples)
 Makes this buffer point to a pre-allocated set of channel data arrays. More...
 
template<typename OtherType >
void makeCopyOf (const AudioBuffer< OtherType > &other, bool avoidReallocating=false)
 Resizes this buffer to match the given one, and copies all of its content across. More...
 
void clear () noexcept
 Clears all the samples in all channels.
 
void clear (int startSample, int numSamples) noexcept
 Clears a specified region of all the channels. More...
 
void clear (int channel, int startSample, int numSamples) noexcept
 Clears a specified region of just one channel. More...
 
bool hasBeenCleared () const noexcept
 Returns true if the buffer has been entirely cleared. More...
 
Type getSample (int channel, int sampleIndex) const noexcept
 Returns a sample from the buffer. More...
 
void setSample (int destChannel, int destSample, Type newValue) noexcept
 Sets a sample in the buffer. More...
 
void addSample (int destChannel, int destSample, Type valueToAdd) noexcept
 Adds a value to a sample in the buffer. More...
 
void applyGain (int channel, int startSample, int numSamples, Type gain) noexcept
 Applies a gain multiple to a region of one channel. More...
 
void applyGain (int startSample, int numSamples, Type gain) noexcept
 Applies a gain multiple to a region of all the channels. More...
 
void applyGain (Type gain) noexcept
 Applies a gain multiple to all the audio data.
 
void applyGainRamp (int channel, int startSample, int numSamples, Type startGain, Type endGain) noexcept
 Applies a range of gains to a region of a channel. More...
 
void applyGainRamp (int startSample, int numSamples, Type startGain, Type endGain) noexcept
 Applies a range of gains to a region of all channels. More...
 
void addFrom (int destChannel, int destStartSample, const AudioBuffer &source, int sourceChannel, int sourceStartSample, int numSamples, Type gainToApplyToSource=Type(1)) noexcept
 Adds samples from another buffer to this one. More...
 
void addFrom (int destChannel, int destStartSample, const Type *source, int numSamples, Type gainToApplyToSource=Type(1)) noexcept
 Adds samples from an array of floats to one of the channels. More...
 
void addFromWithRamp (int destChannel, int destStartSample, const Type *source, int numSamples, Type startGain, Type endGain) noexcept
 Adds samples from an array of floats, applying a gain ramp to them. More...
 
void copyFrom (int destChannel, int destStartSample, const AudioBuffer &source, int sourceChannel, int sourceStartSample, int numSamples) noexcept
 Copies samples from another buffer to this one. More...
 
void copyFrom (int destChannel, int destStartSample, const Type *source, int numSamples) noexcept
 Copies samples from an array of floats into one of the channels. More...
 
void copyFrom (int destChannel, int destStartSample, const Type *source, int numSamples, Type gain) noexcept
 Copies samples from an array of floats into one of the channels, applying a gain to it. More...
 
void copyFromWithRamp (int destChannel, int destStartSample, const Type *source, int numSamples, Type startGain, Type endGain) noexcept
 Copies samples from an array of floats into one of the channels, applying a gain ramp. More...
 
Range< Type > findMinMax (int channel, int startSample, int numSamples) const noexcept
 Returns a Range indicating the lowest and highest sample values in a given section. More...
 
Type getMagnitude (int channel, int startSample, int numSamples) const noexcept
 Finds the highest absolute sample value within a region of a channel.
 
Type getMagnitude (int startSample, int numSamples) const noexcept
 Finds the highest absolute sample value within a region on all channels.
 
Type getRMSLevel (int channel, int startSample, int numSamples) const noexcept
 Returns the root mean squared level for a region of a channel.
 
void reverse (int channel, int startSample, int numSamples) const noexcept
 Reverses a part of a channel.
 
void reverse (int startSample, int numSamples) const noexcept
 Reverses a part of the buffer.
 

Detailed Description

template<typename Type>
class juce::AudioBuffer< Type >

A multi-channel buffer containing floating point audio samples.

Definition at line 37 of file juce_AudioSampleBuffer.h.

Constructor & Destructor Documentation

◆ AudioBuffer() [1/4]

template<typename Type >
juce::AudioBuffer< Type >::AudioBuffer ( int  numChannelsToAllocate,
int  numSamplesToAllocate 
)
inline

Creates a buffer with a specified number of channels and samples.

The contents of the buffer will initially be undefined, so use clear() to set all the samples to zero.

The buffer will allocate its memory internally, and this will be released when the buffer is deleted. If the memory can't be allocated, this will throw a std::bad_alloc exception.

Definition at line 57 of file juce_AudioSampleBuffer.h.

◆ AudioBuffer() [2/4]

template<typename Type >
juce::AudioBuffer< Type >::AudioBuffer ( Type *const *  dataToReferTo,
int  numChannelsToUse,
int  numSamples 
)
inline

Creates a buffer using a pre-allocated block of memory.

Note that if the buffer is resized or its number of channels is changed, it will re-allocate memory internally and copy the existing data to this new area, so it will then stop directly addressing this memory.

Parameters
dataToReferToa pre-allocated array containing pointers to the data for each channel that should be used by this buffer. The buffer will only refer to this memory, it won't try to delete it when the buffer is deleted or resized.
numChannelsToUsethe number of channels to use - this must correspond to the number of elements in the array passed in
numSamplesthe number of samples to use - this must correspond to the size of the arrays passed in

Definition at line 81 of file juce_AudioSampleBuffer.h.

◆ AudioBuffer() [3/4]

template<typename Type >
juce::AudioBuffer< Type >::AudioBuffer ( Type *const *  dataToReferTo,
int  numChannelsToUse,
int  startSample,
int  numSamples 
)
inline

Creates a buffer using a pre-allocated block of memory.

Note that if the buffer is resized or its number of channels is changed, it will re-allocate memory internally and copy the existing data to this new area, so it will then stop directly addressing this memory.

Parameters
dataToReferToa pre-allocated array containing pointers to the data for each channel that should be used by this buffer. The buffer will only refer to this memory, it won't try to delete it when the buffer is deleted or resized.
numChannelsToUsethe number of channels to use - this must correspond to the number of elements in the array passed in
startSamplethe offset within the arrays at which the data begins
numSamplesthe number of samples to use - this must correspond to the size of the arrays passed in

Definition at line 108 of file juce_AudioSampleBuffer.h.

◆ AudioBuffer() [4/4]

template<typename Type >
juce::AudioBuffer< Type >::AudioBuffer ( const AudioBuffer< Type > &  other)
inline

Copies another buffer.

This buffer will make its own copy of the other's data, unless the buffer was created using an external data buffer, in which case both buffers will just point to the same shared block of data.

Definition at line 126 of file juce_AudioSampleBuffer.h.

References juce::AudioBuffer< Type >::clear(), and juce::FloatVectorOperations::copy().

◆ ~AudioBuffer()

template<typename Type >
juce::AudioBuffer< Type >::~AudioBuffer ( )
default

Destructor.

This will free any memory allocated by the buffer.

Member Function Documentation

◆ operator=()

template<typename Type >
AudioBuffer& juce::AudioBuffer< Type >::operator= ( const AudioBuffer< Type > &  other)
inline

Copies another buffer onto this one.

This buffer's size will be changed to that of the other buffer.

Definition at line 154 of file juce_AudioSampleBuffer.h.

References juce::AudioBuffer< Type >::clear(), juce::FloatVectorOperations::copy(), juce::AudioBuffer< Type >::getNumChannels(), juce::AudioBuffer< Type >::getNumSamples(), and juce::AudioBuffer< Type >::setSize().

◆ getNumChannels()

◆ getNumSamples()

◆ getReadPointer() [1/2]

template<typename Type >
const Type* juce::AudioBuffer< Type >::getReadPointer ( int  channelNumber) const
inlinenoexcept

Returns a pointer to an array of read-only samples in one of the buffer's channels.

For speed, this doesn't check whether the channel number is out of range, so be careful when using it! If you need to write to the data, do NOT call this method and const_cast the result! Instead, you must call getWritePointer so that the buffer knows you're planning on modifying the data.

Definition at line 251 of file juce_AudioSampleBuffer.h.

Referenced by juce::ResamplingAudioSource::getNextAudioBlock(), juce::AudioBuffer< Type >::makeCopyOf(), and juce::AudioFormatWriter::writeFromAudioSampleBuffer().

◆ getReadPointer() [2/2]

template<typename Type >
const Type* juce::AudioBuffer< Type >::getReadPointer ( int  channelNumber,
int  sampleIndex 
) const
inlinenoexcept

Returns a pointer to an array of read-only samples in one of the buffer's channels.

For speed, this doesn't check whether the channel number or index are out of range, so be careful when using it! If you need to write to the data, do NOT call this method and const_cast the result! Instead, you must call getWritePointer so that the buffer knows you're planning on modifying the data.

Definition at line 264 of file juce_AudioSampleBuffer.h.

◆ getWritePointer() [1/2]

template<typename Type >
Type* juce::AudioBuffer< Type >::getWritePointer ( int  channelNumber)
inlinenoexcept

◆ getWritePointer() [2/2]

template<typename Type >
Type* juce::AudioBuffer< Type >::getWritePointer ( int  channelNumber,
int  sampleIndex 
)
inlinenoexcept

Returns a writeable pointer to one of the buffer's channels.

For speed, this doesn't check whether the channel number or index are out of range, so be careful when using it! Note that if you're not planning on writing to the data, you should use getReadPointer instead.

Definition at line 290 of file juce_AudioSampleBuffer.h.

◆ getArrayOfReadPointers()

template<typename Type >
const Type** juce::AudioBuffer< Type >::getArrayOfReadPointers ( ) const
inlinenoexcept

Returns an array of pointers to the channels in the buffer.

Don't modify any of the pointers that are returned, and bear in mind that these will become invalid if the buffer is resized.

Definition at line 303 of file juce_AudioSampleBuffer.h.

Referenced by juce::AudioFormatWriter::writeFromAudioSampleBuffer().

◆ getArrayOfWritePointers()

template<typename Type >
Type** juce::AudioBuffer< Type >::getArrayOfWritePointers ( )
inlinenoexcept

Returns an array of pointers to the channels in the buffer.

Don't modify any of the pointers that are returned, and bear in mind that these will become invalid if the buffer is resized.

Definition at line 310 of file juce_AudioSampleBuffer.h.

Referenced by juce::MemoryAudioSource::MemoryAudioSource(), juce::AudioFormatReader::readMaxLevels(), and juce::SynthesiserVoice::renderNextBlock().

◆ setSize()

template<typename Type >
void juce::AudioBuffer< Type >::setSize ( int  newNumChannels,
int  newNumSamples,
bool  keepExistingContent = false,
bool  clearExtraSpace = false,
bool  avoidReallocating = false 
)
inline

Changes the buffer's size or number of channels.

This can expand or contract the buffer's length, and add or remove channels.

If keepExistingContent is true, it will try to preserve as much of the old data as it can in the new buffer.

If clearExtraSpace is true, then any extra channels or space that is allocated will be also be cleared. If false, then this space is left uninitialised.

If avoidReallocating is true, then changing the buffer's size won't reduce the amount of memory that is currently allocated (but it will still increase it if the new size is bigger than the amount it currently has). If this is false, then a new allocation will be done so that the buffer uses takes up the minimum amount of memory that it needs.

Note that if keepExistingContent and avoidReallocating are both true, then it will only avoid reallocating if neither the channel count or length in samples increase.

If the required memory can't be allocated, this will throw a std::bad_alloc exception.

Definition at line 335 of file juce_AudioSampleBuffer.h.

References juce::HeapBlock< ElementType, throwOnFailure >::allocate(), juce::HeapBlock< ElementType, throwOnFailure >::clear(), juce::FloatVectorOperations::copy(), juce::HeapBlock< ElementType, throwOnFailure >::get(), and juce::HeapBlock< ElementType, throwOnFailure >::swapWith().

Referenced by juce::AudioSourcePlayer::audioDeviceIOCallback(), juce::AudioSourcePlayer::audioDeviceStopped(), juce::ChannelRemappingAudioSource::getNextAudioBlock(), juce::MixerAudioSource::getNextAudioBlock(), juce::ResamplingAudioSource::getNextAudioBlock(), juce::dsp::ConvolutionEngine::initializeConvolutionEngine(), juce::dsp::Convolution::Pimpl::initProcessing(), juce::AudioBuffer< Type >::makeCopyOf(), juce::AudioBuffer< Type >::operator=(), juce::BufferingAudioSource::prepareToPlay(), juce::MixerAudioSource::prepareToPlay(), juce::ResamplingAudioSource::prepareToPlay(), juce::dsp::Convolution::Pimpl::processFifo(), juce::BufferingAudioSource::releaseResources(), juce::MixerAudioSource::releaseResources(), and juce::ResamplingAudioSource::releaseResources().

◆ setDataToReferTo() [1/2]

template<typename Type >
void juce::AudioBuffer< Type >::setDataToReferTo ( Type **  dataToReferTo,
int  newNumChannels,
int  newStartSample,
int  newNumSamples 
)
inline

Makes this buffer point to a pre-allocated set of channel data arrays.

There's also a constructor that lets you specify arrays like this, but this lets you change the channels dynamically.

Note that if the buffer is resized or its number of channels is changed, it will re-allocate memory internally and copy the existing data to this new area, so it will then stop directly addressing this memory.

Parameters
dataToReferToa pre-allocated array containing pointers to the data for each channel that should be used by this buffer. The buffer will only refer to this memory, it won't try to delete it when the buffer is deleted or resized.
newNumChannelsthe number of channels to use - this must correspond to the number of elements in the array passed in
newStartSamplethe offset within the arrays at which the data begins
newNumSamplesthe number of samples to use - this must correspond to the size of the arrays passed in

Definition at line 434 of file juce_AudioSampleBuffer.h.

References juce::HeapBlock< ElementType, throwOnFailure >::free().

Referenced by juce::MemoryAudioSource::MemoryAudioSource(), and juce::AudioBuffer< Type >::setDataToReferTo().

◆ setDataToReferTo() [2/2]

template<typename Type >
void juce::AudioBuffer< Type >::setDataToReferTo ( Type **  dataToReferTo,
int  newNumChannels,
int  newNumSamples 
)
inline

Makes this buffer point to a pre-allocated set of channel data arrays.

There's also a constructor that lets you specify arrays like this, but this lets you change the channels dynamically.

Note that if the buffer is resized or its number of channels is changed, it will re-allocate memory internally and copy the existing data to this new area, so it will then stop directly addressing this memory.

Parameters
dataToReferToa pre-allocated array containing pointers to the data for each channel that should be used by this buffer. The buffer will only refer to this memory, it won't try to delete it when the buffer is deleted or resized.
newNumChannelsthe number of channels to use - this must correspond to the number of elements in the array passed in
newNumSamplesthe number of samples to use - this must correspond to the size of the arrays passed in

Definition at line 473 of file juce_AudioSampleBuffer.h.

References juce::AudioBuffer< Type >::setDataToReferTo().

◆ makeCopyOf()

template<typename Type >
template<typename OtherType >
void juce::AudioBuffer< Type >::makeCopyOf ( const AudioBuffer< OtherType > &  other,
bool  avoidReallocating = false 
)
inline

Resizes this buffer to match the given one, and copies all of its content across.

The source buffer can contain a different floating point type, so this can be used to convert between 32 and 64 bit float buffer types.

Definition at line 485 of file juce_AudioSampleBuffer.h.

References juce::AudioBuffer< Type >::clear(), juce::AudioBuffer< Type >::getNumChannels(), juce::AudioBuffer< Type >::getNumSamples(), juce::AudioBuffer< Type >::getReadPointer(), juce::AudioBuffer< Type >::hasBeenCleared(), and juce::AudioBuffer< Type >::setSize().

Referenced by juce::MemoryAudioSource::MemoryAudioSource(), and juce::SynthesiserVoice::renderNextBlock().

◆ clear() [1/2]

template<typename Type >
void juce::AudioBuffer< Type >::clear ( int  startSample,
int  numSamples 
)
inlinenoexcept

Clears a specified region of all the channels.

For speed, this doesn't check whether the channel and sample number are in-range, so be careful!

Definition at line 526 of file juce_AudioSampleBuffer.h.

References juce::FloatVectorOperations::clear().

◆ clear() [2/2]

template<typename Type >
void juce::AudioBuffer< Type >::clear ( int  channel,
int  startSample,
int  numSamples 
)
inlinenoexcept

Clears a specified region of just one channel.

For speed, this doesn't check whether the channel and sample number are in-range, so be careful!

Definition at line 545 of file juce_AudioSampleBuffer.h.

References juce::FloatVectorOperations::clear().

◆ hasBeenCleared()

template<typename Type >
bool juce::AudioBuffer< Type >::hasBeenCleared ( ) const
inlinenoexcept

Returns true if the buffer has been entirely cleared.

Note that this does not actually measure the contents of the buffer - it simply returns a flag that is set when the buffer is cleared, and which is reset whenever functions like getWritePointer() are invoked. That means the method does not take any time, but it may return false negatives when in fact the buffer is still empty.

Definition at line 560 of file juce_AudioSampleBuffer.h.

Referenced by juce::AudioBuffer< Type >::makeCopyOf().

◆ getSample()

template<typename Type >
Type juce::AudioBuffer< Type >::getSample ( int  channel,
int  sampleIndex 
) const
inlinenoexcept

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.

Definition at line 568 of file juce_AudioSampleBuffer.h.

Referenced by juce::dsp::LogRampedValueTests::runTest().

◆ setSample()

template<typename Type >
void juce::AudioBuffer< Type >::setSample ( int  destChannel,
int  destSample,
Type  newValue 
)
inlinenoexcept

Sets 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.

Definition at line 580 of file juce_AudioSampleBuffer.h.

Referenced by juce::ToneGeneratorAudioSource::getNextAudioBlock(), juce::dsp::Convolution::Pimpl::processFifo(), and juce::dsp::LogRampedValueTests::runTest().

◆ addSample()

template<typename Type >
void juce::AudioBuffer< Type >::addSample ( int  destChannel,
int  destSample,
Type  valueToAdd 
)
inlinenoexcept

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.

Definition at line 593 of file juce_AudioSampleBuffer.h.

◆ applyGain() [1/2]

template<typename Type >
void juce::AudioBuffer< Type >::applyGain ( int  channel,
int  startSample,
int  numSamples,
Type  gain 
)
inlinenoexcept

Applies a gain multiple to a region of one channel.

For speed, this doesn't check whether the channel and sample number are in-range, so be careful!

Definition at line 606 of file juce_AudioSampleBuffer.h.

References juce::FloatVectorOperations::clear(), and juce::FloatVectorOperations::multiply().

Referenced by juce::AudioBuffer< Type >::applyGain(), and juce::AudioBuffer< Type >::applyGainRamp().

◆ applyGain() [2/2]

template<typename Type >
void juce::AudioBuffer< Type >::applyGain ( int  startSample,
int  numSamples,
Type  gain 
)
inlinenoexcept

Applies a gain multiple to a region of all the channels.

For speed, this doesn't check whether the sample numbers are in-range, so be careful!

Definition at line 627 of file juce_AudioSampleBuffer.h.

References juce::AudioBuffer< Type >::applyGain().

◆ applyGainRamp() [1/2]

template<typename Type >
void juce::AudioBuffer< Type >::applyGainRamp ( int  channel,
int  startSample,
int  numSamples,
Type  startGain,
Type  endGain 
)
inlinenoexcept

Applies a range of gains to a region of a channel.

The gain that is applied to each sample will vary from startGain on the first sample to endGain on the last Sample, so it can be used to do basic fades.

For speed, this doesn't check whether the sample numbers are in-range, so be careful!

Definition at line 648 of file juce_AudioSampleBuffer.h.

References juce::AudioBuffer< Type >::applyGain().

Referenced by juce::AudioBuffer< Type >::applyGainRamp(), juce::AudioSourcePlayer::audioDeviceIOCallback(), and juce::AudioTransportSource::getNextAudioBlock().

◆ applyGainRamp() [2/2]

template<typename Type >
void juce::AudioBuffer< Type >::applyGainRamp ( int  startSample,
int  numSamples,
Type  startGain,
Type  endGain 
)
inlinenoexcept

Applies a range of gains to a region of all channels.

The gain that is applied to each sample will vary from startGain on the first sample to endGain on the last Sample, so it can be used to do basic fades.

For speed, this doesn't check whether the sample numbers are in-range, so be careful!

Definition at line 683 of file juce_AudioSampleBuffer.h.

References juce::AudioBuffer< Type >::applyGainRamp().

◆ addFrom() [1/2]

template<typename Type >
void juce::AudioBuffer< Type >::addFrom ( int  destChannel,
int  destStartSample,
const AudioBuffer< Type > &  source,
int  sourceChannel,
int  sourceStartSample,
int  numSamples,
Type  gainToApplyToSource = Type (1) 
)
inlinenoexcept

Adds samples from another buffer to this one.

Parameters
destChannelthe channel within this buffer to add the samples to
destStartSamplethe start sample within this buffer's channel
sourcethe source buffer to add from
sourceChannelthe channel within the source buffer to read from
sourceStartSamplethe offset within the source buffer's channel to start reading samples from
numSamplesthe number of samples to process
gainToApplyToSourcean optional gain to apply to the source samples before they are added to this buffer's samples
See also
copyFrom

Definition at line 703 of file juce_AudioSampleBuffer.h.

References juce::FloatVectorOperations::add(), juce::FloatVectorOperations::addWithMultiply(), juce::FloatVectorOperations::copy(), and juce::FloatVectorOperations::copyWithMultiply().

Referenced by juce::AudioBuffer< Type >::addFromWithRamp(), juce::ChannelRemappingAudioSource::getNextAudioBlock(), and juce::MixerAudioSource::getNextAudioBlock().

◆ addFrom() [2/2]

template<typename Type >
void juce::AudioBuffer< Type >::addFrom ( int  destChannel,
int  destStartSample,
const Type *  source,
int  numSamples,
Type  gainToApplyToSource = Type (1) 
)
inlinenoexcept

Adds samples from an array of floats to one of the channels.

Parameters
destChannelthe channel within this buffer to add the samples to
destStartSamplethe start sample within this buffer's channel
sourcethe source data to use
numSamplesthe number of samples to process
gainToApplyToSourcean optional gain to apply to the source samples before they are added to this buffer's samples
See also
copyFrom

Definition at line 752 of file juce_AudioSampleBuffer.h.

References juce::FloatVectorOperations::add(), juce::FloatVectorOperations::addWithMultiply(), juce::FloatVectorOperations::copy(), and juce::FloatVectorOperations::copyWithMultiply().

◆ addFromWithRamp()

template<typename Type >
void juce::AudioBuffer< Type >::addFromWithRamp ( int  destChannel,
int  destStartSample,
const Type *  source,
int  numSamples,
Type  startGain,
Type  endGain 
)
inlinenoexcept

Adds samples from an array of floats, applying a gain ramp to them.

Parameters
destChannelthe channel within this buffer to add the samples to
destStartSamplethe start sample within this buffer's channel
sourcethe source data to use
numSamplesthe number of samples to process
startGainthe gain to apply to the first sample (this is multiplied with the source samples before they are added to this buffer)
endGainthe gain to apply to the final sample. The gain is linearly interpolated between the first and last samples.

Definition at line 797 of file juce_AudioSampleBuffer.h.

References juce::AudioBuffer< Type >::addFrom().

◆ copyFrom() [1/3]

template<typename Type >
void juce::AudioBuffer< Type >::copyFrom ( int  destChannel,
int  destStartSample,
const AudioBuffer< Type > &  source,
int  sourceChannel,
int  sourceStartSample,
int  numSamples 
)
inlinenoexcept

Copies samples from another buffer to this one.

Parameters
destChannelthe channel within this buffer to copy the samples to
destStartSamplethe start sample within this buffer's channel
sourcethe source buffer to read from
sourceChannelthe channel within the source buffer to read from
sourceStartSamplethe offset within the source buffer's channel to start reading samples from
numSamplesthe number of samples to process
See also
addFrom

Definition at line 840 of file juce_AudioSampleBuffer.h.

References juce::FloatVectorOperations::clear(), and juce::FloatVectorOperations::copy().

Referenced by juce::dsp::Convolution::Pimpl::copyBufferToTemporaryLocation(), juce::AudioBuffer< Type >::copyFromWithRamp(), juce::BufferingAudioSource::getNextAudioBlock(), juce::ChannelRemappingAudioSource::getNextAudioBlock(), and juce::dsp::Convolution::Pimpl::processSamples().

◆ copyFrom() [2/3]

template<typename Type >
void juce::AudioBuffer< Type >::copyFrom ( int  destChannel,
int  destStartSample,
const Type *  source,
int  numSamples 
)
inlinenoexcept

Copies samples from an array of floats into one of the channels.

Parameters
destChannelthe channel within this buffer to copy the samples to
destStartSamplethe start sample within this buffer's channel
sourcethe source buffer to read from
numSamplesthe number of samples to process
See also
addFrom

Definition at line 879 of file juce_AudioSampleBuffer.h.

References juce::FloatVectorOperations::copy().

◆ copyFrom() [3/3]

template<typename Type >
void juce::AudioBuffer< Type >::copyFrom ( int  destChannel,
int  destStartSample,
const Type *  source,
int  numSamples,
Type  gain 
)
inlinenoexcept

Copies samples from an array of floats into one of the channels, applying a gain to it.

Parameters
destChannelthe channel within this buffer to copy the samples to
destStartSamplethe start sample within this buffer's channel
sourcethe source buffer to read from
numSamplesthe number of samples to process
gainthe gain to apply
See also
addFrom

Definition at line 905 of file juce_AudioSampleBuffer.h.

References juce::FloatVectorOperations::clear(), juce::FloatVectorOperations::copy(), and juce::FloatVectorOperations::copyWithMultiply().

◆ copyFromWithRamp()

template<typename Type >
void juce::AudioBuffer< Type >::copyFromWithRamp ( int  destChannel,
int  destStartSample,
const Type *  source,
int  numSamples,
Type  startGain,
Type  endGain 
)
inlinenoexcept

Copies samples from an array of floats into one of the channels, applying a gain ramp.

Parameters
destChannelthe channel within this buffer to copy the samples to
destStartSamplethe start sample within this buffer's channel
sourcethe source buffer to read from
numSamplesthe number of samples to process
startGainthe gain to apply to the first sample (this is multiplied with the source samples before they are copied to this buffer)
endGainthe gain to apply to the final sample. The gain is linearly interpolated between the first and last samples.
See also
addFrom

Definition at line 953 of file juce_AudioSampleBuffer.h.

References juce::AudioBuffer< Type >::copyFrom().

◆ findMinMax()

template<typename Type >
Range<Type> juce::AudioBuffer< Type >::findMinMax ( int  channel,
int  startSample,
int  numSamples 
) const
inlinenoexcept

Returns a Range indicating the lowest and highest sample values in a given section.

Parameters
channelthe channel to read from
startSamplethe start sample within the channel
numSamplesthe number of samples to check

Definition at line 991 of file juce_AudioSampleBuffer.h.

References juce::FloatVectorOperations::findMinAndMax().

Referenced by juce::AudioBuffer< Type >::getMagnitude().


The documentation for this class was generated from the following file: