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
17fae0a3
Commit
17fae0a3
authored
8 years ago
by
Don Gagne
Committed by
GitHub
8 years ago
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4404 from DonLakeFlyer/MacSpeech
Switch away from deprecated APIs
parents
0b451410
b6b222ba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
37 deletions
+17
-37
QGCAudioWorker.cpp
src/audio/QGCAudioWorker.cpp
+17
-37
No files found.
src/audio/QGCAudioWorker.cpp
View file @
17fae0a3
...
...
@@ -10,47 +10,27 @@
#if (defined __macos__) && defined QGC_SPEECH_ENABLED
#include <ApplicationServices/ApplicationServices.h>
#include <MacTypes.h>
static
SpeechChannel
sc
;
static
Fixed
volume
;
void
macSpeak
(
const
char
*
words
)
{
static
SpeechChannel
sc
=
NULL
;
static
void
speechDone
(
SpeechChannel
sc2
,
void
*
)
{
if
(
sc2
==
sc
)
{
DisposeSpeechChannel
(
sc
);
while
(
SpeechBusy
())
{
QGC
::
SLEEP
::
msleep
(
100
);
}
}
if
(
sc
==
NULL
)
{
Float32
volume
=
1.0
;
class
MacSpeech
{
public:
MacSpeech
()
{
setVolume
(
100
);
}
~
MacSpeech
()
{
}
void
say
(
const
char
*
words
)
{
while
(
SpeechBusy
())
{
QGC
::
SLEEP
::
msleep
(
100
);
}
NewSpeechChannel
(
NULL
,
&
sc
);
SetSpeechInfo
(
sc
,
soVolume
,
&
volume
);
SetSpeechInfo
(
sc
,
soSpeechDoneCallBack
,
reinterpret_cast
<
void
*>
(
speechDone
));
CFStringRef
cfstr
=
CFStringCreateWithCString
(
NULL
,
words
,
kCFStringEncodingUTF8
);
SpeakCFString
(
sc
,
cfstr
,
NULL
);
}
void
setVolume
(
int
v
)
{
volume
=
FixRatio
(
v
,
100
);
CFNumberRef
volumeRef
=
CFNumberCreate
(
NULL
,
kCFNumberFloat32Type
,
&
volume
);
SetSpeechProperty
(
sc
,
kSpeechVolumeProperty
,
volumeRef
);
CFRelease
(
volumeRef
);
}
};
//-- Singleton
MacSpeech
macSpeech
;
CFStringRef
strRef
=
CFStringCreateWithCString
(
NULL
,
words
,
kCFStringEncodingUTF8
);
SpeakCFString
(
sc
,
strRef
,
NULL
);
CFRelease
(
strRef
);
}
#endif
#if (defined __ios__) && defined QGC_SPEECH_ENABLED
...
...
@@ -154,7 +134,7 @@ void QGCAudioWorker::say(QString inText)
espeak_Synth
(
text
.
toStdString
().
c_str
(),
espeak_size
,
0
,
POS_CHARACTER
,
0
,
espeakCHARS_AUTO
,
NULL
,
NULL
);
espeak_Synchronize
();
#elif (defined __macos__) && defined QGC_SPEECH_ENABLED
macSpe
ech
.
say
(
text
.
toStdString
().
c_str
());
macSpe
ak
(
text
.
toStdString
().
c_str
());
#elif (defined __ios__) && defined QGC_SPEECH_ENABLED
iOSSpeak
(
text
);
#else
...
...
@@ -172,7 +152,7 @@ void QGCAudioWorker::mute(bool mute)
this
->
muted
=
mute
;
QSettings
settings
;
settings
.
setValue
(
QGC_GAUDIOOUTPUT_KEY
+
"muted"
,
this
->
muted
);
// emit mutedChanged(muted);
// emit mutedChanged(muted);
}
}
...
...
This diff is collapsed.
Click to expand it.
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