LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 05-02-2016, 06:32 AM   #1
coralfang
Member
 
Registered: Nov 2010
Location: Bristol, UK
Distribution: Slackware, FreeBSD
Posts: 836
Blog Entries: 3

Rep: Reputation: 297Reputation: 297Reputation: 297
Pulseaudio and USB headphones


I had a new pair of headphones in the post today, and they work fine on slackware without any fiddling.

However, i have to right click KMix and select the master channel as the USB device. I am wondering, is it possible to create a set up where the sound changes from speakers to headphones dynamically, as they are plugged in? I don't know the slightest thing about pulseaudio, other than it just seems to work with slackware-current since it's addition to the packages.

Example:
1. Playing music out of the speakers as normally.
2. Plug USB headphones in
3. Speakers become silent, and sound comes out of headphones.

At the moment, i have to manually switch the master channel using KMix. Is it possible to get this working??

PS; my speakers are using the standard audio output (they are not USB).
 
Old 05-02-2016, 06:54 AM   #2
coralfang
Member
 
Registered: Nov 2010
Location: Bristol, UK
Distribution: Slackware, FreeBSD
Posts: 836

Original Poster
Blog Entries: 3

Rep: Reputation: 297Reputation: 297Reputation: 297
Also i have another problem, where i can't seem to get any sound from firefox (sites like soundcloud or youtube) when setting the master channel to the USB headphones. I do get music playback from DeadBeef media player though.

Any ideas?

Headphones: https://www.amazon.co.uk/gp/product/...?ie=UTF8&psc=1

Device information if useful:
Code:
[24909.721495] usb 5-4: new full-speed USB device number 3 using ohci-pci
[24909.867788] usb 5-4: New USB device found, idVendor=0d8c, idProduct=0012
[24909.867796] usb 5-4: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[24909.867800] usb 5-4: Product: USB Audio Device
[24909.867804] usb 5-4: Manufacturer: C-Media Electronics Inc.
[24909.875825] input: C-Media Electronics Inc. USB Audio Device as /devices/pci0000:00/0000:00:13.0/usb5/5-4/5-4:1.3/0003:0D8C:0012.0008/input/input25
[24909.926737] hid-generic 0003:0D8C:0012.0008: input,hidraw7: USB HID v1.00 Device [C-Media Electronics Inc. USB Audio Device] on usb-0000:00:13.0-4/input3
[24910.089125] usbcore: registered new interface driver snd-usb-audio
Edit: The only workaround i've had for this is running pavucontrol and clicking the green button to set the USB headphones as fallback. But it feels awkward as when i unplug the headphones i have to do both of these things to get speaker playback again:

1. Open pavucontrol and set speakers as fallback output device
2. Right click KMix and set speakers as master channel

I have also tried adding
Code:
load-module module-switch-on-connect
to /etc/pulse/default.pa

which after searching online, apparently should enable headphone/speaker toggling, although it has no effect here.

Last edited by coralfang; 05-02-2016 at 07:09 AM.
 
Old 05-02-2016, 07:19 AM   #3
dab1414
Member
 
Registered: May 2011
Location: OK, USA
Distribution: Slackware 14.1_64
Posts: 76

Rep: Reputation: 52
You can try to set a udev rule, then point it to a script. Below are two links that may get you closer to your goal. It looks as though you might have to restart pulseaudio, since apparently applications already playing sound will not switch to new output. Possibly get the script to restart pulseaudio?

https://bbs.archlinux.org/viewtopic.php?id=137146
https://gist.github.com/dustywilson/8267078
 
Old 05-02-2016, 07:27 AM   #4
Nille_kungen
Member
 
Registered: Jul 2005
Distribution: Slackware64-current
Posts: 587

Rep: Reputation: 201Reputation: 201Reputation: 201
Is rc.pulseaudio executable or not?
If it's executable it won't work since pulseaudio is then started with --disallow-module-loading

Last edited by Nille_kungen; 05-02-2016 at 07:28 AM.
 
Old 05-02-2016, 08:49 AM   #5
coralfang
Member
 
Registered: Nov 2010
Location: Bristol, UK
Distribution: Slackware, FreeBSD
Posts: 836

Original Poster
Blog Entries: 3

Rep: Reputation: 297Reputation: 297Reputation: 297
Quote:
Originally Posted by Nille_kungen View Post
Is rc.pulseaudio executable or not?
If it's executable it won't work since pulseaudio is then started with --disallow-module-loading
Not currently, but i'll try that now and reboot and see if it works.

Edit; just tried this, but the headphones don't appear (both speaker and microphone) as neither input or output devices with pavucontrol. The moment i ran /etc/rc.d/rc.pulseaudio stop the USB devices appeared and worked again when manually switching the master channel with KMix.

Last edited by coralfang; 05-02-2016 at 09:05 AM.
 
Old 05-02-2016, 06:57 PM   #6
Andersen
Member
 
Registered: Dec 2008
Distribution: Slackware
Posts: 177

Rep: Reputation: 72
Every time I switch from speakers to headphones, I have to start pavucontrol to change configuration settings for built-in audio just to get sound back. That's pulseaudio, it makes more problems than it solves.
 
1 members found this post helpful.
Old 05-03-2016, 08:11 AM   #7
Nille_kungen
Member
 
Registered: Jul 2005
Distribution: Slackware64-current
Posts: 587

Rep: Reputation: 201Reputation: 201Reputation: 201
Quote:
Originally Posted by Andersen View Post
Every time I switch from speakers to headphones, I have to start pavucontrol to change configuration settings for built-in audio just to get sound back. That's pulseaudio, it makes more problems than it solves.
The thing is that /etc/rc.d/rc.pulseaudio shouldn't be executable (unless one really needs it which is very rare).
"chmod -x /etc/rc.d/rc.pulseaudio" and reboot is the best since stopping the script may not be enough.
If it's executable then it behaves as you described since i doesn't load any modules.
But i will agree to that "it makes more problems than it solves."

Last edited by Nille_kungen; 05-03-2016 at 08:55 AM.
 
1 members found this post helpful.
Old 05-03-2016, 10:14 AM   #8
slackartist
Member
 
Registered: Oct 2015
Location: Where the buffalo's roam
Distribution: Slackware Current Multilib
Posts: 161
Blog Entries: 20

Rep: Reputation: 26
I create a sound.rc file in home directory then usually it take leaving x11/logging off and back on to get that to switch from hdmi to headphones.

THere's probably certainly a better way but thinking it would be based this way..
 
Old 05-11-2016, 05:55 PM   #9
Andersen
Member
 
Registered: Dec 2008
Distribution: Slackware
Posts: 177

Rep: Reputation: 72
Quote:
Originally Posted by Nille_kungen View Post
The thing is that /etc/rc.d/rc.pulseaudio shouldn't be executable (unless one really needs it which is very rare).
"chmod -x /etc/rc.d/rc.pulseaudio" and reboot is the best since stopping the script may not be enough.
If it's executable then it behaves as you described since i doesn't load any modules.
But i will agree to that "it makes more problems than it solves."
I tried with chmod -x /etc/rc.d/rc.pulseaudio, but there was no change. Anyway, thanks for a suggestion.

I think I'm going to completely remove that piece of crap from my system.
 
Old 05-11-2016, 07:46 PM   #10
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
I think this person provides a very good walk-through on how to set it up.
 
2 members found this post helpful.
Old 05-11-2016, 07:51 PM   #11
Gordie
Member
 
Registered: Aug 2007
Location: Nolalu, Ontario, Canada
Distribution: Slackware64-Current
Posts: 871

Rep: Reputation: 364Reputation: 364Reputation: 364Reputation: 364
Could it possibly be a usb related problem rather than pulse audio? My phones use a plug and jack and work flawlessly. Haven't got a usb set to try
 
Old 05-12-2016, 05:02 PM   #12
Andersen
Member
 
Registered: Dec 2008
Distribution: Slackware
Posts: 177

Rep: Reputation: 72
Quote:
Originally Posted by Gordie View Post
Could it possibly be a usb related problem rather than pulse audio? My phones use a plug and jack and work flawlessly. Haven't got a usb set to try
Well, I don't have usb headphones, but I do have the problem.
 
  


Reply



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] current 14.2RC2 Pulseaudio and headphones Nille_kungen Slackware 10 04-24-2016 09:37 AM
My Headphones stopped working after install of Pulseaudio Duglas Linux - Software 5 08-28-2014 11:45 PM
Alsa PulseAudio only headphones not working master channel firedrake Slackware 7 07-20-2013 04:31 AM
[SOLVED] Squeeze + Pulseaudio + Alsa and USB Midi device causes Pulseaudio crash mad4linux Debian 1 01-26-2011 03:57 AM
USB Headphones SentralOrigin Linux - Hardware 3 10-27-2005 01:48 AM

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

All times are GMT -5. The time now is 11:45 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