SampleController

Provides an interface to control a sound.

All methods on this interface execute asynchronously

Members

Functions

duration
float duration()

Duration of the sample, in seconds. Please note it may be nan if unknown or inf if infinite looping. You should check for both conditions.

finished
bool finished()

If the sample has finished playing. Happens when it runs out or if it is stopped.

pause
void pause()

Pauses playback, keeping its position. Use resume to pick up where it left off.

paused
bool paused()

If the sample has been paused.

playbackSpeed
void playbackSpeed(float multiplierOfOriginal)

Controls the playback speed of this particular sample, as a multiplier of its original speed. Setting it to 0.0 is liable to crash.

playbackSpeed
float playbackSpeed()

Controls the playback speed of this particular sample, as a multiplier of its original speed. Setting it to 0.0 is liable to crash.

position
float position()

Reports the current stream position, in seconds, if available (NaN if not).

resume
void resume()

Resumes playback after a call to pause.

seek
void seek(float where)

Seeks to a point in the sample, if possible. If impossible, this function does nothing.

stop
void stop()

Stops playback. Once stopped, it cannot be restarted except by creating a new sample from the AudioOutputThread object.

volume
float volume()
float volume(float multiplierOfOriginal)

Controls the volume of this particular sample, as a multiplier of its original perceptual volume.

Meta

History

Added December 23, 2020

Suggestion Box / Bug Report