diff options
author | Jaromir Wysoglad | 2019-08-09 00:45:02 +0200 |
---|---|---|
committer | Filippos Karapetis | 2019-09-01 22:47:55 +0300 |
commit | be5c865c508c93f6910468a07d3947237e7e0a8e (patch) | |
tree | 04c6cf60051c2b7436613fd5293d4b7bbb2d9b12 /backends/text-to-speech/linux/linux-text-to-speech.h | |
parent | 01d843c527d7808027a546dc5d9a23a981839f8f (diff) | |
download | scummvm-rg350-be5c865c508c93f6910468a07d3947237e7e0a8e.tar.gz scummvm-rg350-be5c865c508c93f6910468a07d3947237e7e0a8e.tar.bz2 scummvm-rg350-be5c865c508c93f6910468a07d3947237e7e0a8e.zip |
TTS: Add proper speech queuing, update INT_NO_REP.
Before I used SPD to queue messages and I had a copy of the queue,
so I could requeue everything when resume is called(). But more
control of the queue is needed, so I don't use the SPD's queue
and instead start speeches from my queue one by one from another
thread.
INTERRUPT_NO_REPEAT now behaves as described in the documentation
Diffstat (limited to 'backends/text-to-speech/linux/linux-text-to-speech.h')
-rw-r--r-- | backends/text-to-speech/linux/linux-text-to-speech.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/backends/text-to-speech/linux/linux-text-to-speech.h b/backends/text-to-speech/linux/linux-text-to-speech.h index 23c35c33f6..33f15daccb 100644 --- a/backends/text-to-speech/linux/linux-text-to-speech.h +++ b/backends/text-to-speech/linux/linux-text-to-speech.h @@ -30,6 +30,12 @@ #include "common/text-to-speech.h" #include "common/str.h" #include "common/list.h" +#include "common/mutex.h" + +struct StartSpeechParams { + pthread_mutex_t *mutex; + Common::List<Common::String> *speechQueue; +}; class LinuxTextToSpeechManager : public Common::TextToSpeechManager { public: @@ -62,13 +68,9 @@ public: virtual bool isReady(); virtual void setVoice(unsigned index); - virtual void setRate(int rate); - virtual void setPitch(int pitch); - virtual void setVolume(unsigned volume); - virtual void setLanguage(Common::String language); void updateState(SpeechEvent event); @@ -80,11 +82,14 @@ private: virtual void updateVoices(); void createVoice(int typeNumber, Common::TTSVoice::Gender, Common::TTSVoice::Age, char *description); Common::String strToUtf8(Common::String str, Common::String charset); - bool spdSay(const char *str); + static void *startSpeech(void *p); + StartSpeechParams _params; SpeechState _speechState; - Common::String _lastSaid; Common::List<Common::String> _speechQueue; + pthread_mutex_t _speechMutex; + pthread_t _thread; + bool _threadCreated; }; #endif |