summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2015-10-13 18:40:27 +0200
committerFrederik Gladhorn <frederik.gladhorn@theqtcompany.com>2015-10-17 11:07:51 +0000
commit948321ba7f2da857c696c1b9d5c66f6a991c18b0 (patch)
treead9faff866733a31f05445d3678b0fa4a08c150f
parent6b712af8f66c69445bc71f6030b3b3aca4d628b2 (diff)
Port Windows SAPI to plugin architecture
Change-Id: I29923a5aa917a017b652fe46d325344aafd8fe6f Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
-rw-r--r--[-rwxr-xr-x]src/plugins/plugins.pro0
-rw-r--r--src/plugins/tts/sapi/qtexttospeech_sapi.cpp (renamed from src/tts/qtexttospeech_win.cpp)169
-rw-r--r--src/plugins/tts/sapi/qtexttospeech_sapi.h104
-rw-r--r--src/plugins/tts/sapi/qtexttospeech_sapi_plugin.cpp44
-rw-r--r--src/plugins/tts/sapi/qtexttospeech_sapi_plugin.h63
-rw-r--r--src/plugins/tts/sapi/sapi.pro19
-rw-r--r--src/plugins/tts/sapi/sapi_plugin.json6
-rw-r--r--[-rwxr-xr-x]src/plugins/tts/tts.pro2
8 files changed, 298 insertions, 109 deletions
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index ea1896d..ea1896d 100755..100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
diff --git a/src/tts/qtexttospeech_win.cpp b/src/plugins/tts/sapi/qtexttospeech_sapi.cpp
index 75caa59..7df3399 100644
--- a/src/tts/qtexttospeech_win.cpp
+++ b/src/plugins/tts/sapi/qtexttospeech_sapi.cpp
@@ -34,9 +34,7 @@
**
****************************************************************************/
-
-
-#include "qtexttospeech_p.h"
+#include "qtexttospeech_sapi.h"
#include <windows.h>
#include <sapi.h>
@@ -45,92 +43,43 @@
QT_BEGIN_NAMESPACE
-
-class QTextToSpeechPrivateWindows : public QTextToSpeechPrivate, public ISpNotifyCallback
+QTextToSpeechEngineSapi::QTextToSpeechEngineSapi(const QVariantMap &, QObject *)
+ : m_pitch(0.0), m_pauseCount(0), m_state(QTextToSpeech::BackendError)
{
-public:
- QTextToSpeechPrivateWindows(QTextToSpeech *speech);
- ~QTextToSpeechPrivateWindows();
-
- QVector<QLocale> availableLocales() const Q_DECL_OVERRIDE;
- QVector<QVoice> availableVoices() const Q_DECL_OVERRIDE;
-
- void say(const QString &text) Q_DECL_OVERRIDE;
- void stop() Q_DECL_OVERRIDE;
- void pause() Q_DECL_OVERRIDE;
- void resume() Q_DECL_OVERRIDE;
-
-
- double rate() const Q_DECL_OVERRIDE;
- void setRate(double rate) Q_DECL_OVERRIDE;
- double pitch() const Q_DECL_OVERRIDE;
- void setPitch(double pitch) Q_DECL_OVERRIDE;
- int volume() const Q_DECL_OVERRIDE;
- void setVolume(int volume) Q_DECL_OVERRIDE;
- void setLocale(const QLocale &locale) Q_DECL_OVERRIDE;
- QLocale locale() const Q_DECL_OVERRIDE;
- void setVoice(const QVoice &voiceName) Q_DECL_OVERRIDE;
- QVoice voice() const Q_DECL_OVERRIDE;
- QTextToSpeech::State state() const Q_DECL_OVERRIDE;
-
- bool isPaused() const { return m_pauseCount; }
- bool isSpeaking() const;
-
- HRESULT STDMETHODCALLTYPE NotifyCallback(WPARAM /*wParam*/, LPARAM /*lParam*/);
-
-private:
- QMap<QString, QString> voiceAttributes(ISpObjectToken *speechToken) const;
- QString voiceId(ISpObjectToken *speechToken) const;
- QLocale lcidToLocale(const QString &lcid) const;
- void updateVoices();
-
- ISpVoice *m_voice;
- double m_pitch;
- int m_pauseCount;
- QVector<QLocale> m_locales;
- QVoice m_currentVoice;
- QMultiMap<QString, QVoice> m_voices;
-};
-
-
-QTextToSpeech::QTextToSpeech(QObject *parent)
- : QObject(*new QTextToSpeechPrivateWindows(this), parent)
+ init();
+}
+
+QTextToSpeechEngineSapi::~QTextToSpeechEngineSapi()
{
- qRegisterMetaType<QTextToSpeech::State>();
}
-QTextToSpeechPrivateWindows::QTextToSpeechPrivateWindows(QTextToSpeech *speech)
- : QTextToSpeechPrivate(speech), m_pitch(0.0), m_pauseCount(0) //, m_voices(0)
+void QTextToSpeechEngineSapi::init()
{
- if (FAILED(::CoInitialize(NULL)))
+ if (FAILED(::CoInitialize(NULL))) {
qWarning() << "Init of COM failed";
+ return;
+ }
HRESULT hr = CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void **)&m_voice);
- if (!SUCCEEDED(hr))
+ if (!SUCCEEDED(hr)) {
qWarning() << "Could not init voice";
+ return;
+ }
m_voice->SetInterest(SPFEI_ALL_TTS_EVENTS, SPFEI_ALL_TTS_EVENTS);
m_voice->SetNotifyCallbackInterface(this, 0, 0);
updateVoices();
+ m_state = QTextToSpeech::Ready;
}
-QTextToSpeechPrivateWindows::~QTextToSpeechPrivateWindows()
-{
-}
-
-QTextToSpeech::State QTextToSpeechPrivate::state() const
-{
- return m_state;
-}
-
-bool QTextToSpeechPrivateWindows::isSpeaking() const
+bool QTextToSpeechEngineSapi::isSpeaking() const
{
SPVOICESTATUS eventStatus;
m_voice->GetStatus(&eventStatus, NULL);
return eventStatus.dwRunningState == SPRS_IS_SPEAKING;
}
-void QTextToSpeechPrivateWindows::say(const QString &text)
+void QTextToSpeechEngineSapi::say(const QString &text)
{
if (text.isEmpty())
return;
@@ -140,20 +89,19 @@ void QTextToSpeechPrivateWindows::say(const QString &text)
stop();
textString.prepend(QString::fromLatin1("<pitch absmiddle=\"%1\"/>").arg(m_pitch * 10));
- qDebug() << "say: " << textString;
std::wstring wtext = textString.toStdWString();
m_voice->Speak(wtext.data(), SPF_ASYNC, NULL);
}
-void QTextToSpeechPrivateWindows::stop()
+void QTextToSpeechEngineSapi::stop()
{
- if (isPaused())
+ if (m_state == QTextToSpeech::Paused)
resume();
m_voice->Speak(NULL, SPF_PURGEBEFORESPEAK, 0);
}
-void QTextToSpeechPrivateWindows::pause()
+void QTextToSpeechEngineSapi::pause()
{
if (!isSpeaking())
return;
@@ -162,11 +110,11 @@ void QTextToSpeechPrivateWindows::pause()
++m_pauseCount;
m_voice->Pause();
m_state = QTextToSpeech::Paused;
- emitStateChanged(m_state);
+ emit stateChanged(m_state);
}
}
-void QTextToSpeechPrivateWindows::resume()
+void QTextToSpeechEngineSapi::resume()
{
if (m_pauseCount > 0) {
--m_pauseCount;
@@ -176,27 +124,29 @@ void QTextToSpeechPrivateWindows::resume()
} else {
m_state = QTextToSpeech::Ready;
}
- emitStateChanged(m_state);
+ emit stateChanged(m_state);
}
}
-void QTextToSpeechPrivateWindows::setPitch(double pitch)
+bool QTextToSpeechEngineSapi::setPitch(double pitch)
{
m_pitch = pitch;
+ return true;
}
-double QTextToSpeechPrivateWindows::pitch() const
+double QTextToSpeechEngineSapi::pitch() const
{
return m_pitch;
}
-void QTextToSpeechPrivateWindows::setRate(double rate)
+bool QTextToSpeechEngineSapi::setRate(double rate)
{
// -10 to 10
m_voice->SetRate(long(rate*10));
+ return true;
}
-double QTextToSpeechPrivateWindows::rate() const
+double QTextToSpeechEngineSapi::rate() const
{
long rateValue;
if (m_voice->GetRate(&rateValue) == S_OK)
@@ -204,13 +154,14 @@ double QTextToSpeechPrivateWindows::rate() const
return -1;
}
-void QTextToSpeechPrivateWindows::setVolume(int volume)
+bool QTextToSpeechEngineSapi::setVolume(int volume)
{
// 0 to 100
m_voice->SetVolume(volume);
+ return true;
}
-int QTextToSpeechPrivateWindows::volume() const
+int QTextToSpeechEngineSapi::volume() const
{
USHORT baseVolume;
if (m_voice->GetVolume(&baseVolume) == S_OK)
@@ -220,7 +171,7 @@ int QTextToSpeechPrivateWindows::volume() const
return -1;
}
-QString QTextToSpeechPrivateWindows::voiceId(ISpObjectToken *speechToken) const
+QString QTextToSpeechEngineSapi::voiceId(ISpObjectToken *speechToken) const
{
HRESULT hr = S_OK;
LPWSTR vId = nullptr;
@@ -232,7 +183,7 @@ QString QTextToSpeechPrivateWindows::voiceId(ISpObjectToken *speechToken) const
return QString::fromWCharArray(vId);
}
-QMap<QString, QString> QTextToSpeechPrivateWindows::voiceAttributes(ISpObjectToken *speechToken) const
+QMap<QString, QString> QTextToSpeechEngineSapi::voiceAttributes(ISpObjectToken *speechToken) const
{
HRESULT hr = S_OK;
QMap<QString, QString> result;
@@ -276,7 +227,7 @@ QMap<QString, QString> QTextToSpeechPrivateWindows::voiceAttributes(ISpObjectTok
return result;
}
-QLocale QTextToSpeechPrivateWindows::lcidToLocale(const QString &lcid) const
+QLocale QTextToSpeechEngineSapi::lcidToLocale(const QString &lcid) const
{
bool ok;
LCID locale = lcid.toInt(&ok, 16);
@@ -292,7 +243,7 @@ QLocale QTextToSpeechPrivateWindows::lcidToLocale(const QString &lcid) const
return QLocale(iso);
}
-void QTextToSpeechPrivateWindows::updateVoices()
+void QTextToSpeechEngineSapi::updateVoices()
{
HRESULT hr = S_OK;
CComPtr<ISpObjectToken> cpVoiceToken;
@@ -318,37 +269,37 @@ void QTextToSpeechPrivateWindows::updateVoices()
m_locales.append(vLocale);
// Create voice
- QVoice voice;
- voice.setName(vAttr["Name"]);
- voice.setAge(vAttr["Age"] == "Adult" ? QVoice::Adult : QVoice::Other);
- voice.setGender(vAttr["Gender"] == "Male" ? QVoice::Male :
- vAttr["Gender"] == "Female" ? QVoice::Female :
- QVoice::Unknown);
+
+ QString name = vAttr["Name"];
+ QVoice::Age age = vAttr["Age"] == "Adult" ? QVoice::Adult : QVoice::Other;
+ QVoice::Gender gender = vAttr["Gender"] == "Male" ? QVoice::Male :
+ vAttr["Gender"] == "Female" ? QVoice::Female :
+ QVoice::Unknown;
// Getting the ID of the voice to set the voice later
QString vId = voiceId(cpVoiceToken);
- voice.setData(vId);
+ QVoice voice = createVoice(name, gender, age, vId);
m_voices.insert(vLocale.name(), voice);
}
}
-QVector<QLocale> QTextToSpeechPrivateWindows::availableLocales() const
+QVector<QLocale> QTextToSpeechEngineSapi::availableLocales() const
{
return m_locales;
}
-void QTextToSpeechPrivateWindows::setLocale(const QLocale &locale)
+bool QTextToSpeechEngineSapi::setLocale(const QLocale &locale)
{
QList<QVoice> voicesForLocale = m_voices.values(locale.name());
if (voicesForLocale.length() > 0) {
setVoice(voicesForLocale[0]);
- emitLocaleChanged(locale);
- emitVoiceChanged(voicesForLocale[0]);
+ return true;
} else {
qWarning() << "No voice found for given locale";
}
+ return false;
}
-QLocale QTextToSpeechPrivateWindows::locale() const
+QLocale QTextToSpeechEngineSapi::locale() const
{
// Get current voice id
CComPtr<ISpObjectToken> cpVoiceToken;
@@ -358,15 +309,15 @@ QLocale QTextToSpeechPrivateWindows::locale() const
return lcidToLocale(vAttr["Language"]);
}
-QVector<QVoice> QTextToSpeechPrivateWindows::availableVoices() const
+QVector<QVoice> QTextToSpeechEngineSapi::availableVoices() const
{
return m_voices.values(locale().name()).toVector();
}
-void QTextToSpeechPrivateWindows::setVoice(const QVoice &voice)
+bool QTextToSpeechEngineSapi::setVoice(const QVoice &voice)
{
// Convert voice id to null-terminated wide char string
- QString vId = voice.data().toString();
+ QString vId = voiceData(voice).toString();
wchar_t* tokenId = new wchar_t[vId.size()+1];
vId.toWCharArray(tokenId);
tokenId[vId.size()] = 0;
@@ -378,39 +329,39 @@ void QTextToSpeechPrivateWindows::setVoice(const QVoice &voice)
if (FAILED(hr)) {
qWarning() << "Creating the voice token from ID failed";
m_state = QTextToSpeech::BackendError;
- emitStateChanged(m_state);
- return;
+ emit stateChanged(m_state);
+ return false;
}
if (m_state != QTextToSpeech::Ready) {
m_state = QTextToSpeech::Ready;
- emitStateChanged(m_state);
+ emit stateChanged(m_state);
}
delete[] tokenId;
m_voice->SetVoice(cpVoiceToken);
- emitVoiceChanged(voice);
+ return true;
}
-QVoice QTextToSpeechPrivateWindows::voice() const
+QVoice QTextToSpeechEngineSapi::voice() const
{
CComPtr<ISpObjectToken> cpVoiceToken;
m_voice->GetVoice(&cpVoiceToken);
QString vId = voiceId(cpVoiceToken);
foreach (const QVoice &voice, m_voices.values()) {
- if (voice.data().toString() == vId) {
+ if (voiceData(voice).toString() == vId) {
return voice;
}
}
return QVoice();
}
-QTextToSpeech::State QTextToSpeechPrivateWindows::state() const
+QTextToSpeech::State QTextToSpeechEngineSapi::state() const
{
return m_state;
}
-HRESULT QTextToSpeechPrivateWindows::NotifyCallback(WPARAM /*wParam*/, LPARAM /*lParam*/)
+HRESULT QTextToSpeechEngineSapi::NotifyCallback(WPARAM /*wParam*/, LPARAM /*lParam*/)
{
QTextToSpeech::State newState = QTextToSpeech::Ready;
if (isPaused()) {
@@ -423,7 +374,7 @@ HRESULT QTextToSpeechPrivateWindows::NotifyCallback(WPARAM /*wParam*/, LPARAM /*
if (m_state != newState) {
m_state = newState;
- emitStateChanged(newState);
+ emit stateChanged(newState);
}
return S_OK;
diff --git a/src/plugins/tts/sapi/qtexttospeech_sapi.h b/src/plugins/tts/sapi/qtexttospeech_sapi.h
new file mode 100644
index 0000000..341a75f
--- /dev/null
+++ b/src/plugins/tts/sapi/qtexttospeech_sapi.h
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Speech module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTEXTTOSPEECHENGINE_SAPI_H
+#define QTEXTTOSPEECHENGINE_SAPI_H
+
+#include <windows.h>
+#include <sapi.h>
+#include <sphelper.h>
+
+#include <QtCore/qobject.h>
+#include <QtCore/qvector.h>
+#include <QtCore/qstring.h>
+#include <QtCore/qlocale.h>
+#include <QtTextToSpeech/qtexttospeechengine.h>
+#include <QtTextToSpeech/qvoice.h>
+
+QT_BEGIN_NAMESPACE
+
+class QTextToSpeechEngineSapi : public QTextToSpeechEngine, public ISpNotifyCallback
+{
+ Q_OBJECT
+
+public:
+ QTextToSpeechEngineSapi(const QVariantMap &parameters, QObject *parent);
+ ~QTextToSpeechEngineSapi();
+
+ // Plug-in API:
+ QVector<QLocale> availableLocales() const Q_DECL_OVERRIDE;
+ QVector<QVoice> availableVoices() const Q_DECL_OVERRIDE;
+ void say(const QString &text) Q_DECL_OVERRIDE;
+ void stop() Q_DECL_OVERRIDE;
+ void pause() Q_DECL_OVERRIDE;
+ void resume() Q_DECL_OVERRIDE;
+ double rate() const Q_DECL_OVERRIDE;
+ bool setRate(double rate) Q_DECL_OVERRIDE;
+ double pitch() const Q_DECL_OVERRIDE;
+ bool setPitch(double pitch) Q_DECL_OVERRIDE;
+ QLocale locale() const Q_DECL_OVERRIDE;
+ bool setLocale(const QLocale &locale) Q_DECL_OVERRIDE;
+ int volume() const Q_DECL_OVERRIDE;
+ bool setVolume(int volume) Q_DECL_OVERRIDE;
+ QVoice voice() const Q_DECL_OVERRIDE;
+ bool setVoice(const QVoice &voice) Q_DECL_OVERRIDE;
+ QTextToSpeech::State state() const Q_DECL_OVERRIDE;
+
+ HRESULT STDMETHODCALLTYPE NotifyCallback(WPARAM /*wParam*/, LPARAM /*lParam*/);
+private:
+
+ void init();
+ bool isSpeaking() const;
+ bool isPaused() const { return m_pauseCount; }
+ QMap<QString, QString> voiceAttributes(ISpObjectToken *speechToken) const;
+ QString voiceId(ISpObjectToken *speechToken) const;
+ QLocale lcidToLocale(const QString &lcid) const;
+ void updateVoices();
+
+ QTextToSpeech::State m_state;
+ QVector<QLocale> m_locales;
+// QLocale m_currentLocale;
+ QVoice m_currentVoice;
+ // Voices mapped by their locale name.
+ QMultiMap<QString, QVoice> m_voices;
+
+ ISpVoice *m_voice;
+ double m_pitch;
+ int m_pauseCount;
+};
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/tts/sapi/qtexttospeech_sapi_plugin.cpp b/src/plugins/tts/sapi/qtexttospeech_sapi_plugin.cpp
new file mode 100644
index 0000000..a269fae
--- /dev/null
+++ b/src/plugins/tts/sapi/qtexttospeech_sapi_plugin.cpp
@@ -0,0 +1,44 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Speech module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qtexttospeech_sapi_plugin.h"
+#include "qtexttospeech_sapi.h"
+
+QTextToSpeechEngine *QTextToSpeechPluginSpeechd::createTextToSpeechEngine(const QVariantMap &parameters, QObject *parent, QString *errorString) const
+{
+ Q_UNUSED(errorString)
+ return new QTextToSpeechEngineSapi(parameters, parent);
+}
diff --git a/src/plugins/tts/sapi/qtexttospeech_sapi_plugin.h b/src/plugins/tts/sapi/qtexttospeech_sapi_plugin.h
new file mode 100644
index 0000000..1c8a03d
--- /dev/null
+++ b/src/plugins/tts/sapi/qtexttospeech_sapi_plugin.h
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Speech module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QTEXTTOSPEECHPLUGIN_SAPI_H
+#define QTEXTTOSPEECHPLUGIN_SAPI_H
+
+#include <QtCore/QObject>
+#include <QtCore/QLoggingCategory>
+#include <QtTextToSpeech/qtexttospeechplugin.h>
+#include <QtTextToSpeech/qtexttospeechengine.h>
+
+QT_BEGIN_NAMESPACE
+
+class QTextToSpeechPluginSpeechd : public QObject, public QTextToSpeechPlugin
+{
+ Q_OBJECT
+ Q_INTERFACES(QTextToSpeechPlugin)
+ Q_PLUGIN_METADATA(IID "org.qt-project.qt.speech.tts.plugin/5.0"
+ FILE "sapi_plugin.json")
+
+public:
+ QTextToSpeechEngine *createTextToSpeechEngine(
+ const QVariantMap &parameters,
+ QObject *parent,
+ QString *errorString) const;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/tts/sapi/sapi.pro b/src/plugins/tts/sapi/sapi.pro
new file mode 100644
index 0000000..3d90e4f
--- /dev/null
+++ b/src/plugins/tts/sapi/sapi.pro
@@ -0,0 +1,19 @@
+TARGET = qtexttospeech_speechd
+PLUGIN_TYPE = texttospeech
+PLUGIN_CLASS_NAME = QTextToSpeechPluginSapi
+
+load(qt_plugin)
+
+QT += core texttospeech
+
+HEADERS += \
+ qtexttospeech_sapi.h \
+ qtexttospeech_sapi_plugin.h \
+
+SOURCES += \
+ qtexttospeech_sapi.cpp \
+ qtexttospeech_sapi_plugin.cpp \
+
+OTHER_FILES += \
+ sapi_plugin.json \
+ sapi_plugin.json
diff --git a/src/plugins/tts/sapi/sapi_plugin.json b/src/plugins/tts/sapi/sapi_plugin.json
new file mode 100644
index 0000000..84e1e48
--- /dev/null
+++ b/src/plugins/tts/sapi/sapi_plugin.json
@@ -0,0 +1,6 @@
+{
+ "Keys": ["sapi"],
+ "Provider": "sapi",
+ "Version": 100,
+ "Features": []
+}
diff --git a/src/plugins/tts/tts.pro b/src/plugins/tts/tts.pro
index fd333c0..109d17a 100755..100644
--- a/src/plugins/tts/tts.pro
+++ b/src/plugins/tts/tts.pro
@@ -7,6 +7,8 @@ unix {
}
}
+windows: SUBDIRS += sapi
+
config_flite {
SUBDIRS += flite
}