#include <audioctl.h>
Public Slots | |
void | play (Position cursor=0) |
void | pause () |
void | stop () |
void | registerTrack (PortAudioCallback *callback) |
void | registerMasterFX (PortAudioCallback *callback) |
Signals | |
void | positionChanged (Position new_position) |
Protected Member Functions | |
void | openPAStream (int samplerate=DEFAULT_SAMPLERATE, int bufsize=DEFAULT_BUFSIZE) |
void | closePAStream () |
AudioCtl uses PortAudio (www.portaudio.com) to access the hardware in a cross-platform way (thanks for it !!!).
The audio IO is callback based: a callback will be called by the PortAudio engine whenever it needs more audio data for output/input. The callback function operates under an interrupt or background thread. This leaves the foreground application free to do other things while the audio just runs in the background.
Each track, effect, etc. has to register a REALTIME-SAFE process method in that class and this method will be called each audio block.
AudioCtl manages also all the play/pause/stop/seek and other control methods and synchronizes all different tracks and effects.
void AudioCtl::play | ( | Position | cursor = 0 |
) | [slot] |
plays all selected tracks and effects, starting at current position
cursor | the current cursor position |
void AudioCtl::pause | ( | ) | [slot] |
pauses or unpauses the stream, like on a CD-player
void AudioCtl::stop | ( | ) | [slot] |
stops the audio stream
void AudioCtl::registerTrack | ( | PortAudioCallback * | callback | ) | [slot] |
register the callback of a track it will be called each audio block and can be filled with the data of the track
callback | a pointer to the callback function |
void AudioCtl::registerMasterFX | ( | PortAudioCallback * | callback | ) | [slot] |
register the callback of an Master Effect it will be called each audio block AFTER all the track callbacks, so you can process global effects here !
callback | a pointer to the callback function |
void AudioCtl::positionChanged | ( | Position | new_position | ) | [signal] |
if the position changes (e.g. seeking in the track) emit a signal, so that you can load buffers for e.g. file IO ...
new_position | the new position in samples |
void AudioCtl::openPAStream | ( | int | samplerate = DEFAULT_SAMPLERATE , |
|
int | bufsize = DEFAULT_BUFSIZE | |||
) | [protected] |
initializes the audio stream
samplerate | samplerate of the application | |
bufsize | audio buffer size, if zero then use default minimum |
void AudioCtl::closePAStream | ( | ) | [protected] |
closes the audio stream