![]() |
Audacity 3.2.0
|
Accumulates (non-interleaved) data during effect processing. More...
#include <AudioGraphBuffers.h>
Public Member Functions | |
| Buffers (size_t blockSize=512) | |
| Buffers (unsigned nChannels, size_t blockSize, size_t nBlocks, size_t padding=0) | |
| unsigned | Channels () const |
| size_t | BufferSize () const |
| size_t | BlockSize () const |
| size_t | Position () const |
| size_t | Remaining () const |
| bool | IsRewound () const |
| void | Reinit (unsigned nChannels, size_t blockSize, size_t nBlocks, size_t padding=0) |
| float *const * | Positions () const |
| Get array of positions in the buffers. More... | |
| void | Discard (size_t drop, size_t keep) |
| Discard some data at the (unchanging) positions. More... | |
| void | Advance (size_t count) |
| Move the positions. More... | |
| void | Rewind () |
| Reset positions to starts of buffers. More... | |
| size_t | Rotate () |
| Shift all data at and after the old position to position 0. More... | |
| constSamplePtr | GetReadPosition (unsigned iChannel) const |
| Get accumulated data for one channel. More... | |
| float & | GetWritePosition (unsigned iChannel) |
| Get writable position for one channel. More... | |
| void | ClearBuffer (unsigned iChannel, size_t n) |
Private Attributes | |
| std::vector< std::vector< float > > | mBuffers |
| std::vector< float * > | mPositions |
| size_t | mBufferSize { 0 } |
| size_t | mBlockSize { 0 } |
Accumulates (non-interleaved) data during effect processing.
BlockSize() > 0 BufferSize() > 0 BufferSize() % BlockSize() == 0mBuffers.size() == mPositions.size() mBuffers[i].size() are equal to BufferSize() (mPositions[i] - mBuffers[i].data()) are equal and in range [0, BufferSize()] Definition at line 30 of file AudioGraphBuffers.h.
|
explicit |
blockSize > 0 BlockSize() == blockSize BufferSize() == blockSize IsRewound() Definition at line 16 of file AudioGraphBuffers.cpp.
References IsRewound().
| AudioGraph::Buffers::Buffers | ( | unsigned | nChannels, |
| size_t | blockSize, | ||
| size_t | nBlocks, | ||
| size_t | padding = 0 |
||
| ) |
| padding | extra allocation can work around a soxr library bug |
blockSize > 0 nBlocks > 0 Channels() == nChannels BlockSize() == blockSize BufferSize() == blockSize * nBlocks Definition at line 23 of file AudioGraphBuffers.cpp.
| void AudioGraph::Buffers::Advance | ( | size_t | count | ) |
Move the positions.
Remaining() reduced by count Definition at line 89 of file AudioGraphBuffers.cpp.
References details::end().
Referenced by DownmixStage::Acquire(), and EffectStage::FetchProcessAndAdvance().
|
inline |
Definition at line 52 of file AudioGraphBuffers.h.
Referenced by EffectStage::AcceptsBlockSize(), DownmixStage::AcceptsBuffers(), WaveTrackSink::Acquire(), EffectStage::Acquire(), MixerSource::Acquire(), WideSampleSource::Acquire(), WaveTrackSink::DoConsume(), EffectStage::EffectStage(), EffectStage::FetchProcessAndAdvance(), PerTrackEffect::ProcessPass(), PerTrackEffect::ProcessTrack(), and AudioGraph::Task::Task().
|
inline |
Definition at line 51 of file AudioGraphBuffers.h.
Referenced by DownmixStage::AcceptsBlockSize(), and MixerSource::AcceptsBuffers().
|
inline |
Definition at line 50 of file AudioGraphBuffers.h.
Referenced by DownmixStage::AcceptsBuffers(), WideSampleSource::AcceptsBuffers(), WaveTrackSink::AcceptsBuffers(), MixerSource::Acquire(), DownmixStage::Acquire(), Mixer::Clear(), WaveTrackSink::DoConsume(), EffectStage::FetchProcessAndAdvance(), EffectStage::Process(), and PerTrackEffect::ProcessPass().
| void AudioGraph::Buffers::ClearBuffer | ( | unsigned | iChannel, |
| size_t | n | ||
| ) |
Zero-fill n places in one of the buffers, starting from its position
Definition at line 168 of file AudioGraphBuffers.cpp.
References details::end(), anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel, and min().
Referenced by DownmixStage::Acquire(), Mixer::Clear(), and PerTrackEffect::ProcessPass().
| void AudioGraph::Buffers::Discard | ( | size_t | drop, |
| size_t | keep | ||
| ) |
Discard some data at the (unchanging) positions.
| drop | how many values to discard |
| keep | how many following values are defined |
Remaining() is unchanged Definition at line 46 of file AudioGraphBuffers.cpp.
References details::end(), min(), and size.
Referenced by EffectStage::Acquire().
| constSamplePtr AudioGraph::Buffers::GetReadPosition | ( | unsigned | iChannel | ) | const |
Get accumulated data for one channel.
Last channel is replicated for all greater indices
Channels() > 0 BufferSize() > 0 result != nullptr Definition at line 155 of file AudioGraphBuffers.cpp.
References anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel, and min().
Referenced by DownmixStage::Acquire(), WaveTrackSink::DoConsume(), and Mixer::Process().
| float & AudioGraph::Buffers::GetWritePosition | ( | unsigned | iChannel | ) |
Get writable position for one channel.
iChannel < Channels() BufferSize() > 0 Definition at line 162 of file AudioGraphBuffers.cpp.
References anonymous_namespace{StretchingSequenceIntegrationTest.cpp}::iChannel.
Referenced by MixerSource::Acquire(), WideSampleSource::Acquire(), EffectStage::FetchProcessAndAdvance(), and anonymous_namespace{DownmixStage.cpp}::MixBuffers().
|
inline |
Definition at line 59 of file AudioGraphBuffers.h.
References BufferSize.
Referenced by Buffers().
|
inline |
Definition at line 53 of file AudioGraphBuffers.h.
Referenced by WaveTrackSink::DoConsume().
|
inline |
Get array of positions in the buffers.
Definition at line 72 of file AudioGraphBuffers.h.
Referenced by EffectStage::Process().
| void AudioGraph::Buffers::Reinit | ( | unsigned | nChannels, |
| size_t | blockSize, | ||
| size_t | nBlocks, | ||
| size_t | padding = 0 |
||
| ) |
| padding | extra allocation can work around a soxr library bug |
blockSize > 0 nBlocks > 0 Channels() == nChannels BlockSize() == blockSize BufferSize() == blockSize * nBlocks Definition at line 30 of file AudioGraphBuffers.cpp.
Referenced by PerTrackEffect::ProcessPass().
|
inline |
Definition at line 58 of file AudioGraphBuffers.h.
References BufferSize.
Referenced by WaveTrackSink::Acquire(), EffectStage::Acquire(), MixerSource::Acquire(), WideSampleSource::Acquire(), WaveTrackSink::DoConsume(), and EffectStage::FetchProcessAndAdvance().
| void AudioGraph::Buffers::Rewind | ( | ) |
Reset positions to starts of buffers.
IsRewound() Definition at line 136 of file AudioGraphBuffers.cpp.
Referenced by WaveTrackSink::DoConsume(), EffectStage::EffectStage(), EffectStage::FetchProcessAndAdvance(), and PerTrackEffect::ProcessPass().
| size_t AudioGraph::Buffers::Rotate | ( | ) |
Shift all data at and after the old position to position 0.
IsRewound() Definition at line 144 of file AudioGraphBuffers.cpp.
References BufferSize, and staffpad::vo::free().
Referenced by DownmixStage::Acquire(), and EffectStage::FetchProcessAndAdvance().
|
private |
Definition at line 122 of file AudioGraphBuffers.h.
|
private |
Definition at line 119 of file AudioGraphBuffers.h.
|
private |
Definition at line 121 of file AudioGraphBuffers.h.
|
private |
Definition at line 120 of file AudioGraphBuffers.h.