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

Fix regression with volumecontroller #1961

Merged
merged 2 commits into from May 12, 2020
Merged

Conversation

ashthespy
Copy link
Collaborator

@ashthespy ashthespy commented May 12, 2020

I seem to have introduced issues with the software mixer with dd3f21a, sorry!
This is just fixing the symptoms, as I believe the linting has unearthed the real error which was just being silently ignored.
The error comes from these comparisons:

         case 'mute':
           // Mute
           self.getVolume(function (err, vol) {
-            if (vol == null) {
+            if (err) {
+              self.logger.error('Cannot get ALSA Volume: ' + err);
+            }
+            if (vol === null) {

The problem was that vol was never null when the parsing failed, but instead was undefined.
Thus undefined == null => true but undefined === null => false

Now this brings to light the actual underlying issue.

Both the regular expressions, fails to parse software mixer output, which doesn't contain Playback

  Simple mixer control 'SoftMaster',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 99
  Front Left: 10 [10%]
  Front Right: 10 [10%]
# Compared to Hardware mixer
  Simple mixer control 'PCM',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 110
  Mono:
  Front Left: Playback 0 [0%] [-55.00dB] [on]
  Front Right: Playback 0 [0%] [-55.00dB] [on]

If you give me a few samples of different mixer outputs, we can write some tests as well..

@volumio volumio merged commit 0949ddf into volumio:master May 12, 2020
@volumio
Copy link
Owner

volumio commented May 12, 2020

Perfect! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants