ScummVM API documentation
Audio::PCSpeaker Class Reference

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
 

Member Function Documentation

◆ play()

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.

◆ playQueue()

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.

Parameters
waveThe waveform to use. For PC speaker, use square wave or silence.
freqThe frequency (in Hertz) to play.
lengthusThe length in microseconds for which to play the waveform.

◆ stop()

void Audio::PCSpeaker::stop ( int32  delay = 0)

Stop the currently playing note after delay ms.


The documentation for this class was generated from the following file: