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
d53d5f88
Commit
d53d5f88
authored
Dec 09, 2014
by
Lorenz Meier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve audio output logic and consistency
parent
daefb0bd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
9 deletions
+22
-9
GAudioOutput.cc
src/GAudioOutput.cc
+1
-1
GAudioOutput.h
src/GAudioOutput.h
+13
-1
QGCAudioWorker.cpp
src/audio/QGCAudioWorker.cpp
+5
-4
UAS.cc
src/uas/UAS.cc
+3
-3
No files found.
src/GAudioOutput.cc
View file @
d53d5f88
...
...
@@ -107,7 +107,7 @@ bool GAudioOutput::say(QString text, int severity)
*/
bool
GAudioOutput
::
alert
(
QString
text
)
{
emit
textToSpeak
(
text
,
2
);
emit
textToSpeak
(
text
,
1
);
return
true
;
}
...
...
src/GAudioOutput.h
View file @
d53d5f88
...
...
@@ -58,12 +58,24 @@ public:
VOICE_FEMALE
}
QGVoice
;
enum
AUDIO_SEVERITY
{
AUDIO_SEVERITY_EMERGENCY
=
0
,
AUDIO_SEVERITY_ALERT
=
1
,
AUDIO_SEVERITY_CRITICAL
=
2
,
AUDIO_SEVERITY_ERROR
=
3
,
AUDIO_SEVERITY_WARNING
=
4
,
AUDIO_SEVERITY_NOTICE
=
5
,
AUDIO_SEVERITY_INFO
=
6
,
AUDIO_SEVERITY_DEBUG
=
7
};
/** @brief Get the mute state */
bool
isMuted
();
public
slots
:
/** @brief Say this text if current output priority matches */
bool
say
(
QString
text
,
int
severity
=
1
);
bool
say
(
QString
text
,
int
severity
=
6
);
/** @brief Play alert sound and say notification message */
bool
alert
(
QString
text
);
/** @brief Start emergency sound */
...
...
src/audio/QGCAudioWorker.cpp
View file @
d53d5f88
...
...
@@ -6,6 +6,7 @@
#include "QGC.h"
#include "QGCAudioWorker.h"
#include "GAudioOutput.h"
#if defined Q_OS_MAC && defined QGC_SPEECH_ENABLED
#include <ApplicationServices/ApplicationServices.h>
...
...
@@ -89,11 +90,12 @@ QGCAudioWorker::~QGCAudioWorker()
void
QGCAudioWorker
::
say
(
QString
text
,
int
severity
)
{
qDebug
()
<<
"TEXT"
<<
text
;
if
(
!
muted
)
{
// TODO Add severity filter
Q_UNUSED
(
severity
);
// Prepend high priority text with alert beep
if
(
severity
<
GAudioOutput
::
AUDIO_SEVERITY_CRITICAL
)
{
beep
();
}
// Wait for the last sound to finish
while
(
!
sound
->
isFinished
())
{
...
...
@@ -149,7 +151,6 @@ void QGCAudioWorker::beep()
{
// Use QFile to transform path for all OS
QFile
f
(
QCoreApplication
::
applicationDirPath
()
+
QString
(
"/files/audio/alert.wav"
));
qDebug
()
<<
"SOUND FILE:"
<<
f
.
fileName
();
sound
->
play
(
f
.
fileName
());
}
}
...
...
src/uas/UAS.cc
View file @
d53d5f88
...
...
@@ -333,7 +333,7 @@ void UAS::updateState()
connectionLost
=
true
;
receivedMode
=
false
;
QString
audiostring
=
QString
(
"Link lost to system %1"
).
arg
(
this
->
getUASID
());
GAudioOutput
::
instance
()
->
say
(
audiostring
.
toLower
());
GAudioOutput
::
instance
()
->
say
(
audiostring
.
toLower
()
,
GAudioOutput
::
AUDIO_SEVERITY_ALERT
);
}
// Update connection loss time on each iteration
...
...
@@ -347,7 +347,7 @@ void UAS::updateState()
if
(
connectionLost
&&
(
heartbeatInterval
<
timeoutIntervalHeartbeat
))
{
QString
audiostring
=
QString
(
"Link regained to system %1"
).
arg
(
this
->
getUASID
());
GAudioOutput
::
instance
()
->
say
(
audiostring
.
toLower
());
GAudioOutput
::
instance
()
->
say
(
audiostring
.
toLower
()
,
GAudioOutput
::
AUDIO_SEVERITY_NOTICE
);
connectionLost
=
false
;
connectionLossTime
=
0
;
emit
heartbeatTimeout
(
false
,
0
);
...
...
@@ -574,7 +574,7 @@ void UAS::receiveMessage(LinkInterface* link, mavlink_message_t message)
if
(
statechanged
&&
((
int
)
state
.
system_status
==
(
int
)
MAV_STATE_CRITICAL
||
state
.
system_status
==
(
int
)
MAV_STATE_EMERGENCY
))
{
GAudioOutput
::
instance
()
->
say
(
QString
(
"emergency for system %1"
).
arg
(
this
->
getUASID
()));
GAudioOutput
::
instance
()
->
say
(
QString
(
"emergency for system %1"
).
arg
(
this
->
getUASID
())
,
GAudioOutput
::
AUDIO_SEVERITY_EMERGENCY
);
QTimer
::
singleShot
(
3000
,
GAudioOutput
::
instance
(),
SLOT
(
startEmergency
()));
}
else
if
(
modechanged
||
statechanged
)
...
...
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