MCPcopy Create free account
hub / github.com/audacity/audacity / GetFloatSampleView

Method GetFloatSampleView

libraries/lib-wave-track/Sequence.cpp:1121–1139  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1119}
1120
1121AudioSegmentSampleView Sequence::GetFloatSampleView(
1122 sampleCount start, size_t length, bool mayThrow) const
1123{
1124 assert(start < mNumSamples);
1125 length = limitSampleBufferSize(length, mNumSamples - start);
1126 std::vector<BlockSampleView> blockViews;
1127 // `sequenceOffset` cannot be larger than `GetMaxBlockSize()`, a `size_t` =>
1128 // no narrowing possible.
1129 const auto sequenceOffset = (start - GetBlockStart(start)).as_size_t();
1130 auto cursor = start;
1131 while (cursor < start + length)
1132 {
1133 const auto b = FindBlock(cursor);
1134 const SeqBlock& block = mBlock[b];
1135 blockViews.push_back(block.sb->GetFloatSampleView(mayThrow));
1136 cursor = block.start + block.sb->GetSampleCount();
1137 }
1138 return { std::move(blockViews), sequenceOffset, length };
1139}
1140
1141bool Sequence::Get(samplePtr buffer, sampleFormat format,
1142 sampleCount start, size_t len, bool mayThrow) const

Callers 1

GetSampleViewMethod · 0.45

Calls 5

limitSampleBufferSizeFunction · 0.85
moveFunction · 0.85
as_size_tMethod · 0.80
push_backMethod · 0.45
GetSampleCountMethod · 0.45

Tested by

no test coverage detected