18 std::vector<BlockSampleView> blockViews,
size_t start,
size_t length)
19 : mBlockViews {
std::move(blockViews) }
28 [](
size_t acc,
const auto& block) { return acc + block->size(); }));
39 mIsSilent ? std::fill(buffer, buffer + bufferSize, 0.f) :
40 DoCopy(buffer, bufferSize);
47 DoAdd(buffer, bufferSize);
57 std::fill(buffer, buffer + bufferSize, 0.f);
58 DoAdd(buffer, bufferSize);
68 const auto toWriteFromBlock =
std::min(block->size() - offset, toWrite);
69 const auto src = block->data() + offset;
70 const auto dst = buffer + written;
71 std::transform(src, src + toWriteFromBlock, dst, dst, std::plus {});
72 toWrite -= toWriteFromBlock;
73 written += toWriteFromBlock;
An audio segment is either a whole clip or the silence between clips. Views allow shared references t...
size_t limitSampleBufferSize(size_t bufferSize, sampleCount limit)
const std::vector< BlockSampleView > mBlockViews
size_t GetSampleCount() const
The number of samples in this view.
void Copy(float *buffer, size_t bufferSize) const
Copies up to GetSampleCount() or bufferSize samples, whichever is less, into buffer....
AudioSegmentSampleView(std::vector< BlockSampleView > blockViews, size_t start, size_t length)
Constructs an AudioSegmentSampleView from BlockSampleViews.
void DoCopy(float *buffer, size_t bufferSize) const
void AddTo(float *buffer, size_t bufferSize) const
Adds up to GetSampleCount() or bufferSize samples, whichever is less, into buffer....
void DoAdd(float *buffer, size_t bufferSize) const