Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Alsamixer mutes HDMI when player starts
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
Yuriy Skvortsov
n00b
n00b


Joined: 30 Dec 2012
Posts: 32
Location: Odessa, Ukraine

PostPosted: Wed Jan 09, 2013 1:50 pm    Post subject: Alsamixer mutes HDMI when player starts Reply with quote

Hi!

I'm trying to set up audio at Gentoo on Dell Inspiron 7720. Audio interface Intel HDA, codec Intel PantherPoint HDMI at hw0,3. In-kernel driver snd_hda_codec_hdmi.
My problem is that when I start aplay or mplayer, the "S/PDIF" control in alsamixer, which is responsible for HDMI muting magically mutes even though I've unmuted it before. Therefore the only way I could get the HDMI sound working is unmuting S/PDIF control EVERY time AFTER I start a playback. That behavior is really weird and I have no much idea about its reasons. Also I can not find enough information about this. Could you recommend me any good documentation on this topic?
Back to top
View user's profile Send private message
wcg
Guru
Guru


Joined: 06 Jan 2009
Posts: 588

PostPosted: Wed Jan 09, 2013 5:05 pm    Post subject: Reply with quote

First thing: look at /etc/conf.d/alsasound

Beyond that, I don't have a hdmi system so have no experience
with any quirks related to enabling/disabling hdmi sound.
(That you get sound by manually unmuting it in alsamixer
is reason for optimism, though.)
_________________
TIA
Back to top
View user's profile Send private message
Yuriy Skvortsov
n00b
n00b


Joined: 30 Dec 2012
Posts: 32
Location: Odessa, Ukraine

PostPosted: Wed Jan 09, 2013 9:45 pm    Post subject: Reply with quote

Currently I use ~/.asoundrc which overrides /etc/conf.d/alsasound and for HDMI configuration contains:
Code:

defaults.pcm.card 0
defaults.pcm.device 3
defaults.ctl.card 0

Where card 0 is my only card (as /proc says) and device 3 is my HDMI output (according to /proc and aplay -l)
Back to top
View user's profile Send private message
wcg
Guru
Guru


Joined: 06 Jan 2009
Posts: 588

PostPosted: Thu Jan 10, 2013 2:04 pm    Post subject: Reply with quote

These are the settings in /etc/conf.d/alsasound to check:
Code:

RESTORE_ON_START="yes"
SAVE_ON_STOP="yes"

Then check to see if /etc/init.d/alsasound is registered with rc-update
to run at boot:
Code:

rc-update show | grep alsasound

If you get no output from the last command (and if
/etc/conf.d/alsasound and /etc/init.d/alsasound actually
exist), use this command to register alsasound with
rc-update:
Code:

rc-update add alsasound boot

Unmute the sound device manually with alsamixer, then
run
Code:

/etc/init.d/alsasound start
/etc/init.d/alsasound save

Now alsasound should automatically save your current
sound device mixer settings at shutdown and automatically
restore them at boot.

The /etc/conf.d/alsasound and /etc/init.d/alsasound files
are installed by the "=media-sound/alsa-utils-[version]"
package.
Code:

less /etc/init.d/alsasound

will show you what commands the init script supports.
_________________
TIA
Back to top
View user's profile Send private message
Yuriy Skvortsov
n00b
n00b


Joined: 30 Dec 2012
Posts: 32
Location: Odessa, Ukraine

PostPosted: Thu Jan 10, 2013 5:12 pm    Post subject: Reply with quote

Dear wcg,

Thank you for detailed answer but I generally have no problems with saving/restoring alsamixer settings on reboot except of the one "S/PDIF" setting responsible for HDMI muting. It mutes on every start of any player and, yes, on every reboot.
Even though I've double-checked the state you've mentioned and yes, I do have exactly the two lines in /etc/conf.d/alsasound
Code:

RESTORE_ON_START="yes"
SAVE_ON_STOP="yes"

And I have alsasound in my boot runlevel. Nevertheless, S/PDIF mute state is not restored after reboot and is cleared on every player start. Manual /etc/init.d/alsasound save makes no difference.
Back to top
View user's profile Send private message
wcg
Guru
Guru


Joined: 06 Jan 2009
Posts: 588

PostPosted: Sat Jan 12, 2013 3:53 pm    Post subject: Reply with quote

Ok, these were the obvios possible causes (not saving mixer settings
on stop and restoring on start, alsasound not added to boot scripts by
rc-update, etc).

If no one recognizes the problem as some known issue,
you could check Gentoo's Bugzilla for hdmi problems
reported against alsa-utils ( https://bugs.gentoo.org/ ).
(Since /etc/init.d/alsasound is installed by alsa-utils,
I would assume that this is the package context
in which the problem would be reported.)

If you want to file your own bug report:
http://www.gentoo.org/doc/en/bugzilla-howto.xml

edit:
Something you could try:

The file where the settings are saved is a text file.
On my system it is
Code:

/var/lib/alsa/asound.state



Set the volume on the s/pdif channel to 0 in alsamixer.
Run
Code:

/etc/init.d/alsasound save


Copy the asound.state file to ~/asound.state.spdif_0volume

Set the s/pdif volume in alsamixer to wherever you
usually set it for use. Run
Code:

/etc/init.d/alsasound save

again.

Copy the asound.state file to ~/asound.state.spdif_+volume.

Then diff the two saved asound.state files against each other.

Are they different? (They should be.)

After a reboot, diff them against the /var/lib/alsa/asound.state file.

(If it is an actual mute switch on/off problem rather than
a volume 0/nonzero problem, then adjust your saves and diff
accordingly, ie check the asound.state files with and withtout
the mute switch set after an interactive save and after a reboot.)

(I don't know how this will help you fix the problem, but it clarifies
the problem for anyone looking closer at it.)
_________________
TIA


Last edited by wcg on Mon Jan 14, 2013 7:16 pm; edited 1 time in total
Back to top
View user's profile Send private message
wcg
Guru
Guru


Joined: 06 Jan 2009
Posts: 588

PostPosted: Sun Jan 13, 2013 11:16 am    Post subject: Reply with quote

There is one other bit of information someone debugging this
problem might require. If the problem is that the system
boots with the alsa sound device actually muted with
the mute switch rather than with the volume set to
0, is only iec958 (s/pdif) muted, or is the master volume
muted? (Or are the output channels muted across the
board?)

Likewise for volume 0 if that is the problem: is it only
that one channel that is zeroed at boot, or is it only
the master volume, or is it all ouputs?

Could some meta- sound device manager that runs
as a boot daemon or desktop plugin be muting or
zeroing the volume of the default sound device at
boot? I do not know what all you run that is sound-related.

(I do not run anything like that, and the system boots
with the alsa sound device at whatever mixer settings
it shut down with.)
_________________
TIA
Back to top
View user's profile Send private message
Yuriy Skvortsov
n00b
n00b


Joined: 30 Dec 2012
Posts: 32
Location: Odessa, Ukraine

PostPosted: Sun Jan 13, 2013 10:14 pm    Post subject: Reply with quote

Ok, here is my latest observation.
First of all I'll put here a list of settings I have in alsamixer:
Master (volume/mute), Headphone (volume/mute), Speaker (volume/mute), PCM (volume), Mic Jack Mode (mic-line switch), S/PDIF (mute)

Generally, most of settings stay constant during reboot and player launch, but two settings do not: S/PDIF switch goes muted and Headphone volume goes 100%. More interestingly, it happens even when I shut down alsamixer! E.g. I start up alsamixer, set S/PDIF unmuted and Headphone volume 50%, exit and start it again - this two settings are again same - S/PDIF muted, Headphone volume 100%.

I saved alsa configuration in S/PDIF muted and unmuted states - the only difference is true/false value in IEC958 Playback Switch, as it should be.

Ok, now I start alsamixer once again, S/PDIF is muted, as always. From another console I restore the unmuted settings - it unmutes in alsamixer. Of course it goes off on the next alsamixer restart.

One more experiment. I start alsamixer in one console, unmute S/PDIF and then start one more alsamixer in second console. And what do you think? - the moment I start the second alsamixer S/PDIF gets muted! And yes, /var/lib/alsa/asound.state shows unmuted state all way long, so it is definetly not its fault.

It seems that S/PDIF mutes whenever starts anything that uses alsa libraries and this is not concerned with restoring the wrong settings from the file.
Also I don't have any top-layer audio-controlling software (or at least I'm not aware of that).
Back to top
View user's profile Send private message
Yuriy Skvortsov
n00b
n00b


Joined: 30 Dec 2012
Posts: 32
Location: Odessa, Ukraine

PostPosted: Sun Jan 13, 2013 10:22 pm    Post subject: Reply with quote

Here are my loaded daemons:

$ sudo rc-update -v | grep default
acpid | default
bumblebee | default
consolefont | default
local | default
netmount | default
ntpd | default
sshd | default
syslog-ng | default
transmission-daemon | default
udev-postmount | default
vixie-cron | default
wicd | default

$ sudo rc-update -v | grep boot
alsasound | boot
bootmisc | boot
fsck | boot
hostname | boot
hwclock | boot
keymaps | boot
localmount | boot
lvm | boot
modules | boot
mtab | boot
net.lo | boot
procfs | boot
root | boot
swap | boot
swapfiles | boot
sysctl | boot
termencoding | boot
tmpfiles.setup | boot
urandom | boot

Nothing suspicious.. At least seems so.
Back to top
View user's profile Send private message
wcg
Guru
Guru


Joined: 06 Jan 2009
Posts: 588

PostPosted: Mon Jan 14, 2013 9:10 pm    Post subject: Reply with quote

What an interesting problem: "if you touch it, it mutes the iec958 channel".

(I idly wondered if one could hack around it with alsaequal, but that
would not really find the bug, just kludge around it.)

I wonder if you could force it unmuted at start with configuration code
in ~/.asoundrc.

Taking a brief tour in Google to see if this is a known problem,
I came upon this report of a patch for alsa from 2009:
Quote:

ALSA: hda: add HP automute support to Intel ALC889/ALC889A models

It auto mutes all 8-channel outputs at rear panel when
the front panel headphone is connected.


Does alsa think your headphones are connected when alsamixer,
aplay, or mplayer starts? Are they? Is the headphone connector
electrically shorted? Do headphones actually work when connected
to the headphone jack? (And so on.)
_________________
TIA


Last edited by wcg on Tue Jan 15, 2013 2:56 am; edited 1 time in total
Back to top
View user's profile Send private message
Yuriy Skvortsov
n00b
n00b


Joined: 30 Dec 2012
Posts: 32
Location: Odessa, Ukraine

PostPosted: Mon Jan 14, 2013 10:38 pm    Post subject: Reply with quote

Hmm.. I've just installed evince which, I guess, pulled by dependencies Pulseaudio. I never understood it but, ok, now its here. Things in alsamixer got totally messed up (there is just one playback control) and I've got the "fancy" pavucontrol. It seems that it provides some obscure abstraction over ALSA but.. ok, ok - I'll give it a chance. But I don't like it anyway.
Back to top
View user's profile Send private message
wcg
Guru
Guru


Joined: 06 Jan 2009
Posts: 588

PostPosted: Tue Jan 15, 2013 3:24 am    Post subject: Reply with quote

pulseaudio was not an evince dependency for me. Perhaps it results
from an interaction between some USE flag that you have set globally
and some other dependency of evince (I could not find any
mention of pulseaudio in any of the evince ebuilds, but it could
be in poppler, libspectre, etc).

I'm not saying the headphone thing is definitely it
(that patch was for some intel boards, you may or may
not have an alc889/889a codec, etc), that simply seems
like the kind of problem it could be. Somenone could have
patched alsa to make that automute feature available on
multiple (or all) platforms, and your Dell laptop might
support that behavior. A feature to automute the back
panel outputs under certain conditions seems suspiciously
similar to the behavior you are seeing when you start
a process that accesses the alsa drivers.

That IEC958 Playback Switch seems a likely candidate for
overriding automatic detection in ~/.asoundrc and forcing
iec958 unmuted anytime you access the alsa drivers,
without the additional complication of the alsaequal
plugin. Alsa supposedly reads /etc/asound.conf and
~/.asoundrc on any access by a new process to the alsa
devices.
_________________
TIA
Back to top
View user's profile Send private message
Yuriy Skvortsov
n00b
n00b


Joined: 30 Dec 2012
Posts: 32
Location: Odessa, Ukraine

PostPosted: Tue Jan 15, 2013 5:39 pm    Post subject: Reply with quote

OMG, I've just reemerged world with -pulseaudio flag and the problem is magically gone. I can bet I did not emerge pulseaudio before but obviously some piece of it somehow leaked in.. I'll perform some more tests soon and probably mark this thread solved.

Dear wcg, thank you very much for your efforts! I've learned several useful things about ALSA during this discussion.
Back to top
View user's profile Send private message
wcg
Guru
Guru


Joined: 06 Jan 2009
Posts: 588

PostPosted: Wed Jan 16, 2013 5:38 am    Post subject: Reply with quote

De nada.

Better an issue that can be resolved simply by unmerging
something than, "My laptop is broken."
_________________
TIA
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum