Showing the changes to interface/src/scripting/TTSScriptingInterface.cpp (1 of 5 files). Show all
Unified · Split
| @@ -65,7 +65,7 @@ void TTSScriptingInterface::testTone(const bool& alsoInject) { · 64 unmodified lines | |||
| 65 | int16_t temp = (glm::sin(glm::radians((float)a))) * 32768; | 65 | int16_t temp = (glm::sin(glm::radians((float)a))) * 32768; |
| 66 | samples[a] = temp; | 66 | samples[a] = temp; |
| 67 | } | 67 | } |
| 68 | emit ttsSampleCreated(_lastSoundByteArray); | 68 | emit ttsSampleCreated(_lastSoundByteArray, AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL * 50, 96); |
| 69 | 69 | ||
| 70 | if (alsoInject) { | 70 | if (alsoInject) { |
| 71 | AudioInjectorOptions options; | 71 | AudioInjectorOptions options; |
| @@ -75,11 +75,16 @@ void TTSScriptingInterface::testTone(const bool& alsoInject) { · 3 unmodified lines | |||
| 75 | } | 75 | } |
| 76 | } | 76 | } |
| 77 | 77 | ||
| 78 | void TTSScriptingInterface::speakText(const QString& textToSpeak, const bool& alsoInject) { | 78 | void TTSScriptingInterface::speakText(const QString& textToSpeak, |
| 79 | const int& newChunkSize, | ||
| 80 | const int& timerInterval, | ||
| 81 | const int& sampleRate, | ||
| 82 | const int& bitsPerSample, | ||
| 83 | const bool& alsoInject) { | ||
| 79 | WAVEFORMATEX fmt; | 84 | WAVEFORMATEX fmt; |
| 80 | fmt.wFormatTag = WAVE_FORMAT_PCM; | 85 | fmt.wFormatTag = WAVE_FORMAT_PCM; |
| 81 | fmt.nSamplesPerSec = 24000; | 86 | fmt.nSamplesPerSec = sampleRate; |
| 82 | fmt.wBitsPerSample = 16; | 87 | fmt.wBitsPerSample = bitsPerSample; |
| 83 | fmt.nChannels = 1; | 88 | fmt.nChannels = 1; |
| 84 | fmt.nBlockAlign = fmt.nChannels * fmt.wBitsPerSample / 8; | 89 | fmt.nBlockAlign = fmt.nChannels * fmt.wBitsPerSample / 8; |
| 85 | fmt.nAvgBytesPerSec = fmt.nSamplesPerSec * fmt.nBlockAlign; | 90 | fmt.nAvgBytesPerSec = fmt.nSamplesPerSec * fmt.nBlockAlign; |
| @@ -146,7 +151,7 @@ void TTSScriptingInterface::speakText(const QString& textToSpeak, const bool& al · 60 unmodified lines | |||
| 146 | _lastSoundByteArray.resize(0); | 151 | _lastSoundByteArray.resize(0); |
| 147 | _lastSoundByteArray.append(buf1, dwSize); | 152 | _lastSoundByteArray.append(buf1, dwSize); |
| 148 | 153 | ||
| 149 | emit ttsSampleCreated(_lastSoundByteArray); | 154 | emit ttsSampleCreated(_lastSoundByteArray, newChunkSize, timerInterval); |
| 150 | 155 | ||
| 151 | if (alsoInject) { | 156 | if (alsoInject) { |
| 152 | AudioInjectorOptions options; | 157 | AudioInjectorOptions options; |
| @@ -160,4 +165,6 @@ void TTSScriptingInterface::stopLastSpeech() { · 7 unmodified lines | |||
| 160 | if (_lastSoundAudioInjector) { | 165 | if (_lastSoundAudioInjector) { |
| 161 | _lastSoundAudioInjector->stop(); | 166 | _lastSoundAudioInjector->stop(); |
| 162 | } | 167 | } |
| 168 | |||
| 169 | emit clearTTSBuffer(); | ||
| 163 | } | 170 | } |