Showing the changes to interface/src/scripting/TTSScriptingInterface.cpp (1 of 2 files). Show all
Unified · Split
| @@ -13,6 +13,7 @@ · 12 unmodified lines | |||
| 13 | #include "avatar/AvatarManager.h" | 13 | #include "avatar/AvatarManager.h" |
| 14 | 14 | ||
| 15 | TTSScriptingInterface::TTSScriptingInterface() { | 15 | TTSScriptingInterface::TTSScriptingInterface() { |
| 16 | #ifdef WIN32 | ||
| 16 | // | 17 | // |
| 17 | // Create text to speech engine | 18 | // Create text to speech engine |
| 18 | // | 19 | // |
| @@ -36,11 +37,13 @@ TTSScriptingInterface::TTSScriptingInterface() { · 17 unmodified lines | |||
| 36 | if (FAILED(hr)) { | 37 | if (FAILED(hr)) { |
| 37 | qDebug() << "Can't set default voice."; | 38 | qDebug() << "Can't set default voice."; |
| 38 | } | 39 | } |
| 40 | #endif | ||
| 39 | } | 41 | } |
| 40 | 42 | ||
| 41 | TTSScriptingInterface::~TTSScriptingInterface() { | 43 | TTSScriptingInterface::~TTSScriptingInterface() { |
| 42 | } | 44 | } |
| 43 | 45 | ||
| 46 | #ifdef WIN32 | ||
| 44 | class ReleaseOnExit { | 47 | class ReleaseOnExit { |
| 45 | public: | 48 | public: |
| 46 | ReleaseOnExit(IUnknown* p) : m_p(p) {} | 49 | ReleaseOnExit(IUnknown* p) : m_p(p) {} |
| @@ -53,6 +56,7 @@ public: · 6 unmodified lines | |||
| 53 | private: | 56 | private: |
| 54 | IUnknown* m_p; | 57 | IUnknown* m_p; |
| 55 | }; | 58 | }; |
| 59 | #endif | ||
| 56 | 60 | ||
| 57 | void TTSScriptingInterface::testTone(const bool& alsoInject) { | 61 | void TTSScriptingInterface::testTone(const bool& alsoInject) { |
| 58 | QByteArray byteArray(480000, 0); | 62 | QByteArray byteArray(480000, 0); |
| @@ -81,6 +85,7 @@ void TTSScriptingInterface::speakText(const QString& textToSpeak, · 22 unmodified lines | |||
| 81 | const int& sampleRate, | 85 | const int& sampleRate, |
| 82 | const int& bitsPerSample, | 86 | const int& bitsPerSample, |
| 83 | const bool& alsoInject) { | 87 | const bool& alsoInject) { |
| 88 | #ifdef WIN32 | ||
| 84 | WAVEFORMATEX fmt; | 89 | WAVEFORMATEX fmt; |
| 85 | fmt.wFormatTag = WAVE_FORMAT_PCM; | 90 | fmt.wFormatTag = WAVE_FORMAT_PCM; |
| 86 | fmt.nSamplesPerSec = sampleRate; | 91 | fmt.nSamplesPerSec = sampleRate; |
| @@ -161,6 +166,9 @@ void TTSScriptingInterface::speakText(const QString& textToSpeak, · 74 unmodified lines | |||
| 161 | 166 | ||
| 162 | _lastSoundAudioInjector = AudioInjector::playSound(_lastSoundByteArray, options); | 167 | _lastSoundAudioInjector = AudioInjector::playSound(_lastSoundByteArray, options); |
| 163 | } | 168 | } |
| 169 | #else | ||
| 170 | qDebug() << "Text-to-Speech isn't currently supported on non-Windows platforms."; | ||
| 171 | #endif | ||
| 164 | } | 172 | } |
| 165 | 173 | ||
| 166 | void TTSScriptingInterface::stopLastSpeech() { | 174 | void TTSScriptingInterface::stopLastSpeech() { |