19 #include "../../debug.h"
23 using namespace Audio;
104 std::this_thread::yield();
134 numBytes = chunk * frameSize;
void advanceTime()
Moves time pointer one buffer forward.
virtual void initialize(Mode mode)
Initializes the playback setting its main parameters.
virtual void pushBuffer(sample8 *buffer, int bufferIndex)
Pushes some data to the output.
void prepareBuffers(const AbstractPlayback::Mode &mode)
Allocates all the atomic buffers.
sample8 ** buffers
buffers containing the data to play
virtual void freeBuffer(sample8 *buffer) const
Frees an atomic playing buffer.
OutputMode
Specifies how the output audio signal is handled by the audio backend.
@ PUSH
The output is sent to pushOutput(..) called by the rendering thread.
int playIndex
points to the buffer currently being played; updated only in the callback
virtual sample8 * createBuffer(const AbstractPlayback::Mode &mode) const
Creates an atomic playing buffer.
virtual ~BasicRealtimePlayback()
dtime playingBufferOffset
when pulling output, offset in frames with respect to the currently playing buffer
bool process(TaskThread &thread)
Executes the task on CPU within a given thread.
void pullBuffer(sample8 *buffer, dtime numFrames)
Called in pulling output mode to send data to output.
int sendIndex
points to the first buffer ready for playing
BasicRealtimePlayback(OutputMode)
int fillIndex
points to the buffer currently being filled
void initialize(Mode mode)
Initializes the playback setting its main parameters.
const OutputMode outputMode
msize bufferSize
size of each buffer in bytes
dtime skipFrames
when pulling output, number of frames to skip to give some time to the rendering process
virtual void start()
Starts playback.
virtual void render(TaskThread &thread, sample8 *buffer, const dtime bufferLength)=0
Renders audio data to the target output buffer given by the user.
virtual void synchronize()=0
Blocks until all the other threads running the same task reach the same point.
virtual bool isTaskAborted() const =0
Returns true if the task is asked to stop from outside.
#define BEATMUP_DEBUG_I(...)
uint32_t msize
memory size
const int AUDIO_SAMPLE_SIZE[]
CustomPoint< numeric > min(const CustomPoint< numeric > &a, const CustomPoint< numeric > &b)
AudioSampleFormat sampleFormat
format of each sample
unsigned char numBuffers
number of atomic buffers
unsigned char numChannels
number of channels
dtime bufferLength
length of each atomic buffer in samples