I am trying to write a basic volume application. Since I'm writing this in Ruby I don't want to extend the C library or use ffi
, instead I trying to write this with ruby-dbus
I got the Address
Property with /org/pulse_audio/server_lookup1
but the file the address points to doesn't exist. Is Pulse Audio properly configured for dbus
?
Asked
Active
Viewed 1.3k times
4

Christopher
- 639
- 1
- 6
- 14
2 Answers
10
Ubuntu ships Pulse Audio without D-Bus support. To enable it put the following line at the end of file /etc/pulse/default.pa
:
load-module module-dbus-protocol
Restart Pulse Audio:
pkill pulseaudio; pulseaudio
Solution found at pulseaudio-mixer-cli project which demonstrates how to use pulseaudio over D-Bus.

izidor
- 4,068
- 5
- 33
- 43
-
1I you want to make the configuration on a per user level, the files is `$HOME/.config/pulse/default.pa`. – con-f-use Apr 18 '17 at 11:44
-
This is still valid after the upgrade to Ubuntu 20 for people wondering if they need it. I accepted the config file overwrites during the upgrade and had to re-add it, indicating they still don't ship with the dbus module loaded – Mike Hardy Apr 26 '20 at 17:09
1
On my system (openSUSE 12.1), PA does point to an existing socket. This code (gist)
#! /usr/bin/env ruby
require 'rubygems'
require 'dbus'
b = DBus.session_bus
ps = b.service 'org.PulseAudio1'
po = ps.object '/org/pulseaudio/server_lookup1'
po.introspect
pi = po['org.PulseAudio.ServerLookup1']
a = pi['Address']
path = a.split('=').last
system 'stat', path
produces
$ ruby ~/snippets/dbus-pulseaudio.rb
File: `/home/mvidner/.pulse/7c5e87305bb28b5a0661f8180000054c-runtime/dbus-socket'
Size: 0 Blocks: 0 IO Block: 4096 socket
Device: 801h/2049d Inode: 1332590 Links: 1
Access: (0777/srwxrwxrwx) Uid: (11018/ mvidner) Gid: ( 100/ users)
Access: 2012-11-19 09:07:20.566053943 +0100
Modify: 2012-11-19 09:07:20.566053943 +0100
Change: 2012-11-19 09:07:20.566053943 +0100
Birth: -

Martin Vidner
- 2,307
- 16
- 31