#include <AudioSampleBuffer.h>
|
| | AudioSampleBuffer () noexcept |
| | AudioSampleBuffer (const uint32_t numChannelsToAllocate, const uint32_t numSamplesToAllocate, const bool clearData=false) noexcept |
| | AudioSampleBuffer (float *const *dataToReferTo, const uint32_t numChannelsToUse, const uint32_t numSamples) noexcept |
| | AudioSampleBuffer (float *const *dataToReferTo, const uint32_t numChannelsToUse, const uint32_t startSample, const uint32_t numSamples) noexcept |
| | AudioSampleBuffer (const AudioSampleBuffer &other) noexcept |
| AudioSampleBuffer & | operator= (const AudioSampleBuffer &other) noexcept |
| | ~AudioSampleBuffer () noexcept |
| uint32_t | getNumChannels () const noexcept |
| uint32_t | getNumSamples () const noexcept |
| const float * | getReadPointer (const uint32_t channelNumber) const noexcept |
| const float * | getReadPointer (const uint32_t channelNumber, const uint32_t sampleIndex) const noexcept |
| float * | getWritePointer (const uint32_t channelNumber) noexcept |
| float * | getWritePointer (const uint32_t channelNumber, const uint32_t sampleIndex) noexcept |
| const float ** | getArrayOfReadPointers () const noexcept |
| float ** | getArrayOfWritePointers () noexcept |
| bool | setSize (const uint32_t newNumChannels, const uint32_t newNumSamples) noexcept |
| bool | setSizeRT (const uint32_t newNumSamples) noexcept |
| bool | setDataToReferTo (float **dataToReferTo, const uint32_t newNumChannels, const uint32_t newNumSamples) noexcept |
| void | clear () noexcept |
| void | clear (const uint32_t startSample, const uint32_t numSamples) noexcept |
| void | clear (const uint32_t channel, const uint32_t startSample, const uint32_t numSamples) noexcept |
| bool | hasBeenCleared () const noexcept |
| void | addFrom (const uint32_t destChannel, const uint32_t destStartSample, const AudioSampleBuffer &source, const uint32_t sourceChannel, const uint32_t sourceStartSample, const uint32_t numSamples, const float gainToApplyToSource=1.0f) noexcept |
| void | addFrom (const uint32_t destChannel, const uint32_t destStartSample, const float *source, const uint32_t numSamples, float gainToApplyToSource=1.0f) noexcept |
| void | copyFrom (const uint32_t destChannel, const uint32_t destStartSample, const AudioSampleBuffer &source, const uint32_t sourceChannel, const uint32_t sourceStartSample, const uint32_t numSamples) noexcept |
| void | copyFrom (const uint32_t destChannel, const uint32_t destStartSample, const float *source, const uint32_t numSamples) noexcept |
| void | copyFrom (const uint32_t destChannel, const uint32_t destStartSample, const float *source, const uint32_t numSamples, float gain) noexcept |
| void | copyFromInterleavedSource (const uint32_t destChannel, const float *source, const uint32_t totalNumSamples) noexcept |
A multi-channel buffer of floating point audio samples.
- See also
- AudioSampleBuffer
◆ AudioSampleBuffer() [1/5]
Creates an empty buffer with 0 channels and 0 length.
◆ AudioSampleBuffer() [2/5]
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.
◆ AudioSampleBuffer() [3/5]
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
-
| dataToReferTo | a 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. |
| numChannelsToUse | the number of channels to use - this must correspond to the number of elements in the array passed in |
| numSamples | the number of samples to use - this must correspond to the size of the arrays passed in |
◆ AudioSampleBuffer() [4/5]
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
-
| dataToReferTo | a 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. |
| numChannelsToUse | the number of channels to use - this must correspond to the number of elements in the array passed in |
| startSample | the offset within the arrays at which the data begins |
| numSamples | the number of samples to use - this must correspond to the size of the arrays passed in |
◆ AudioSampleBuffer() [5/5]
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 boths buffers will just point to the same shared block of data.
◆ ~AudioSampleBuffer()
Destructor. This will free any memory allocated by the buffer.
◆ addFrom() [1/2]
Adds samples from another buffer to this one.
- Parameters
-
| destChannel | the channel within this buffer to add the samples to |
| destStartSample | the start sample within this buffer's channel |
| source | the source buffer to add from |
| sourceChannel | the channel within the source buffer to read from |
| sourceStartSample | the offset within the source buffer's channel to start reading samples from |
| numSamples | the number of samples to process |
| gainToApplyToSource | an optional gain to apply to the source samples before they are added to this buffer's samples |
- See also
- copyFrom
◆ addFrom() [2/2]
Adds samples from an array of floats to one of the channels.
- Parameters
-
| destChannel | the channel within this buffer to add the samples to |
| destStartSample | the start sample within this buffer's channel |
| source | the source data to use |
| numSamples | the number of samples to process |
| gainToApplyToSource | an optional gain to apply to the source samples before they are added to this buffer's samples |
- See also
- copyFrom
◆ allocateChannels()
◆ allocateData()
◆ clear() [1/3]
Clears all the samples in all channels.
◆ clear() [2/3]
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!
◆ clear() [3/3]
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!
◆ copyFrom() [1/3]
Copies samples from another buffer to this one.
- Parameters
-
| destChannel | the channel within this buffer to copy the samples to |
| destStartSample | the start sample within this buffer's channel |
| source | the source buffer to read from |
| sourceChannel | the channel within the source buffer to read from |
| sourceStartSample | the offset within the source buffer's channel to start reading samples from |
| numSamples | the number of samples to process |
- See also
- addFrom
◆ copyFrom() [2/3]
Copies samples from an array of floats into one of the channels.
- Parameters
-
| destChannel | the channel within this buffer to copy the samples to |
| destStartSample | the start sample within this buffer's channel |
| source | the source buffer to read from |
| numSamples | the number of samples to process |
- See also
- addFrom
◆ copyFrom() [3/3]
Copies samples from an array of floats into one of the channels, applying a gain to it.
- Parameters
-
| destChannel | the channel within this buffer to copy the samples to |
| destStartSample | the start sample within this buffer's channel |
| source | the source buffer to read from |
| numSamples | the number of samples to process |
| gain | the gain to apply |
- See also
- addFrom
◆ copyFromInterleavedSource()
Copies samples from an array of floats into one of the channels.
- Parameters
-
| destChannel | the channel within this buffer to copy the samples to |
| destStartSample | the start sample within this buffer's channel |
| source | the source buffer to read from |
| numSamples | the number of samples to process |
- See also
- addFrom
◆ getArrayOfReadPointers()
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.
◆ getArrayOfWritePointers()
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.
◆ getNumChannels()
Returns the number of channels of audio data that this buffer contains.
- See also
- getSampleData
◆ getNumSamples()
Returns the number of samples allocated in each of the buffer's channels.
- See also
- getSampleData
◆ getReadPointer() [1/2]
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.
◆ getReadPointer() [2/2]
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.
◆ getWritePointer() [1/2]
Returns a writeable pointer to 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! Note that if you're not planning on writing to the data, you should always use getReadPointer instead.
◆ getWritePointer() [2/2]
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.
◆ hasBeenCleared()
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.
◆ operator=()
◆ setDataToReferTo()
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
-
| dataToReferTo | a 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. |
| newNumChannels | the number of channels to use - this must correspond to the number of elements in the array passed in |
| newNumSamples | the number of samples to use - this must correspond to the size of the arrays passed in |
◆ setSize()
Changes the buffer's size or number of channels.
This can expand the buffer's length, and add or remove channels.
◆ setSizeRT()
Changes the buffer's size in a real-time safe manner.
Returns true if the required memory is available.
◆ allocatedBytes
◆ allocatedData
◆ channels
◆ isClear
◆ numChannels
◆ preallocatedChannelSpace
◆ size
The documentation for this class was generated from the following file:
- /home/runner/work/lmms-fork/lmms-fork/plugins/CarlaBase/carla/source/modules/water/buffers/AudioSampleBuffer.h