diff options
author | Jaromir Wysoglad | 2019-08-26 16:48:22 +0200 |
---|---|---|
committer | Filippos Karapetis | 2019-09-01 22:47:55 +0300 |
commit | 55c399c7c0ebe4084c1bdf31e647cfa50cc01c09 (patch) | |
tree | da06bf1c4ad5f18ed4220df1682c3ea00626788b /backends/text-to-speech/windows | |
parent | 6baa9c8ddb524f3d0ca91f34f2d3ddc2c055a6cd (diff) | |
download | scummvm-rg350-55c399c7c0ebe4084c1bdf31e647cfa50cc01c09.tar.gz scummvm-rg350-55c399c7c0ebe4084c1bdf31e647cfa50cc01c09.tar.bz2 scummvm-rg350-55c399c7c0ebe4084c1bdf31e647cfa50cc01c09.zip |
TTS: Use Common::Encoding for encoding conversion.
Diffstat (limited to 'backends/text-to-speech/windows')
-rw-r--r-- | backends/text-to-speech/windows/windows-text-to-speech.cpp | 8 |
1 files changed, 6 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 b7d39f0286..a59f21952b 100644 --- a/backends/text-to-speech/windows/windows-text-to-speech.cpp +++ b/backends/text-to-speech/windows/windows-text-to-speech.cpp @@ -32,7 +32,6 @@ #include <sapi.h> #include "backends/text-to-speech/windows/sphelper-scummvm.h" #include "backends/platform/sdl/win32/win32_wrapper.h" -#include "backends/platform/sdl/win32/codepage.h" #include "backends/text-to-speech/windows/windows-text-to-speech.h" @@ -41,6 +40,7 @@ #include "common/system.h" #include "common/ustr.h" #include "common/config-manager.h" +#include "common/encoding.h" ISpVoice *_voice; @@ -174,7 +174,11 @@ bool WindowsTextToSpeechManager::say(Common::String str, Action action, Common:: // We have to set the pitch by prepending xml code at the start of the said string; Common::String pitch= Common::String::format("<pitch absmiddle=\"%d\">", _ttsState->_pitch / 10); str.replace((uint32)0, 0, pitch); - WCHAR *strW = Win32::ansiToUnicode(str.c_str(), Win32::getCodePageId(charset)); + WCHAR *strW = (WCHAR *) Common::Encoding::convert("UTF-16", charset, str.c_str(), str.size()); + if (strW == nullptr) { + warning("Cannot convert from %s encoding for text to speech", charset.c_str()); + return true; + } WaitForSingleObject(_speechMutex, INFINITE); if (isSpeaking() && !_speechQueue.empty() && action == INTERRUPT_NO_REPEAT && |