Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unpredictable results when getting mute state #7

Open
jcass77 opened this issue Feb 2, 2016 · 8 comments
Open

Unpredictable results when getting mute state #7

jcass77 opened this issue Feb 2, 2016 · 8 comments
Labels
C-bug Category: This is a bug

Comments

@jcass77
Copy link
Member

jcass77 commented Feb 2, 2016

I can't seem to get the mute/unmute functionality to work on my Raspberry Pi setup, using the latest versions of the Mopidy-Mobile and Mopidy-Musicbox-Webclient extensions.

The buttons do not respond when you click on them, and there is nothing in the logs.

Looking at the implementation of get_mute() I suspect that the method returns None for some reason but am not sure why.

Perhaps a first step would be to update the implementation so that all exceptions are propagated to core.mixer.MixerController so that they can be logged?

@jodal jodal added the C-bug Category: This is a bug label Feb 2, 2016
@jodal
Copy link
Member

jodal commented Feb 12, 2017

All catched alsaaudio.ALSAAudioError exceptions are logged at debug level. Can you see any trace of the supposed exceptions if you run Mopidy with debug logging on?

@jcass77
Copy link
Member Author

jcass77 commented Feb 13, 2017

I've run with mopidy --save-debug-log and nothing is output to the log when mopidy.mixer.getMute() is called.

Here's the full log file, just for the sake of completeness: mopidy-debug.log.txt.

If get_mute() is not raising an exception, then can it be that all channels do not have the same mute state, and how should this be configured differently?

def get_mute(self):
    try:
        channels_muted = self._mixer.getmute()
    except alsaaudio.ALSAAudioError as exc:
        logger.debug('Getting mute state failed: %s', exc)
        return None
    if all(channels_muted):
        return True
    elif not any(channels_muted):
        return False
    else:
        # Not all channels have the same mute state
        return None

@jcass77
Copy link
Member Author

jcass77 commented Feb 13, 2017

...I'm running Mopidy on a RaspberryPi B+ with MusicBox and a HiFiBerry Amp+ installed.

mopidy.config.txt
mopidy.deps.txt

@jcass77
Copy link
Member Author

jcass77 commented Feb 13, 2017

...and here's the relevant section of the MusicBox settings.ini file:

# ------------------
# | Audio Settings |
# ------------------
# Because of limitations with some USB-DACs, MusicBox downsamples USB sound to 44k by default. Set to false to disable.
downsample_usb = true

# Set default audio output. This overrides the automatic detection (which sets to usb audio if an usb audio device
# is found, else to hdmi (if hdmi is connected at boot), and otherwise just to the analog out).
# i2s cards (e.g. HifiBerry etc) are not detected automatically and must be explicitly set here.
# Options: analog, hdmi, usb, hifiberry_dac, hifiberry_digi, hifiberry_dacplus, hifiberry_amp, iqaudio_dac
output = hifiberry_amp

[audio]
# Set the startup volume of MusicBox
# Values: from 0 to 100
mixer_volume = 70

# --------------------------------------------------------------------------
# | OTHER Settings                                                         |
# | You probably don't want to edit the settings below this line. Really.  |
# | Unless you know what you're doing, or you want to change the webclient |
# --------------------------------------------------------------------------
# This sets the gstreamer buffer. It's a bit tricky...
# If you have problems with stuttering sound, try other values here, like:
# or
#output = alsasink buffer-time=300000 latency-time=20000
#output = alsasink buffer-time=200000 latency-time=10000
output = alsasink

#mixer = software
mixer = alsamixer

# Optionally, you can use alsamixer. This enables you to use hardware mixers of usb/audiocards.
# Set the previous setting to:
#mixer = alsamixer
# And set the card and contol below. E.g. 
#card = 1 
#control = Master 
# Run the command 'amixer scontrols' from the commandline to list available controls on your system
# See https://github.com/mopidy/mopidy-alsamixer
[alsamixer]
card = 2
control = Master

It looks like mopidy config is reporting different values for some of the [audio] and [alsamixer] settings. It's been a while since I set all of this up, so I can't recall the order in which the configuration files are read.

@jcass77
Copy link
Member Author

jcass77 commented Feb 13, 2017

Oops - I was running mopidy config as root. Running it with user mopidy gives the same output as is contained in the settings.ini file (which is also the same as /etc/mopidy/mopidy.conf), so the config should all be fine.

The only other variable that I can think of is the HifiBerry Amp+...

@jcass77
Copy link
Member Author

jcass77 commented Feb 13, 2017

This is what screen looks like when running alsamixer:

skitched-20170213-074159

I can't seem to toggle mute on 'Master' or any of the channels by pressing 'M', but amixer cset numid=1 off or amixer cset numid=2 off works. Perhaps muting is just not supported in alsamixer for this card (which may just not have a hardware mute option)?

@jodal
Copy link
Member

jodal commented Feb 13, 2017 via email

@jcass77
Copy link
Member Author

jcass77 commented Feb 14, 2017

>>> import alsaaudio
>>> mixer = alsaaudio.Mixer(cardindex=2, control='Master')
>>> print mixer.getmute()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
alsaaudio.ALSAAudioError: Mixer Master,0 has no playback switch capabilities, [hw:2]
>>> 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug
Projects
None yet
Development

No branches or pull requests

2 participants