Starboard Module Reference: speech_synthesis.h

A basic text-to-speech API intended to be used for audio accessibilty.
Implementations of this API should audibly play back text to assist users in non-visual navigation of the application.
Note that these functions do not have to be thread-safe. They must only be called from a single application thread.

Functions

SbSpeechSynthesisCancel

Description

Cancels all speaking and queued speech synthesis audio. Must return immediately.

Declaration and definitions

SB_EXPORT void SbSpeechSynthesisCancel();

#include "starboard/speech_synthesis.h"

#if !SB_HAS(SPEECH_SYNTHESIS) && SB_VERSION(3)
#error If speech synthesis not enabled on this platform, please exclude it\
       from the build
#endif

void SbSpeechSynthesisCancel() {}

SbSpeechSynthesisSetLanguage

Description

Sets a language for speech synthesis.
Must be called before any other function in this module, or subsequent calls are allowed to fail silently.
lang should be a BCP 47 language string, eg "en-US". Return true if language is supported, false if not.

Declaration and definitions

SB_EXPORT bool SbSpeechSynthesisSetLanguage(const char* lang);

#include "starboard/speech_synthesis.h"

#if !SB_HAS(SPEECH_SYNTHESIS) && SB_VERSION(3)
#error If speech synthesis not enabled on this platform, please exclude it\
       from the build
#endif

bool SbSpeechSynthesisSetLanguage(const char* lang) {
  return false;
}

Parameters

Parameters
const char*
lang

SbSpeechSynthesisSpeak

Description

Enqueues text, a UTF-8 string, to be spoken the currently selected language. Returns immediately.
If audio from previous SbSpeechSynthesisSpeak() invocations is still processing, the current speaking should continue and this new text should be queued to play when the previous utterances are complete.

Declaration and definitions

SB_EXPORT void SbSpeechSynthesisSpeak(const char* text);

#include "starboard/speech_synthesis.h"

#if !SB_HAS(SPEECH_SYNTHESIS) && SB_VERSION(3)
#error If speech synthesis not enabled on this platform, please exclude it\
       from the build
#endif

void SbSpeechSynthesisSpeak(const char* text) {}

Parameters

Parameters
const char*
text