Skip to content

Commit 88f42a2

Browse files
committed
DynamicMultiBuffer: begin to position the read pos
1 parent fce9def commit 88f42a2

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/AudioTools/Sandbox/DynamicMultiBuffer.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,23 @@ class DynamicMultiBuffer : public BaseBuffer<T> {
396396
return component_size_;
397397
}
398398

399+
/**
400+
* @brief (Re)sets the read pos to the start
401+
*/
402+
bool begin() {
403+
read_pos = 0;
404+
return true;
405+
}
406+
407+
/**
408+
* @brief (Re)sets the read pos to the indicated position
409+
*/
410+
bool begin(int pos) {
411+
if (pos > write_pos) return false;
412+
read_pos = pos;
413+
return true;
414+
}
415+
399416
protected:
400417
Vector<BufferType<T>*> buffer_components; // Collection of buffer components
401418
size_t component_size_ = 0; // Size of each component in elements

0 commit comments

Comments
 (0)