TTS: Prepare for windows TTS
Add windows configuration in configure Add basic skeleton to backends Check if ttsMan is initialized in GUI
This commit is contained in:
parent
6303f522e1
commit
8357e8e6bf
10 changed files with 2855 additions and 7 deletions
|
@ -348,6 +348,10 @@ ifdef USE_LINUX_TTS
|
|||
MODULE_OBJS += \
|
||||
text-to-speech/linux/linux-text-to-speech.o
|
||||
endif
|
||||
ifdef USE_WINDOWS_TTS
|
||||
MODULE_OBJS += \
|
||||
text-to-speech/windows/windows-text-to-speech.o
|
||||
endif
|
||||
|
||||
# Include common rules
|
||||
include $(srcdir)/rules.mk
|
||||
|
|
|
@ -54,6 +54,10 @@
|
|||
#include "common/ustr.h"
|
||||
#include "common/encoding.h"
|
||||
|
||||
#ifdef USE_WINDOWS_TTS
|
||||
#include "backends/text-to-speech/windows/windows-text-to-speech.h"
|
||||
#endif
|
||||
|
||||
#define DEFAULT_CONFIG_FILE "scummvm.ini"
|
||||
|
||||
void OSystem_Win32::init() {
|
||||
|
@ -115,6 +119,9 @@ void OSystem_Win32::initBackend() {
|
|||
// Initialize updates manager
|
||||
_updateManager = new Win32UpdateManager();
|
||||
#endif
|
||||
#ifdef USE_WINDOWS_TTS
|
||||
_textToSpeechManager = new WindowsTextToSpeechManager();
|
||||
#endif
|
||||
|
||||
// Invoke parent implementation of this method
|
||||
OSystem_SDL::initBackend();
|
||||
|
|
2648
backends/text-to-speech/windows/sphelper-scummvm.h
Normal file
2648
backends/text-to-speech/windows/sphelper-scummvm.h
Normal file
File diff suppressed because it is too large
Load diff
109
backends/text-to-speech/windows/windows-text-to-speech.cpp
Normal file
109
backends/text-to-speech/windows/windows-text-to-speech.cpp
Normal file
|
@ -0,0 +1,109 @@
|
|||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
// Disable symbol overrides so that we can use system headers.
|
||||
#define FORBIDDEN_SYMBOL_ALLOW_ALL
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#if defined(USE_WINDOWS_TTS)
|
||||
#include <basetyps.h>
|
||||
#include <windows.h>
|
||||
#include <Servprov.h>
|
||||
#include <sapi.h>
|
||||
#include "backends/text-to-speech/windows/sphelper-scummvm.h"
|
||||
|
||||
#include "backends/text-to-speech/windows/windows-text-to-speech.h"
|
||||
|
||||
|
||||
#include "common/translation.h"
|
||||
#include "common/debug.h"
|
||||
#include "common/system.h"
|
||||
#include "common/ustr.h"
|
||||
#include "common/config-manager.h"
|
||||
|
||||
WindowsTextToSpeechManager::WindowsTextToSpeechManager() {
|
||||
debug("hi");
|
||||
init();
|
||||
}
|
||||
|
||||
void WindowsTextToSpeechManager::init() {
|
||||
}
|
||||
|
||||
WindowsTextToSpeechManager::~WindowsTextToSpeechManager() {
|
||||
}
|
||||
|
||||
bool WindowsTextToSpeechManager::say(Common::String str) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WindowsTextToSpeechManager::stop() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WindowsTextToSpeechManager::pause() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WindowsTextToSpeechManager::resume() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WindowsTextToSpeechManager::isSpeaking() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WindowsTextToSpeechManager::isPaused() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WindowsTextToSpeechManager::isReady() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void WindowsTextToSpeechManager::setVoice(unsigned index) {
|
||||
}
|
||||
|
||||
void WindowsTextToSpeechManager::setRate(int rate) {
|
||||
}
|
||||
|
||||
void WindowsTextToSpeechManager::setPitch(int pitch) {
|
||||
}
|
||||
|
||||
void WindowsTextToSpeechManager::setVolume(unsigned volume) {
|
||||
}
|
||||
|
||||
int WindowsTextToSpeechManager::getVolume() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void WindowsTextToSpeechManager::setLanguage(Common::String language) {
|
||||
}
|
||||
|
||||
void WindowsTextToSpeechManager::createVoice(int typeNumber, Common::TTSVoice::Gender gender, char *description) {
|
||||
}
|
||||
|
||||
void WindowsTextToSpeechManager::updateVoices() {
|
||||
|
||||
}
|
||||
|
||||
#endif
|
67
backends/text-to-speech/windows/windows-text-to-speech.h
Normal file
67
backends/text-to-speech/windows/windows-text-to-speech.h
Normal file
|
@ -0,0 +1,67 @@
|
|||
/* ScummVM - Graphic Adventure Engine
|
||||
*
|
||||
* ScummVM is the legal property of its developers, whose names
|
||||
* are too numerous to list here. Please refer to the COPYRIGHT
|
||||
* file distributed with this source distribution.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef BACKENDS_TEXT_TO_SPEECH_WINDOWS_H
|
||||
#define BACKENDS_TEXT_TO_SPEECH_WINDOWS_H
|
||||
|
||||
#include "common/scummsys.h"
|
||||
|
||||
#if defined(USE_WINDOWS_TTS)
|
||||
|
||||
#include "common/text-to-speech.h"
|
||||
#include "common/str.h"
|
||||
|
||||
class WindowsTextToSpeechManager : public Common::TextToSpeechManager {
|
||||
public:
|
||||
WindowsTextToSpeechManager();
|
||||
virtual ~WindowsTextToSpeechManager();
|
||||
|
||||
virtual bool say(Common::String str);
|
||||
|
||||
virtual bool stop();
|
||||
virtual bool pause();
|
||||
virtual bool resume();
|
||||
|
||||
virtual bool isSpeaking();
|
||||
virtual bool isPaused();
|
||||
virtual bool isReady();
|
||||
|
||||
virtual void setVoice(unsigned index);
|
||||
|
||||
virtual void setRate(int rate);
|
||||
|
||||
virtual void setPitch(int pitch);
|
||||
|
||||
virtual void setVolume(unsigned volume);
|
||||
virtual int getVolume();
|
||||
|
||||
virtual void setLanguage(Common::String language);
|
||||
|
||||
private:
|
||||
void init();
|
||||
virtual void updateVoices();
|
||||
void createVoice(int typeNumber, Common::TTSVoice::Gender, char *description);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif // BACKENDS_UPDATES_WINDOWS_H
|
8
configure
vendored
8
configure
vendored
|
@ -168,6 +168,7 @@ _dialogs=auto
|
|||
_iconv=auto
|
||||
_tts=auto
|
||||
_linux_tts=no
|
||||
_windows_tts=no
|
||||
# Default option behavior yes/no
|
||||
_debug_build=auto
|
||||
_release_build=auto
|
||||
|
@ -5375,6 +5376,13 @@ else
|
|||
define_in_config_if_yes $_linux_tts 'USE_LINUX_TTS'
|
||||
append_var LIBS '-lspeechd'
|
||||
;;
|
||||
mingw*)
|
||||
echo "win32"
|
||||
_tts=yes
|
||||
_windows_tts=yes
|
||||
define_in_config_if_yes $_windows_tts 'USE_WINDOWS_TTS'
|
||||
append_var LIBS '-lsapi -lole32'
|
||||
;;
|
||||
*)
|
||||
echo "no"
|
||||
_tts=no
|
||||
|
|
|
@ -626,6 +626,8 @@ void GuiManager::setLastMousePos(int16 x, int16 y) {
|
|||
#ifdef USE_TTS
|
||||
void GuiManager::initTextToSpeech() {
|
||||
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
|
||||
if (ttsMan == nullptr)
|
||||
return;
|
||||
#ifdef USE_TRANSLATION
|
||||
Common::String currentLanguage = TransMan.getCurrentLanguage();
|
||||
if (currentLanguage != "C") {
|
||||
|
|
|
@ -1800,7 +1800,10 @@ void GlobalOptionsDialog::build() {
|
|||
_ttsCheckbox->setState(false);
|
||||
|
||||
_ttsVoiceSelectionPopUp = new PopUpWidget(tab, "GlobalOptions_Accessibility.TTSVoiceSelection");
|
||||
Common::Array<Common::TTSVoice> voices = g_system->getTextToSpeechManager()->getVoicesArray();
|
||||
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
|
||||
Common::Array<Common::TTSVoice> voices;
|
||||
if (ttsMan != nullptr)
|
||||
voices = ttsMan->getVoicesArray();
|
||||
|
||||
for(unsigned i = 0; i < voices.size(); i++) {
|
||||
_ttsVoiceSelectionPopUp->appendEntry(voices[i].getDescription(), i);
|
||||
|
|
|
@ -260,7 +260,10 @@ void Widget::read(Common::String str) {
|
|||
#ifdef USE_TTS
|
||||
if (ConfMan.hasKey("tts_enabled", "scummvm") &&
|
||||
ConfMan.getBool("tts_enabled", "scummvm")) {
|
||||
g_system->getTextToSpeechManager()->say(str);
|
||||
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
|
||||
if (ttsMan == nullptr)
|
||||
return;
|
||||
ttsMan->say(str);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -227,11 +227,8 @@ void PopUpDialog::read(Common::String str) {
|
|||
#ifdef USE_TTS
|
||||
if (ConfMan.hasKey("tts_enabled", "scummvm") &&
|
||||
ConfMan.getBool("tts_enabled", "scummvm")) {
|
||||
int volume = (ConfMan.getInt("speech_volume", "scummvm") * 100) / 256;
|
||||
if (ConfMan.hasKey("mute", "scummvm") && ConfMan.getBool("mute", "scummvm"))
|
||||
volume = 0;
|
||||
g_system->getTextToSpeechManager()->setVolume(volume);
|
||||
g_system->getTextToSpeechManager()->say(str);
|
||||
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
|
||||
ttsMan->say(str);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue