Understanding audio routing and volume control on SFOS

Can someone point me into the right direction where to look for documentation on audio rouring and especially volume control on SFOS?

For what I understand after going through the files in /etc/pulse/ if my app wants to play audio to “sink.primary_output” I need to add a file like /etc/pulse/xpolicy.conf.d/s1p.conf

[stream]
name     = "s1p"
group    = call

This seems to work so far and the app is then able to access “sink.primary_output”
The only problem now is that the volume control on SFOS seems not to be aware of this fact and the volume rocker has no effect at all - which makes sense as it’s still trying to set “Ringtone” volume instead.

2 Likes

Not sure if this is useful, I stumbled on this some time back - pulseaudio-modules-droid
It has this mention “Communication profile used for VoIP-like applications…”

1 Like

Thank you, I will take a look at that.

Unfortunately this seems not to make any difference.

While I haven’t been able to make the volume rocker do anything useful I have been able to at least read (and successfully set) the VoIP volume over dbus:

Getting the PA socket:

dbus-send --print-reply --type=method_call --dest=org.PulseAudio1 /org/pulseaudio/server_lookup1 org.freedesktop.DBus.Properties.Get string:org.PulseAudio.ServerLookup1 string:Address
   variant       string "unix:path=/run/user/100000/pulse/dbus-socket"

With the address it’s possible to get the object path:

dbus-send --print-reply --type=method_call --address='unix:path=/run/user/100000/pulse/dbus-socket' --dest=org.PulseAudio1 /org/pulseaudio/stream_restore1 org.PulseAudio.Ext.StreamRestore1.GetEntryByName string:"sink-input-by-media-role:voip"

   object path "/org/pulseaudio/stream_restore1/entry12"

Having the object path it’s then possible to get the volume:

dbus-send --print-reply --type=method_call --address='unix:path=/run/user/100000/pulse/dbus-socket' --dest=org.PulseAudio1 /org/pulseaudio/stream_restore1/entry12 org.freedesktop.DBus.Properties.Get string:org.PulseAudio.Ext.StreamRestore1.RestoreEntry string:Volume

   variant       array [
         struct {
            uint32 0
            uint32 65535
         }
      ]

First uint32 seems to specify the channel:
0 = Mono
1 = Front left
2 = Front right

Second uint32 seems to specify the volume:
0-65535 = Volume

2 Likes