Oboe
A library for creating real-time audio apps on Android
Loading...
Searching...
No Matches
Public Member Functions | List of all members
oboe::FifoControllerBase Class Referenceabstract

#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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ FifoControllerBase()

oboe::FifoControllerBase::FifoControllerBase ( uint32_t  totalFrames)

Construct a FifoControllerBase.

Parameters
totalFramescapacity of the circular buffer in frames

Member Function Documentation

◆ advanceReadIndex()

void oboe::FifoControllerBase::advanceReadIndex ( uint32_t  numFrames)

Advance read index from a number of frames. Equivalent of incrementReadCounter(numFrames).

Parameters
numFramesnumber of frames to advance the read index

◆ advanceWriteIndex()

void oboe::FifoControllerBase::advanceWriteIndex ( uint32_t  numFrames)

Advance write index from a number of frames. Equivalent of incrementWriteCounter(numFrames).

Parameters
numFramesnumber of frames to advance the write index

◆ getEmptyFramesAvailable()

uint32_t oboe::FifoControllerBase::getEmptyFramesAvailable ( ) const

Get the number of frame that are not written yet.

Returns
maximum number of frames that can be written without exceeding the threshold

◆ getFrameCapacity()

uint32_t oboe::FifoControllerBase::getFrameCapacity ( ) const
inline

Get the frame capacity of the fifo.

Returns
frame capacity

◆ getFullFramesAvailable()

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.

Returns
number of valid frames available to read.

◆ getReadIndex()

uint32_t oboe::FifoControllerBase::getReadIndex ( ) const

The index in a circular buffer of the next frame to read.

Returns
read index position

◆ getWriteIndex()

uint32_t oboe::FifoControllerBase::getWriteIndex ( ) const

The index in a circular buffer of the next frame to write.

Returns
index of the next frame to write

The documentation for this class was generated from the following file: