#include <text-to-speech.h>
|
enum | Action {
INTERRUPT,
INTERRUPT_NO_REPEAT,
QUEUE,
QUEUE_NO_REPEAT,
DROP
} |
|
|
void | clearState () |
|
virtual void | updateVoices () |
|
The TextToSpeechManager allows speech synthesis.
◆ TextToSpeechManager()
Common::TextToSpeechManager::TextToSpeechManager |
( |
| ) |
|
The constructor sets the language to the translation manager language if USE_TRANSLATION is defined, or english when it isn't defined. It sets the rate, pitch and volume to their middle values.
◆ say() [1/4]
virtual bool Common::TextToSpeechManager::say |
( |
const U32String & |
str, |
|
|
Action |
action |
|
) |
| |
|
inlinevirtual |
Says the given string
- Parameters
-
str | The string to say |
action | What to do if another string is just being said. Possible actions are: INTERRUPT - interrupts the current speech INTERRUPT_NO_REPEAT - interrupts the speech (deletes the whole queue), if the str is the same as the string currently being said, it lets the current string finish. QUEUE - queues the speech QUEUE_NO_REPEAT - queues the speech only if the str is different than the last string in the queue (or the string, that is currently being said if the queue is empty) DROP - does nothing if there is anything being said at the moment |
◆ say() [2/4]
bool Common::TextToSpeechManager::say |
( |
const String & |
str, |
|
|
Action |
action, |
|
|
CodePage |
charset = kUtf8 |
|
) |
| |
|
inline |
Says the given string, but strings can have a custom charset here. It will convert to UTF-32 before passing along to the intended method.
◆ say() [3/4]
bool Common::TextToSpeechManager::say |
( |
const U32String & |
str | ) |
|
|
inline |
Interrupts what's being said and says the given string
- Parameters
-
◆ say() [4/4]
bool Common::TextToSpeechManager::say |
( |
const String & |
str, |
|
|
CodePage |
charset = kUtf8 |
|
) |
| |
|
inline |
Interrupts what's being said and says the given string
- Parameters
-
str | The string to say |
charset | The encoding of the string. It will be converted to UTF-32. It will use UTF-8 by default. |
◆ stop()
virtual bool Common::TextToSpeechManager::stop |
( |
| ) |
|
|
inlinevirtual |
◆ pause()
virtual bool Common::TextToSpeechManager::pause |
( |
| ) |
|
|
inlinevirtual |
◆ resume()
virtual bool Common::TextToSpeechManager::resume |
( |
| ) |
|
|
inlinevirtual |
Resumes the speech
- Note
- On linux, the speech resumes from the beginning of the last speech being said, when pause() was called. On other platforms the speech resumes from exactly where it was paused();
◆ isSpeaking()
virtual bool Common::TextToSpeechManager::isSpeaking |
( |
| ) |
|
|
inlinevirtual |
Returns true, if the TTS engine is speaking
◆ isPaused()
virtual bool Common::TextToSpeechManager::isPaused |
( |
| ) |
|
|
inlinevirtual |
Returns true, if the TTS engine is paused
◆ isReady()
virtual bool Common::TextToSpeechManager::isReady |
( |
| ) |
|
|
inlinevirtual |
Returns true, if the TTS engine is ready to speak (isn't speaking and isn't paused)
◆ setVoice()
virtual void Common::TextToSpeechManager::setVoice |
( |
unsigned |
index | ) |
|
|
inlinevirtual |
Sets a voice to be used by the TTS.
- Parameters
-
index | The index of the voice inside the _ttsState->_availableVoices array |
◆ getVoice()
TTSVoice Common::TextToSpeechManager::getVoice |
( |
| ) |
|
Returns the voice, that is used right now
◆ setRate()
virtual void Common::TextToSpeechManager::setRate |
( |
int |
rate | ) |
|
|
inlinevirtual |
Sets the speech rate
- Parameters
-
rate | Integer between -100 (slowest) and 100 (fastest), 0 is the default |
◆ getRate()
int Common::TextToSpeechManager::getRate |
( |
| ) |
|
|
inline |
Returns the current speech rate
◆ setPitch()
virtual void Common::TextToSpeechManager::setPitch |
( |
int |
pitch | ) |
|
|
inlinevirtual |
Sets the pitch
- Parameters
-
pitch | Integer between -100 (lowest) and 100 (highest), 0 is the default |
◆ getPitch()
int Common::TextToSpeechManager::getPitch |
( |
| ) |
|
|
inline |
Returns current speech pitch
◆ setVolume()
virtual void Common::TextToSpeechManager::setVolume |
( |
unsigned |
volume | ) |
|
|
inlinevirtual |
Sets the speech volume
- Parameters
-
volume | Volume as a percentage (0 means muted, 100 means as loud as possible) |
◆ getVolume()
int Common::TextToSpeechManager::getVolume |
( |
| ) |
|
|
inline |
Returns the current voice volume
◆ setLanguage()
virtual void Common::TextToSpeechManager::setLanguage |
( |
String |
language | ) |
|
|
virtual |
Sets the speech language
- Parameters
-
language | The language identifier as defined by ISO 639-1 |
- Note
- After using this method, it is probably a good idea to use setVoice, because voices are usually language specific and so it is set to some platform specific default after switching languages.
◆ getLanguage()
String Common::TextToSpeechManager::getLanguage |
( |
| ) |
|
|
inline |
Returns the current speech language
◆ getVoicesArray()
Returns array of available voices for the current language
◆ getVoiceIndicesByGender()
Array<int> Common::TextToSpeechManager::getVoiceIndicesByGender |
( |
TTSVoice::Gender |
gender | ) |
|
Returns array of indices of voices from the _availableVoices array, which have the needed gender.
- Parameters
-
gender | Gender, which indices should be returned |
- Returns
- Array of indices into _availableVoices
◆ getDefaultVoice()
virtual int Common::TextToSpeechManager::getDefaultVoice |
( |
| ) |
|
|
inlinevirtual |
returns the index for the default voice.
◆ pushState()
void Common::TextToSpeechManager::pushState |
( |
| ) |
|
Pushes the current state of the TTS
◆ popState()
bool Common::TextToSpeechManager::popState |
( |
| ) |
|
◆ freeVoiceData()
virtual void Common::TextToSpeechManager::freeVoiceData |
( |
void * |
data | ) |
|
|
inlinevirtual |
◆ enable()
void Common::TextToSpeechManager::enable |
( |
bool |
on | ) |
|
The documentation for this class was generated from the following file: