libosmscout 0.1
Loading...
Searching...
No Matches
osmscout::PiperTTSEngine Class Reference

Piper (libpiper) based text-to-speech engine. More...

#include <PiperTTSEngine.h>

+ Inheritance diagram for osmscout::PiperTTSEngine:

Public Member Functions

Voice getVoice () override
 
void initVoice (const Voice &voice) override
 Initialize the engine for the given voice.
 
 PiperTTSEngine (const QString &espeakDataDir)
 
void playMessage (QString message) override
 Prepare the message (when it is not cached yet) and play it right away.
 
void prepareMessage (QString message) override
 Synthesize the message to an audio file (cached in a temporary directory) without playing it.
 
 ~PiperTTSEngine () override
 
- Public Member Functions inherited from osmscout::TTSEngine
TTSEngineoperator= (const TTSEngine &)=delete
 
TTSEngineoperator= (TTSEngine &&)=delete
 
 TTSEngine ()
 
 TTSEngine (const TTSEngine &)=delete
 
 TTSEngine (TTSEngine &&)=delete
 
 ~TTSEngine () override
 

Protected Member Functions

void cleanCache () override
 Remove the oldest synthesized WAV files when the cache directory exceeds the size limit.
 

Additional Inherited Members

- Public Slots inherited from osmscout::TTSEngine
- Signals inherited from osmscout::TTSEngine
void playAudioFilesRequest (const QList< QUrl > &audioFiles)
 
- Protected Attributes inherited from osmscout::TTSEngine
QThread * thread
 engine background thread (owns itself, deleted on finish)
 

Detailed Description

Piper (libpiper) based text-to-speech engine.

Synthesis is performed with the (synchronous) Piper API on the engine background thread. Each message is rendered into a WAV file placed in the per-application cache directory (e.g. ~/.cache/... on Unix) and cached, so repeated messages are synthesized only once. Playback is delegated to the VoiceCorePlayer.

Support for Piper is optional; this class is only compiled and available when the library was built with libpiper (see the CMake / Meson build files). When libpiper is missing, NavigationModule simply keeps its TTS engine unset.

Constructor & Destructor Documentation

◆ PiperTTSEngine()

osmscout::PiperTTSEngine::PiperTTSEngine ( const QString &  espeakDataDir)
explicit
Parameters
playeraudio player used to play synthesized messages.
espeakDataDirpath to the espeak-ng data directory required by Piper.

◆ ~PiperTTSEngine()

osmscout::PiperTTSEngine::~PiperTTSEngine ( )
override

Member Function Documentation

◆ cleanCache()

void osmscout::PiperTTSEngine::cleanCache ( )
overrideprotectedvirtual

Remove the oldest synthesized WAV files when the cache directory exceeds the size limit.

Called on the engine thread when the engine thread starts.

Reimplemented from osmscout::TTSEngine.

References osmscout::Log::Debug(), osmscout::log, and osmscout::Log::Warn().

◆ getVoice()

Voice osmscout::PiperTTSEngine::getVoice ( )
overridevirtual

Implements osmscout::TTSEngine.

◆ initVoice()

void osmscout::PiperTTSEngine::initVoice ( const Voice voice)
overridevirtual

◆ playMessage()

void osmscout::PiperTTSEngine::playMessage ( QString  message)
overridevirtual

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

Runs asynchronously on the engine thread.

Implements osmscout::TTSEngine.

References osmscout::TTSEngine::playAudioFilesRequest().

◆ prepareMessage()

void osmscout::PiperTTSEngine::prepareMessage ( QString  message)
overridevirtual

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

Runs asynchronously on the engine thread.

Implements osmscout::TTSEngine.


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