Beatmup
|
Realtime playback base. More...
#include <realtime_playback.h>
Public Member Functions | |
virtual | ~BasicRealtimePlayback () |
void | initialize (Mode mode) |
Initializes the playback setting its main parameters. More... | |
bool | process (TaskThread &thread) |
Executes the task on CPU within a given thread. More... | |
virtual void | start () |
Starts playback. More... | |
virtual void | stop ()=0 |
Stops playback. More... | |
void | bufferQueueCallbackFunc () |
void | pullBuffer (sample8 *buffer, dtime numFrames) |
Called in pulling output mode to send data to output. More... | |
Public Member Functions inherited from Beatmup::Audio::AbstractPlayback | |
ThreadIndex | getMaxThreads () const |
Gives the upper limint on the number of threads the task may be performed by. More... | |
void | beforeProcessing (ThreadIndex threadCount, ProcessingTarget target, GraphicPipeline *gpu) |
Instruction called before the task is executed. More... | |
void | setSource (Source *source) |
Specifies a Source to sample. More... | |
Source * | getSource () const |
Returns the signal source to sample. More... | |
Public Member Functions inherited from Beatmup::AbstractTask | |
virtual void | afterProcessing (ThreadIndex threadCount, GraphicPipeline *gpu, bool aborted) |
Instruction called after the task is executed. More... | |
virtual bool | processOnGPU (GraphicPipeline &gpu, TaskThread &thread) |
Executes the task on GPU. More... | |
virtual TaskDeviceRequirement | getUsedDevices () const |
Communicates devices (CPU and/or GPU) the task is run on. More... | |
Public Member Functions inherited from Beatmup::Object | |
virtual | ~Object () |
Protected Types | |
enum class | OutputMode { PULL , PUSH } |
Specifies how the output audio signal is handled by the audio backend. More... | |
Protected Member Functions | |
BasicRealtimePlayback (OutputMode) | |
virtual sample8 * | createBuffer (const AbstractPlayback::Mode &mode) const |
Creates an atomic playing buffer. More... | |
virtual void | freeBuffer (sample8 *buffer) const |
Frees an atomic playing buffer. More... | |
virtual void | pushBuffer (sample8 *buffer, int bufferIndex) |
Pushes some data to the output. More... | |
Protected Member Functions inherited from Beatmup::Audio::AbstractPlayback | |
AbstractPlayback () | |
void | advanceTime () |
Moves time pointer one buffer forward. More... | |
Protected Attributes | |
msize | bufferSize |
size of each buffer in bytes More... | |
Protected Attributes inherited from Beatmup::Audio::AbstractPlayback | |
Mode | mode |
Source * | source |
dtime | clock |
Private Member Functions | |
void | prepareBuffers (const AbstractPlayback::Mode &mode) |
Allocates all the atomic buffers. More... | |
void | freeBuffers () |
Private Attributes | |
const OutputMode | outputMode |
sample8 ** | buffers |
buffers containing the data to play More... | |
int | numBuffers |
int | fillIndex |
points to the buffer currently being filled More... | |
int | sendIndex |
points to the first buffer ready for playing More... | |
int | playIndex |
points to the buffer currently being played; updated only in the callback More... | |
dtime | playingBufferOffset |
when pulling output, offset in frames with respect to the currently playing buffer More... | |
dtime | skipFrames |
when pulling output, number of frames to skip to give some time to the rendering process More... | |
Additional Inherited Members | |
Public Types inherited from Beatmup::AbstractTask | |
enum class | TaskDeviceRequirement { CPU_ONLY , GPU_OR_CPU , GPU_ONLY } |
Specifies which device (CPU and/or GPU) is used to run the task. More... | |
Static Public Member Functions inherited from Beatmup::AbstractTask | |
static ThreadIndex | validThreadCount (int number) |
Valid thread count from a given integer value. More... | |
Realtime playback base.
Manages a circular buffer queue storing a signal sampled from a Source.
Definition at line 33 of file realtime_playback.h.
|
strongprotected |
Specifies how the output audio signal is handled by the audio backend.
Enumerator | |
---|---|
PULL | The output is requested by pullOutput(..) called by the audio backend. |
PUSH | The output is sent to pushOutput(..) called by the rendering thread. |
Definition at line 38 of file realtime_playback.h.
|
protected |
Definition at line 26 of file realtime_playback.cpp.
|
virtual |
Definition at line 30 of file realtime_playback.cpp.
|
private |
Allocates all the atomic buffers.
Definition at line 45 of file realtime_playback.cpp.
|
private |
Definition at line 35 of file realtime_playback.cpp.
|
protectedvirtual |
Creates an atomic playing buffer.
mode | the playback mode |
Definition at line 54 of file realtime_playback.cpp.
|
protectedvirtual |
Frees an atomic playing buffer.
Definition at line 61 of file realtime_playback.cpp.
|
inlineprotectedvirtual |
Pushes some data to the output.
Reimplemented in Beatmup::Audio::Android::SLESPlayback.
Definition at line 96 of file realtime_playback.h.
|
virtual |
Initializes the playback setting its main parameters.
Reimplemented from Beatmup::Audio::AbstractPlayback.
Reimplemented in Beatmup::Audio::Android::SLESPlayback, and Beatmup::Audio::Android::AAudioPlayback.
Definition at line 66 of file realtime_playback.cpp.
|
virtual |
Executes the task on CPU within a given thread.
Generally called by multiple threads.
thread | associated task execution context |
true
if the execution is finished correctly, false
otherwise Implements Beatmup::AbstractTask.
Definition at line 85 of file realtime_playback.cpp.
|
virtual |
Starts playback.
Reimplemented in Beatmup::Audio::Android::SLESPlayback, and Beatmup::Audio::Android::AAudioPlayback.
Definition at line 77 of file realtime_playback.cpp.
|
pure virtual |
Stops playback.
Implemented in Beatmup::Audio::Android::SLESPlayback, and Beatmup::Audio::Android::AAudioPlayback.
|
inline |
Definition at line 119 of file realtime_playback.h.
Called in pulling output mode to send data to output.
buffer | Pointer to a buffer to put data to |
numFrames | Number of "frames" (samples per single channel) to put to the buffer |
Definition at line 113 of file realtime_playback.cpp.
|
private |
Definition at line 43 of file realtime_playback.h.
|
private |
buffers containing the data to play
Definition at line 45 of file realtime_playback.h.
|
private |
Definition at line 46 of file realtime_playback.h.
|
private |
points to the buffer currently being filled
Definition at line 48 of file realtime_playback.h.
|
private |
points to the first buffer ready for playing
Definition at line 49 of file realtime_playback.h.
|
private |
points to the buffer currently being played; updated only in the callback
Definition at line 50 of file realtime_playback.h.
|
private |
when pulling output, offset in frames with respect to the currently playing buffer
Definition at line 52 of file realtime_playback.h.
|
private |
when pulling output, number of frames to skip to give some time to the rendering process
Definition at line 53 of file realtime_playback.h.
|
protected |
size of each buffer in bytes
Definition at line 79 of file realtime_playback.h.