LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 01-19-2016, 10:57 AM   #1
cgorac
Member
 
Registered: Oct 2009
Posts: 146

Rep: Reputation: 87
PulseAudio and volume buttons


(I've asked about this on the other thread, but it get buried into other topics discussed there, so I hope it's OK to start a new thread specifically about this problem.)

So let's say I start from vanilla PulseAudio setup from -current, and I want make my volume buttons, more precisely just mute button, work. So I run "acpi_listen" and press mute button, and the output is as follows:
Code:
button/mute MUTE 00000080 00000000 K
Then I run "pamixer --list-sinks" and the output is as follows:
Code:
Sinks:
0 "alsa_output.pci-0000_01_00.1.hdmi-stereo" "GF106 High Definition Audio Controller Digital Stereo (HDMI)"
1 "alsa_output.pci-0000_00_1b.0.analog-stereo" "Built-in Audio Analog Stereo"
So I create /etc/acpi/events/vol-m file, and I put following in:
Code:
event=button/mute
action=pamixer --sink 1 -t
Then I restart ACPI daemon through "/etc/rc.d/rc.acpid restart". I try to press mute button several times, and it seems to be working, as LED showing mute status goes on and back off as expected.

Now I open say Firefox, logged under X as an ordinary user, and start playing some video on YouTube. At some point, I want to mute sound, and I press mute button, but nothing happens - the sound doesn't get muted, and mute button LED indicator doesn't change its status. When I run "pamixer --list-sinks" again, only sink #0 from above appears in the list.

So my question is: is PulseAudio supposed to "grab" sound device for single user, and how to make volume buttons to work in this scenario?

Thanks.
 
Old 01-19-2016, 11:32 AM   #2
GazL
LQ Veteran
 
Registered: May 2008
Posts: 7,134

Rep: Reputation: 5286Reputation: 5286Reputation: 5286Reputation: 5286Reputation: 5286Reputation: 5286Reputation: 5286Reputation: 5286Reputation: 5286Reputation: 5286Reputation: 5286
Pulseaudio seems to be designed around a user-switching philosophy rather than a true multi-user concurrent-running design. Each user gets their own server, and access to a set of sinks, and it seems that only one user can use/control the underlying alsa device attached to a sink at any one time. I believe that under Lennart and the freedesktop.org guy's grand design console-kit is supposed to suspend/resume these as you swap between users, and I suspect the concept of concurrent users never occurred to them!

I've been playing with a pulse configuration using a shared 'dmix' backend, which I've got mostly working, and that setup allows for what you're looking to do, but I'm still testing and working through some oddities I've been encountering with it (duplicate sinks created by udev and the pulseaudio server daemon failing to start on some random occasions being just two of them). It also increases the CPU overhead involved, so its not without its own drawbacks (which is a big issue for me because this box is really old and already under strain).

If I manage to get it stable I'll post more on the subject.
 
Old 01-19-2016, 11:44 AM   #3
ppr:kut
Slackware Contributor
 
Registered: Aug 2006
Location: Netherlands
Distribution: Slackware
Posts: 633

Rep: Reputation: 467Reputation: 467Reputation: 467Reputation: 467Reputation: 467
I googled "pulseaudio volume keys" and found this arch forum page. It suggests (a bit further down in the page) using this:

Code:
vol_up: amixer -D pulse sset Master 5+
vol_down: amixer -D pulse sset Master 5%-
mute_toggle: amixer -D pulse sset Master toggle
Seems to work fine here.
 
Old 01-19-2016, 11:50 AM   #4
K4rolis
LQ Newbie
 
Registered: Jan 2016
Posts: 23

Rep: Reputation: Disabled
I know this might be naive, but have you considered using your DE's (or WM's) utilities to map the key? I do realise that it would not work in TTY, but if you spend most of your time in X, this would be a painless solution.

Last edited by K4rolis; 01-19-2016 at 11:52 AM.
 
Old 01-19-2016, 02:30 PM   #5
cgorac
Member
 
Registered: Oct 2009
Posts: 146

Original Poster
Rep: Reputation: 87
@GazL: Thanks for the clarification!

@ppr:kut: This doesn't work, for the reason I described in my initial post: once when an ordinary user starts playing something, root doesn't see the sound card any more.

@K4rolis: Thanks, that actually works. FWIW, I've put following in <keyboard> section of my rc.xml file for Openbox:
Code:
  <keybind key="XF86AudioRaiseVolume">
    <action name="Execute">
      <execute>pamixer --sink 1 -i 5</execute>
    </action>
  </keybind>
  <keybind key="XF86AudioLowerVolume">
    <action name="Execute">
      <execute>pamixer --sink 1 -d 5</execute>
    </action>
  </keybind>
  <keybind key="XF86AudioMute">
    <action name="Execute">
      <execute>pamixer --sink 1 -t</execute>
    </action>
  </keybind>
I think now I'll keep PA running for while... I really tried hard over past couple days to swallow it: it's obvious that the decision to add it to Slackware will never be reverted, and also it's probably that down the road more and more programs won't work without it, so I guess it's easier to just swallow it now. I also tried to find whatever is to like - as mentioned in my other post, I kind of like how the code looks, as well as the config files format. But things like those that @GazL mentioned really makes one wonder where this urge to make things in Linux world "modern and relevant" will take us all...

Last edited by cgorac; 01-19-2016 at 03:04 PM.
 
Old 01-19-2016, 02:55 PM   #6
K4rolis
LQ Newbie
 
Registered: Jan 2016
Posts: 23

Rep: Reputation: Disabled
Quote:
Originally Posted by cgorac View Post
@GazL: Thanks for the clarification!

@ppr:kut: This doesn't work, for the reason I described in my initial post: once when an ordinary user starts playing something, root doesn't see the sound card any more.

@K4rolis: Thanks, that actually works. FWIW, I've put following in <keyboard> section of my rc.xml file for Openbox:
Code:
  <keybind key="XF86AudioRaiseVolume">
    <action name="Execute">
      <execute>pamixer --sink 1 -u 5</execute>
    </action>
  </keybind>
  <keybind key="XF86AudioLowerVolume">
    <action name="Execute">
      <execute>pamixer --sink 1 -d 5</execute>
    </action>
  </keybind>
  <keybind key="XF86AudioMute">
    <action name="Execute">
      <execute>pamixer --sink 1 -t</execute>
    </action>
  </keybind>
I think now I'll keep PA running for while... I really tried hard over past couple days to swallow it: it's obvious that the decision to add it to Slackware will never be reverted, and also it's probably that down the road more and more programs won't work without it, so I guess it's easier to just swallow it now. I also tried to find whatever is to like - as mentioned in my other post, I kind of like how the code looks, as well as the config files format. But things like those that @GazL mentioned really makes one wonder where this urge to make things in Linux world "modern and relevant" will take us all...
FYI, you've got a typo in your XF86AudioRaiseVolume mapping - it should be -i rather than -u.
 
Old 01-19-2016, 03:03 PM   #7
cgorac
Member
 
Registered: Oct 2009
Posts: 146

Original Poster
Rep: Reputation: 87
Quote:
Originally Posted by K4rolis View Post
FYI, you've got a typo in your XF86AudioRaiseVolume mapping - it should be -i rather than -u.
Thanks - I've just noticed it too, and was going to fix it. Moreover, I've added:
Code:
set-default-sink alsa_output.pci-0000_00_1b.0.analog-stereo
at the end of my /etc/pulse/default.pa file, so that "--sink 1" is not needed any more as an argument to pamixer call.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Pulseaudio and storing volume between reboots af7567 Slackware 10 01-18-2016 06:33 AM
PulseAudio Volume Control Question... rnturn Linux - Software 3 11-18-2014 01:21 PM
Gnome and Pulseaudio - Some applications start with volume muted anon112 Linux - Software 0 05-12-2013 07:45 PM
Difference between Fedora and Ubuntu (pulseaudio) volume controls ordealbyfire83 Linux - Software 1 05-16-2011 08:15 PM
LXer: EarCandy is a Smart PulseAudio Volume Manager LXer Syndicated Linux News 0 05-22-2009 09:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 03:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration