aboutsummaryrefslogtreecommitdiff
path: root/backends/text-to-speech
diff options
context:
space:
mode:
authorJaromir Wysoglad2019-07-15 13:50:21 -0700
committerFilippos Karapetis2019-09-01 22:47:55 +0300
commitd2d34a4ecaabd7d436bfab942c9003d0e478ad2a (patch)
tree82163ec33dcdb9e9f68f3f762fe7689054ef8c50 /backends/text-to-speech
parent8357e8e6bf909353c3db720ba8fda9cdb0a41933 (diff)
downloadscummvm-rg350-d2d34a4ecaabd7d436bfab942c9003d0e478ad2a.tar.gz
scummvm-rg350-d2d34a4ecaabd7d436bfab942c9003d0e478ad2a.tar.bz2
scummvm-rg350-d2d34a4ecaabd7d436bfab942c9003d0e478ad2a.zip
TTS: Start implementing windows TTS
Diffstat (limited to 'backends/text-to-speech')
-rw-r--r--backends/text-to-speech/windows/windows-text-to-speech.cpp19
-rw-r--r--backends/text-to-speech/windows/windows-text-to-speech.h8
2 files changed, 25 insertions, 2 deletions
diff --git a/backends/text-to-speech/windows/windows-text-to-speech.cpp b/backends/text-to-speech/windows/windows-text-to-speech.cpp
index cae1e6be78..aad50c61ff 100644
--- a/backends/text-to-speech/windows/windows-text-to-speech.cpp
+++ b/backends/text-to-speech/windows/windows-text-to-speech.cpp
@@ -41,15 +41,30 @@
#include "common/ustr.h"
#include "common/config-manager.h"
-WindowsTextToSpeechManager::WindowsTextToSpeechManager() {
- debug("hi");
+ISpVoice *_voice;
+
+WindowsTextToSpeechManager::WindowsTextToSpeechManager()
+ : _speechState(BROKEN){
init();
}
void WindowsTextToSpeechManager::init() {
+ if (FAILED(::CoInitialize(NULL)))
+ return;
+
+ HRESULT hr = CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void **)&_voice);
+ if (!SUCCEEDED(hr)) {
+ warning("Could not initialize TTS voice");
+ return;
+ }
+ updateVoices();
+ _speechState = READY;
}
WindowsTextToSpeechManager::~WindowsTextToSpeechManager() {
+ if (_voice)
+ _voice->Release();
+ ::CoUninitialize();
}
bool WindowsTextToSpeechManager::say(Common::String str) {
diff --git a/backends/text-to-speech/windows/windows-text-to-speech.h b/backends/text-to-speech/windows/windows-text-to-speech.h
index a00ed58b8b..5daf57c44c 100644
--- a/backends/text-to-speech/windows/windows-text-to-speech.h
+++ b/backends/text-to-speech/windows/windows-text-to-speech.h
@@ -32,6 +32,13 @@
class WindowsTextToSpeechManager : public Common::TextToSpeechManager {
public:
+ enum SpeechState {
+ READY,
+ PAUSED,
+ SPEAKING,
+ BROKEN
+ };
+
WindowsTextToSpeechManager();
virtual ~WindowsTextToSpeechManager();
@@ -60,6 +67,7 @@ private:
void init();
virtual void updateVoices();
void createVoice(int typeNumber, Common::TTSVoice::Gender, char *description);
+ SpeechState _speechState;
};
#endif