Commit 4bb161b8 authored by Lorenz Meier's avatar Lorenz Meier

Fix beep API and unconnected slot

parent 41c25ff4
...@@ -65,6 +65,7 @@ GAudioOutput::GAudioOutput(QObject *parent) : QObject(parent), ...@@ -65,6 +65,7 @@ GAudioOutput::GAudioOutput(QObject *parent) : QObject(parent),
{ {
worker->moveToThread(thread); worker->moveToThread(thread);
connect(this, SIGNAL(textToSpeak(QString,int)), worker, SLOT(say(QString,int))); connect(this, SIGNAL(textToSpeak(QString,int)), worker, SLOT(say(QString,int)));
connect(this, SIGNAL(beepOnce()), worker, SLOT(beep()));
thread->start(); thread->start();
} }
...@@ -146,7 +147,6 @@ bool GAudioOutput::startEmergency() ...@@ -146,7 +147,6 @@ bool GAudioOutput::startEmergency()
// emergency = true; // emergency = true;
// // Beep immediately and then start timer // // Beep immediately and then start timer
// if (!muted) beep();
// emergencyTimer->start(1500); // emergencyTimer->start(1500);
// QTimer::singleShot(5000, this, SLOT(stopEmergency())); // QTimer::singleShot(5000, this, SLOT(stopEmergency()));
...@@ -174,13 +174,5 @@ bool GAudioOutput::stopEmergency() ...@@ -174,13 +174,5 @@ bool GAudioOutput::stopEmergency()
void GAudioOutput::beep() void GAudioOutput::beep()
{ {
if (!muted) emit beepOnce();
{
// FIXME: Re-enable audio beeps
// Use QFile to transform path for all OS
//QFile f(QCoreApplication::applicationDirPath() + QString("/files/audio/alert.wav"));
//qDebug() << "FILE:" << f.fileName();
//m_media->setCurrentSource(Phonon::MediaSource(f.fileName().toStdString().c_str()));
//m_media->play();
}
} }
...@@ -86,6 +86,7 @@ public slots: ...@@ -86,6 +86,7 @@ public slots:
signals: signals:
void mutedChanged(bool); void mutedChanged(bool);
bool textToSpeak(QString text, int severity = 1); bool textToSpeak(QString text, int severity = 1);
void beepOnce();
protected: protected:
bool muted; bool muted;
......
...@@ -136,6 +136,21 @@ void QGCAudioWorker::mute(bool mute) ...@@ -136,6 +136,21 @@ void QGCAudioWorker::mute(bool mute)
} }
} }
void QGCAudioWorker::beep()
{
// XXX beep beep
if (!muted)
{
// FIXME: Re-enable audio beeps
// Use QFile to transform path for all OS
//QFile f(QCoreApplication::applicationDirPath() + QString("/files/audio/alert.wav"));
//qDebug() << "FILE:" << f.fileName();
//m_media->setCurrentSource(Phonon::MediaSource(f.fileName().toStdString().c_str()));
//m_media->play();
}
}
bool QGCAudioWorker::isMuted() bool QGCAudioWorker::isMuted()
{ {
return this->muted; return this->muted;
......
...@@ -32,6 +32,9 @@ public slots: ...@@ -32,6 +32,9 @@ public slots:
/** @brief Say this text if current output priority matches */ /** @brief Say this text if current output priority matches */
void say(QString text, int severity = 1); void say(QString text, int severity = 1);
/** @brief Sound a single beep */
void beep();
protected: protected:
#if defined Q_OS_MAC && defined QGC_SPEECH_ENABLED #if defined Q_OS_MAC && defined QGC_SPEECH_ENABLED
//NSSpeechSynthesizer //NSSpeechSynthesizer
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment