mirror of
https://github.com/overte-org/overte.git
synced 2025-04-21 18:44:00 +02:00
I love it.
This commit is contained in:
parent
d8c9712dd2
commit
5d4de3d3b0
2 changed files with 10 additions and 4 deletions
|
@ -11,7 +11,6 @@
|
|||
|
||||
#include "SpeechScriptingInterface.h"
|
||||
#include "avatar/AvatarManager.h"
|
||||
#include <AudioInjector.h>
|
||||
|
||||
SpeechScriptingInterface::SpeechScriptingInterface() {
|
||||
//
|
||||
|
@ -94,7 +93,7 @@ void SpeechScriptingInterface::speakText(const QString& textToSpeak) {
|
|||
|
||||
ULONG streamNumber;
|
||||
hr = m_tts->Speak(reinterpret_cast<LPCWSTR>(textToSpeak.utf16()),
|
||||
SPF_IS_NOT_XML | SPF_ASYNC | SPF_PURGEBEFORESPEAK,
|
||||
SPF_IS_XML | SPF_ASYNC | SPF_PURGEBEFORESPEAK,
|
||||
&streamNumber);
|
||||
if (FAILED(hr)) {
|
||||
qDebug() << "Speak failed.";
|
||||
|
@ -130,5 +129,9 @@ void SpeechScriptingInterface::speakText(const QString& textToSpeak) {
|
|||
AudioInjectorOptions options;
|
||||
options.position = DependencyManager::get<AvatarManager>()->getMyAvatarPosition();
|
||||
|
||||
AudioInjector::playSound(byteArray, options);
|
||||
lastSound = AudioInjector::playSound(byteArray, options);
|
||||
}
|
||||
|
||||
void SpeechScriptingInterface::stopLastSpeech() {
|
||||
lastSound->stop();
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#endif
|
||||
#include <sapi.h> // SAPI
|
||||
#include <sphelper.h> // SAPI Helper
|
||||
#include <AudioInjector.h>
|
||||
|
||||
class SpeechScriptingInterface : public QObject, public Dependency {
|
||||
Q_OBJECT
|
||||
|
@ -27,9 +28,9 @@ public:
|
|||
~SpeechScriptingInterface();
|
||||
|
||||
Q_INVOKABLE void speakText(const QString& textToSpeak);
|
||||
Q_INVOKABLE void stopLastSpeech();
|
||||
|
||||
private:
|
||||
|
||||
class CComAutoInit {
|
||||
public:
|
||||
// Initializes COM using CoInitialize.
|
||||
|
@ -70,6 +71,8 @@ private:
|
|||
|
||||
// Default voice token
|
||||
CComPtr<ISpObjectToken> m_voiceToken;
|
||||
|
||||
AudioInjectorPointer lastSound;
|
||||
};
|
||||
|
||||
#endif // hifi_SpeechScriptingInterface_h
|
||||
|
|
Loading…
Reference in a new issue