| 1119 | } |
| 1120 | |
| 1121 | AudioSegmentSampleView 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 | |
| 1141 | bool Sequence::Get(samplePtr buffer, sampleFormat format, |
| 1142 | sampleCount start, size_t len, bool mayThrow) const |
no test coverage detected