History

CR feedback - thanks Ken!

Zach Fox committed 8 years ago

Commit cee14541 parent 48d34501 file · +3 −7Browse files

Showing the changes to interface/src/scripting/TTSScriptingInterface.cpp (1 of 1 file). Show all

Unified · Split

interface/src/scripting/TTSScriptingInterface.cpp+3−7
@@ -75,7 +75,7 @@ void TTSScriptingInterface::speakText(const QString& textToSpeak) { · 74 unmodified lines
7575 #ifdef WIN32
7676 WAVEFORMATEX fmt;
7777 fmt.wFormatTag = WAVE_FORMAT_PCM;
78− fmt.nSamplesPerSec = 24000;
78+ fmt.nSamplesPerSec = AudioConstants::SAMPLE_RATE;
7979 fmt.wBitsPerSample = 16;
8080 fmt.nChannels = 1;
8181 fmt.nBlockAlign = fmt.nChannels * fmt.wBitsPerSample / 8;
@@ -132,17 +132,13 @@ void TTSScriptingInterface::speakText(const QString& textToSpeak) { · 50 unmodified lines
132132 hr = IStream_Size(pStream, &StreamSize);
133133
134134 DWORD dwSize = StreamSize.QuadPart;
135− char* buf1 = new char[dwSize + 1];
136− memset(buf1, 0, dwSize + 1);
135+ _lastSoundByteArray.resize(dwSize);
137136
138− hr = IStream_Read(pStream, buf1, dwSize);
137+ hr = IStream_Read(pStream, _lastSoundByteArray.data(), dwSize);
139138 if (FAILED(hr)) {
140139 qDebug() << "Couldn't read from stream.";
141140 }
142141
143− _lastSoundByteArray.resize(0);
144− _lastSoundByteArray.append(buf1, dwSize);
145−
146142 AudioInjectorOptions options;
147143 options.position = DependencyManager::get<AvatarManager>()->getMyAvatarPosition();
148144