Showing the changes to interface/src/scripting/TTSScriptingInterface.cpp (1 of 1 file). Show all
Unified · Split
| @@ -75,7 +75,7 @@ void TTSScriptingInterface::speakText(const QString& textToSpeak) { · 74 unmodified lines | |||
| 75 | #ifdef WIN32 | 75 | #ifdef WIN32 |
| 76 | WAVEFORMATEX fmt; | 76 | WAVEFORMATEX fmt; |
| 77 | fmt.wFormatTag = WAVE_FORMAT_PCM; | 77 | fmt.wFormatTag = WAVE_FORMAT_PCM; |
| 78 | fmt.nSamplesPerSec = 24000; | 78 | fmt.nSamplesPerSec = AudioConstants::SAMPLE_RATE; |
| 79 | fmt.wBitsPerSample = 16; | 79 | fmt.wBitsPerSample = 16; |
| 80 | fmt.nChannels = 1; | 80 | fmt.nChannels = 1; |
| 81 | fmt.nBlockAlign = fmt.nChannels * fmt.wBitsPerSample / 8; | 81 | fmt.nBlockAlign = fmt.nChannels * fmt.wBitsPerSample / 8; |
| @@ -132,17 +132,13 @@ void TTSScriptingInterface::speakText(const QString& textToSpeak) { · 50 unmodified lines | |||
| 132 | hr = IStream_Size(pStream, &StreamSize); | 132 | hr = IStream_Size(pStream, &StreamSize); |
| 133 | 133 | ||
| 134 | DWORD dwSize = StreamSize.QuadPart; | 134 | DWORD dwSize = StreamSize.QuadPart; |
| 135 | char* buf1 = new char[dwSize + 1]; | 135 | _lastSoundByteArray.resize(dwSize); |
| 136 | memset(buf1, 0, dwSize + 1); | ||
| 137 | 136 | ||
| 138 | hr = IStream_Read(pStream, buf1, dwSize); | 137 | hr = IStream_Read(pStream, _lastSoundByteArray.data(), dwSize); |
| 139 | if (FAILED(hr)) { | 138 | if (FAILED(hr)) { |
| 140 | qDebug() << "Couldn't read from stream."; | 139 | qDebug() << "Couldn't read from stream."; |
| 141 | } | 140 | } |
| 142 | 141 | ||
| 143 | _lastSoundByteArray.resize(0); | ||
| 144 | _lastSoundByteArray.append(buf1, dwSize); | ||
| 145 | |||
| 146 | AudioInjectorOptions options; | 142 | AudioInjectorOptions options; |
| 147 | options.position = DependencyManager::get<AvatarManager>()->getMyAvatarPosition(); | 143 | options.position = DependencyManager::get<AvatarManager>()->getMyAvatarPosition(); |
| 148 | 144 | ||