Public Types | |
enum | WaveForm { kWaveFormSquare = 0, kWaveFormSine, kWaveFormSaw, kWaveFormTriangle, kWaveFormSilence } |
Public Member Functions | |
bool | init () |
void | quit () |
void | play (WaveForm wave, int freq, int32 length) |
void | playQueue (WaveForm wave, float freq, uint32 lengthus) |
void | stop (int32 delay=0) |
bool | isPlaying () const |
void Audio::PCSpeaker::play | ( | WaveForm | wave, |
int | freq, | ||
int32 | length | ||
) |
Play a note for length ms.
If length is negative, play until told to stop.
void Audio::PCSpeaker::playQueue | ( | WaveForm | wave, |
float | freq, | ||
uint32 | lengthus | ||
) |
Queue the specified playback instruction. It will be executed when all previously queued instructions have finished. Use this method for playback of effects which require timing precision of less than a millisecond.
Calling this method will terminate any waveform started with the play method. Calling the play method will terminate the active queued instruction and clear the instruction queue.
Use isPlaying to check if all queued instructions have finished playing. This will return true even if the current instruction is "playing" silence.
wave | The waveform to use. For PC speaker, use square wave or silence. |
freq | The frequency (in Hertz) to play. |
lengthus | The length in microseconds for which to play the waveform. |
void Audio::PCSpeaker::stop | ( | int32 | delay = 0 | ) |
Stop the currently playing note after delay ms.