AudioCtl Class Reference

class for audio IO and synchronisation of tracks and effects More...

#include <audioctl.h>

List of all members.

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 ()


Detailed Description

class for audio IO and synchronisation of tracks and effects

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.


Member Function Documentation

void AudioCtl::play ( Position  cursor = 0  )  [slot]

plays all selected tracks and effects, starting at current position

Parameters:
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

Note:
the callback function MUST be realtime-safe, so no memory allocation, fileIO, or other blocking stuff !
Parameters:
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 !

Note:
the callback function MUST be realtime-safe, so no memory allocation, fileIO, or other blocking stuff !
Parameters:
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 ...

Parameters:
new_position the new position in samples

void AudioCtl::openPAStream ( int  samplerate = DEFAULT_SAMPLERATE,
int  bufsize = DEFAULT_BUFSIZE 
) [protected]

initializes the audio stream

Parameters:
samplerate samplerate of the application
bufsize audio buffer size, if zero then use default minimum

void AudioCtl::closePAStream (  )  [protected]

closes the audio stream


The documentation for this class was generated from the following files:
Generated on Fri Jul 6 12:38:40 2007 for audioeditor.kdevelop by  doxygen 1.5.2