[SailfishDevel] listening for volume change

jerome levreau levreau.jerome at vostoksystem.eu
Wed Oct 26 16:58:12 UTC 2016


hi everyone,

Here where I'm stuck : In my audio app, for a new functionality I would
like to control volume. Now I'm trying to get a response (dbus signal) when
user is changing volume with button (physical).
My app has mpris2 control, I monitoring a read to the volume property (of
org.mpris.MediaPlayer2.Player ) but never a write. I tried to look for a
propertiesChanged in org.freedesktop.DBus.Properties, I'm seeing response
in playback status, position, metadata, etc.. but never from volume change.

Right now, I'm looking into pulseaudio with com.meego.mainvolume2
https://wiki.merproject.org/wiki/Nemo/Audio/MainVolume

I connect to pulse, I read current volume (CurrentStep), I can see it's
changing between my tests, but my slot to the StepsUpdated signal never
been called.

Here my current code :

//******************************************

QDBusConnection bus = QDBusConnection::sessionBus();
QDBusMessage call = QDBusMessage::createMethodCall("org.PulseAudio1",

"/org/pulseaudio/server_lookup1",

"org.freedesktop.DBus.Properties",
                                                       "Get" );
call << "org.PulseAudio.ServerLookup1" << "Address";
QDBusReply<QDBusVariant> r = bus.call(call);

if (r.isValid()) {
        pulse = new QDBusConnection(QDBusConnection::connectToPeer(
                           r.value().variant().toString(),
"org.PulseAudio1"));

         //****** this is working ****
        call = QDBusMessage::createMethodCall("",
                                              "/com/meego/mainvolume2",

"org.freedesktop.DBus.Properties",
                                              "Get");
        call << "com.Meego.MainVolume2" << "CurrentStep";
        qDebug() << "CurrentStep : " <<
pulse->call(call).value().variant().toUInt();

//***** connect, but never raise a callback ****
//***** doing something similar with org.nemomobile.voicecall.VoiceCall and
it's working fine
         pulse->connect("",
                                   "/com/meego/mainvolume2",
                                   "com.Meego.MainVolume2",
                                   "StepsUpdated",
                                   this, SLOT(StepsUpdated(uint,uint)));
}

// *** my public slot code, never getting an answer
void modeNuitService::StepsUpdated(uint StepCount, uint CurrentStep) {
    qDebug() << "StepsUpdated " << StepCount << " " << CurrentStep;
}

//******************************************

What do you think ? bad argument, bad method signature  or just bad
solution ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20161026/5f7bae2c/attachment.html>


More information about the Devel mailing list