libosmscout 0.1
Loading...
Searching...
No Matches
osmscout::TTSEngine Class Referenceabstract

Abstract text-to-speech engine. More...

#include <TTSEngine.h>

+ Inheritance diagram for osmscout::TTSEngine:

Public Slots

virtual void initVoice (const Voice &voice)=0
 Initialize the engine for the given voice.
 
virtual void playMessage (QString message)=0
 Prepare the message (when it is not cached yet) and play it right away.
 
virtual void prepareMessage (QString message)=0
 Synthesize the message to an audio file (cached in a temporary directory) without playing it.
 

Signals

void playAudioFilesRequest (const QList< QUrl > &audioFiles)
 

Public Member Functions

virtual Voice getVoice ()=0
 
TTSEngineoperator= (const TTSEngine &)=delete
 
TTSEngineoperator= (TTSEngine &&)=delete
 
 TTSEngine ()
 
 TTSEngine (const TTSEngine &)=delete
 
 TTSEngine (TTSEngine &&)=delete
 
 ~TTSEngine () override
 

Protected Member Functions

virtual void cleanCache ()
 Called on the engine thread when the background thread starts.
 

Protected Attributes

QThread * thread
 engine background thread (owns itself, deleted on finish)
 

Detailed Description

Abstract text-to-speech engine.

It synthesizes spoken navigation instructions and plays them through the provided VoiceCorePlayer.

Speech synthesis may be a slow, synchronous operation (see PiperTTSEngine), so the engine runs in its own background thread. All operations (initVoice, prepareMessage, playMessage) are executed asynchronously on that thread, they should be invoked through a queued connection (e.g. QMetaObject::invokeMethod with Qt::QueuedConnection).

The background thread is created and started by the base constructor. When it starts, cleanCache() is invoked on the engine thread (default implementation is empty, a derived class may override it to prune its cache).

Constructor & Destructor Documentation

◆ TTSEngine() [1/3]

osmscout::TTSEngine::TTSEngine ( )

References cleanCache(), and thread.

◆ TTSEngine() [2/3]

osmscout::TTSEngine::TTSEngine ( const TTSEngine )
delete

◆ TTSEngine() [3/3]

osmscout::TTSEngine::TTSEngine ( TTSEngine &&  )
delete

◆ ~TTSEngine()

osmscout::TTSEngine::~TTSEngine ( )
override

References thread.

Member Function Documentation

◆ cleanCache()

void osmscout::TTSEngine::cleanCache ( )
protectedvirtual

Called on the engine thread when the background thread starts.

The default implementation does nothing; a derived class may override it to clean up its on-disk cache. Runs on the engine thread.

Reimplemented in osmscout::PiperTTSEngine.

Referenced by TTSEngine().

◆ getVoice()

virtual Voice osmscout::TTSEngine::getVoice ( )
pure virtual

Implemented in osmscout::PiperTTSEngine.

◆ initVoice

virtual void osmscout::TTSEngine::initVoice ( const Voice voice)
pure virtualslot

Initialize the engine for the given voice.

Runs asynchronously on the engine thread.

Implemented in osmscout::PiperTTSEngine.

◆ operator=() [1/2]

TTSEngine & osmscout::TTSEngine::operator= ( const TTSEngine )
delete

◆ operator=() [2/2]

TTSEngine & osmscout::TTSEngine::operator= ( TTSEngine &&  )
delete

◆ playAudioFilesRequest

void osmscout::TTSEngine::playAudioFilesRequest ( const QList< QUrl > &  audioFiles)
signal

◆ playMessage

virtual void osmscout::TTSEngine::playMessage ( QString  message)
pure virtualslot

Prepare the message (when it is not cached yet) and play it right away.

Runs asynchronously on the engine thread.

Implemented in osmscout::PiperTTSEngine.

◆ prepareMessage

virtual void osmscout::TTSEngine::prepareMessage ( QString  message)
pure virtualslot

Synthesize the message to an audio file (cached in a temporary directory) without playing it.

Runs asynchronously on the engine thread.

Implemented in osmscout::PiperTTSEngine.

Member Data Documentation

◆ thread

QThread* osmscout::TTSEngine::thread
protected

engine background thread (owns itself, deleted on finish)

Referenced by TTSEngine(), and ~TTSEngine().


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