Beatmup
|
A Source producing a sinusoidal signal, mainly for test purposes. More...
#include <source.h>
Public Member Functions | |
HarmonicSource () | |
void | setFrequency (float hz) |
float | getFrequency () const |
void | setPhase (float radians) |
float | getPhase () const |
void | setAmplitude (float amp) |
float | getAmplitude () const |
void | prepare (const dtime sampleRate, const AudioSampleFormat sampleFormat, const unsigned char numChannels, const dtime maxBufferLen) |
Prepares a source to render audio data. More... | |
void | render (TaskThread &thread, sample8 *buffer, const dtime bufferLength) |
Renders audio data to the target output buffer given by the user. More... | |
void | setClock (dtime time) |
Called by the source user when an abrupt time change occurs (e.g., due to seeking) More... | |
Public Member Functions inherited from Beatmup::Audio::Source | |
virtual | ~Source () |
virtual ThreadIndex | getMaxThreads () |
Returns the maximum number of working threads for rendering from this source. More... | |
Private Attributes | |
AudioSampleFormat | sampleFormat |
dtime | sampleRate |
dtime | time |
float | amplitude |
float | frequency |
float | phase |
unsigned char | numChannels |
A Source producing a sinusoidal signal, mainly for test purposes.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
virtual |
Prepares a source to render audio data.
Called by the user before any rendering to communicate the configuration of the upcoming rendering process.
sampleRate | The output sample rate in Hz |
sampleFormat | The output sample format |
numChannels | Number of channels in the output |
maxBufferLen | Maximum expected length of target audio buffers on rendering phase, in samples per one channel |
Implements Beatmup::Audio::Source.
Definition at line 57 of file source.cpp.
|
virtual |
Renders audio data to the target output buffer given by the user.
Called after at least one call to prepare(). The sampling parameters must match the ones communicated on the preparation phase. The requested buffer length does not exceed the one set before. The time is given by the clock set before, and with every call it advances by {bufferLength} samples.
thread | the task thread issuing this rendering call |
buffer | a pointer to the beginning of a channelwise-multiplexed output buffer |
bufferLength | the requested buffer length, in samples per single channel |
Implements Beatmup::Audio::Source.
Definition at line 69 of file source.cpp.
|
virtual |
Called by the source user when an abrupt time change occurs (e.g., due to seeking)
Reimplemented from Beatmup::Audio::Source.
Definition at line 95 of file source.cpp.
|
private |
|
private |