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