summaryrefslogtreecommitdiffstats
path: root/app/phone.cpp
diff options
context:
space:
mode:
authorScott Murray <scott.murray@konsulko.com>2019-01-16 19:44:28 -0500
committerScott Murray <scott.murray@konsulko.com>2019-01-17 21:47:28 -0500
commitfc00704eafd27305b9ca7e842b0321e0007d3154 (patch)
tree33920f5d07a122474d5187a41575627e4c4d3c2b /app/phone.cpp
parent9fcf22b389c92f3952769ae73750112d1417e5dc (diff)
Replace QtMultimedia usage for ringtone playing with a gstreamer pipeline that uses the provided 4A role ALSA device for output. For now, a "phone" role is assumed to be available, but it does not exist in the current set of 4A policy and HALs, and needs to be added. Testing was done by making the required role changes locally and using some debug QML tweaks to allow triggering the ringtone manually. Bug-AGL: SPEC-1596 Change-Id: I55c2229de1bc5470ee818e5be382b64664fa2d29 Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Diffstat (limited to 'app/phone.cpp')
-rw-r--r--app/phone.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/app/phone.cpp b/app/phone.cpp
index 254fe24..8e8edcd 100644
--- a/app/phone.cpp
+++ b/app/phone.cpp
@@ -16,18 +16,14 @@
#include <QDebug>
#include <QObject>
-#include <QSoundEffect>
#include <QTimer>
#include <telephony.h>
#include "phone.h"
-Phone::Phone(Telephony *telephony, QObject *parent) :
- QObject(parent)
+Phone::Phone(Telephony *telephony, FilePlayer *player, QObject *parent) :
+ QObject(parent),
+ m_ringtone(player)
{
- m_ringtone.setSource(QUrl("qrc:./Phone.wav"));
- m_ringtone.setVolume(0.5f);
- m_ringtone.setLoopCount(QSoundEffect::Infinite);
-
QObject::connect(telephony, &Telephony::callStateChanged, this, &Phone::onCallStateChanged);
m_call_timer.setInterval(1000);
@@ -38,15 +34,18 @@ Phone::Phone(Telephony *telephony, QObject *parent) :
void Phone::onCallStateChanged(QString callState)
{
if (callState == "disconnected") {
- m_ringtone.stop();
+ if (m_ringtone)
+ m_ringtone->stop();
m_call_timer.stop();
} else if (callState == "active") {
- m_ringtone.stop();
+ if (m_ringtone)
+ m_ringtone->stop();
m_date_time = m_date_time.fromSecsSinceEpoch(0);
setElapsedTime("00:00:00");
m_call_timer.start();
} else if (callState == "incoming") {
- m_ringtone.play();
+ if (m_ringtone)
+ m_ringtone->play(true);
}
}