Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
261dcf6e
Commit
261dcf6e
authored
Nov 24, 2010
by
pixhawk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Windows Speech SDK / SAPI support
parent
b6441150
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
312 additions
and
275 deletions
+312
-275
GAudioOutput.cc
src/GAudioOutput.cc
+311
-275
GAudioOutput.h
src/GAudioOutput.h
+1
-0
No files found.
src/GAudioOutput.cc
View file @
261dcf6e
...
...
@@ -41,11 +41,20 @@ This file is part of the QGROUNDCONTROL project
#endif
// Speech synthesis is only supported with MSVC compiler
#if _MSC_VER
2
#if _MSC_VER
// Documentation: http://msdn.microsoft.com/en-us/library/ee125082%28v=VS.85%29.aspx
#define _ATL_APARTMENT_THREADED
#include <atlbase.h>
//You may derive a class from CComModule and use it if you want to override something,
//but do not change the name of _Module
extern
CComModule
_Module
;
#include <atlcom.h>
#include <sapi.h>
using
System
;
using
System
.
Speech
.
Synthesis
;
//using System;
//using System.Speech.Synthesis;
#endif
#ifdef Q_OS_LINUX
...
...
@@ -83,6 +92,26 @@ emergency(false)
#ifdef Q_OS_LINUX
flite_init
();
#endif
#if _MSC_VER
ISpVoice
*
pVoice
=
NULL
;
if
(
FAILED
(
::
CoInitialize
(
NULL
)))
{
qDebug
(
"Creating COM object for audio output failed!"
);
}
else
{
HRESULT
hr
=
CoCreateInstance
(
CLSID_SpVoice
,
NULL
,
CLSCTX_ALL
,
IID_ISpVoice
,
(
void
**
)
&
pVoice
;);
if
(
SUCCEEDED
(
hr
)
)
{
hr
=
pVoice
->
Speak
(
L"Hello world"
,
0
,
NULL
);
pVoice
->
Release
();
pVoice
=
NULL
;
}
}
#endif
// Initialize audio output
m_media
=
new
Phonon
::
MediaObject
(
this
);
Phonon
::
AudioOutput
*
audioOutput
=
new
Phonon
::
AudioOutput
(
Phonon
::
MusicCategory
,
this
);
...
...
@@ -103,6 +132,13 @@ emergency(false)
}
}
GAudioOutput
::~
GAudioOutput
()
{
#ifdef _MSC_VER
::
CoUninitialize
();
#endif
}
bool
GAudioOutput
::
say
(
QString
text
,
int
severity
)
{
// TODO Add severity filter
...
...
src/GAudioOutput.h
View file @
261dcf6e
...
...
@@ -114,6 +114,7 @@ protected:
QTimer
*
emergencyTimer
;
private:
GAudioOutput
(
QObject
*
parent
=
NULL
);
~
GAudioOutput
();
};
#endif // AUDIOOUTPUT_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment