Oboe
A library for creating real-time audio apps on Android
|
#include <FifoControllerBase.h>
Public Member Functions | |
FifoControllerBase (uint32_t totalFrames) | |
uint32_t | getFullFramesAvailable () const |
uint32_t | getReadIndex () const |
void | advanceReadIndex (uint32_t numFrames) |
uint32_t | getEmptyFramesAvailable () const |
uint32_t | getWriteIndex () const |
void | advanceWriteIndex (uint32_t numFrames) |
uint32_t | getFrameCapacity () const |
virtual uint64_t | getReadCounter () const =0 |
virtual void | setReadCounter (uint64_t n)=0 |
virtual void | incrementReadCounter (uint64_t n)=0 |
virtual uint64_t | getWriteCounter () const =0 |
virtual void | setWriteCounter (uint64_t n)=0 |
virtual void | incrementWriteCounter (uint64_t n)=0 |
Manage the read/write indices of a circular buffer.
The caller is responsible for reading and writing the actual data. Note that the span of available frames may not be contiguous. They may wrap around from the end to the beginning of the buffer. In that case the data must be read or written in at least two blocks of frames.
oboe::FifoControllerBase::FifoControllerBase | ( | uint32_t | totalFrames | ) |
Construct a FifoControllerBase
.
totalFrames | capacity of the circular buffer in frames |
Advance read index from a number of frames. Equivalent of incrementReadCounter(numFrames).
numFrames | number of frames to advance the read index |
Advance write index from a number of frames. Equivalent of incrementWriteCounter(numFrames).
numFrames | number of frames to advance the write index |
uint32_t oboe::FifoControllerBase::getEmptyFramesAvailable | ( | ) | const |
Get the number of frame that are not written yet.
|
inline |
Get the frame capacity of the fifo.
uint32_t oboe::FifoControllerBase::getFullFramesAvailable | ( | ) | const |
The frames available to read will be calculated from the read and write counters. The result will be clipped to the capacity of the buffer. If the buffer has underflowed then this will return zero.
uint32_t oboe::FifoControllerBase::getReadIndex | ( | ) | const |
The index in a circular buffer of the next frame to read.
uint32_t oboe::FifoControllerBase::getWriteIndex | ( | ) | const |
The index in a circular buffer of the next frame to write.