From cd71055f14b70284d8bd3eb35fadc15b36ba0780 Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Mon, 13 Feb 2012 21:16:59 +0100 Subject: use PulseAudio instead of QAudioDevice --- fmrxcontrol.cpp | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'fmrxcontrol.cpp') diff --git a/fmrxcontrol.cpp b/fmrxcontrol.cpp index 8116021..a3c21b5 100644 --- a/fmrxcontrol.cpp +++ b/fmrxcontrol.cpp @@ -7,6 +7,7 @@ FmRxControl::FmRxControl(FmRxService *parent) : connect(m_service, SIGNAL(started()), this, SLOT(handleStarted())); connect(m_service, SIGNAL(stopped()), this, SLOT(handleStopped())); connect(m_service, SIGNAL(tuned(double)), this, SLOT(handleTuned(double))); + connect(m_service, SIGNAL(signalLevelChanged(ushort)), this, SLOT(handleSignalLevelChanged(ushort))); } bool FmRxControl::isAvailable() const @@ -48,6 +49,7 @@ int FmRxControl::frequency() const int FmRxControl::frequencyStep(QRadioTuner::Band b) const { + // 0.1 Mhz return 100 * 1000; } @@ -66,7 +68,8 @@ void FmRxControl::setFrequency(int frequency) bool FmRxControl::isStereo() const { - return true; // TODO + // The driver does not support reporting this + return true; } QRadioTuner::StereoMode FmRxControl::stereoMode() const @@ -81,16 +84,17 @@ void FmRxControl::setStereoMode(QRadioTuner::StereoMode mode) int FmRxControl::signalStrength() const { - return 0; // TODO + return convertSignalLevel(m_service->signalLevel()); } int FmRxControl::volume() const { - return 100; // Best not to have volume control in Harmattan. + return 100; // See comment in setVolume } void FmRxControl::setVolume(int volume) { - // Best not to have volume control in Harmattan. + // It is IMHO best not to have a separate volume control in Harmattan. + Q_UNUSED(volume); } bool FmRxControl::isMuted() const @@ -100,17 +104,20 @@ bool FmRxControl::isMuted() const void FmRxControl::setMuted(bool muted) { - // Best not to have volume control in Harmattan. + // Set comment in setVolume + Q_UNUSED(muted); } bool FmRxControl::isSearching() const { + // Searches are quite fast. return false; } void FmRxControl::cancelSearch() { - // TODO + // I am not sure this driver supports cancelling a search. + qWarning("FmRxControl: cannot cancel a search"); } void FmRxControl::searchForward() @@ -143,6 +150,11 @@ QString FmRxControl::errorString() const return QString(); } +int FmRxControl::convertSignalLevel(int v4l_level) +{ + return (v4l_level * 100) / 65535; +} + void FmRxControl::handleStarted() { emit stateChanged(QRadioTuner::ActiveState); @@ -157,3 +169,8 @@ void FmRxControl::handleTuned(double frequency) { emit frequencyChanged(frequency * 1000000.0); } + +void FmRxControl::handleSignalLevelChanged(ushort level) +{ + emit signalStrengthChanged(convertSignalLevel(level)); +} -- cgit v1.2.3