Class voice

Acts as an interface for a voice implementation.

A voice is responsible for playing a specified challenge or response sound based on the provided key. It may can be paused, resumed and stopped.

Info:

  • Copyright: 2022 Patrick Lang
  • Author: Patrick Lang

Methods

voice:new (name) Creates a new voice.
voice:getName () Gets the name of the voice.
voice:setVolume (volume) Sets the volume of the voice.
voice:activateChallengeSounds () Gets called when the voice is selected for providing the audio output for the challenges.
voice:activateResponseSounds () Gets called when the voice is selected for providing the audio output for the responses and failures.
voice:deactivateChallengeSounds () Gets called when the voice is no longer an active audio provider for the challenges.
voice:deactivateResponseSounds () Gets called when the voice is no longer an active audio provider for the responses and failures.
voice:playChallengeSound (key) Starts playing the challenge sound with the specified key.
voice:playResponseSound (key) Starts playing the response sound with the specified key.
voice:playFailSound () Starts playing a fail sound.
voice:pause () Pauses the active sound.
voice:resume () Resumes the active sound.
voice:stop () Stops playing the active sound.
voice:isFinished () Checks whether the active sound has finished playing.


Methods

voice:new (name)
Creates a new voice.

Parameters:

  • name string The name of the voice.

Returns:

    voice The created voice
voice:getName ()
Gets the name of the voice.

Returns:

    string The name of the voice.
voice:setVolume (volume)
Sets the volume of the voice. A value of 1 means 100% (full volume), a value of 0.5 means 50% (half the volume). This function should be implemented in a derived voice class.

Parameters:

  • volume numer The volume to use.
voice:activateChallengeSounds ()
Gets called when the voice is selected for providing the audio output for the challenges. Can be used to initialize the voice. This function does nothing in this implementation.
voice:activateResponseSounds ()
Gets called when the voice is selected for providing the audio output for the responses and failures. Can be used to initialize the voice. This function does nothing in this implementation.
voice:deactivateChallengeSounds ()
Gets called when the voice is no longer an active audio provider for the challenges. Can be used to release any resources. This function does nothing in this implementation.
voice:deactivateResponseSounds ()
Gets called when the voice is no longer an active audio provider for the responses and failures. Can be used to release any resources. This function does nothing in this implementation.
voice:playChallengeSound (key)
Starts playing the challenge sound with the specified key. This function should be implemented in a derived voice class.

Parameters:

  • key string The key of the challenge sound
voice:playResponseSound (key)
Starts playing the response sound with the specified key. This function should be implemented in a derived voice class.

Parameters:

  • key string The key of the response sound
voice:playFailSound ()
Starts playing a fail sound. This function should be implemented in a derived voice class.
voice:pause ()
Pauses the active sound. This function should be implemented in a derived voice class.
voice:resume ()
Resumes the active sound. This function should be implemented in a derived voice class.
voice:stop ()
Stops playing the active sound. This function should be implemented in a derived voice class.
voice:isFinished ()
Checks whether the active sound has finished playing. This function should be implemented in a derived voice class.

Returns:

    bool Always true.
generated by LDoc 1.4.6 Last updated 2022-05-28 12:58:52