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

Mixer Selection does not persist nor allow for any mixer besides the first. #2083

Open
octalthorpe opened this issue Dec 8, 2024 · 0 comments

Comments

@octalthorpe
Copy link

octalthorpe commented Dec 8, 2024

FPP 8.3 Raspberry Pi

If you have an audio device where the first mixer device is not the one that is required for setting volume output, setting the value in the UI to another device will not take affect after fppd is restarted.

For example the hifiberry has both a Master and Digital mixer. I have a custom asound config that outputs audio to multiple devices, the hifberry and a SoundBlaster (For FM transmitter)

 amixer -c 1 scontrols | cut -f2 -d "'"
Master
DSP Program
Analogue
Analogue Playback Boost
Auto Mute
Auto Mute Mono
Auto Mute Time Left
Auto Mute Time Right
Clock Missing Period
Deemphasis
Digital
Max Overclock DAC
Max Overclock DSP
Max Overclock PLL
Volume Ramp Down Emergency Rate
Volume Ramp Down Emergency Step
Volume Ramp Down Rate
Volume Ramp Down Step
Volume Ramp Up Rate
Volume Ramp Up Step

In the UI Audio Setting Choose a Mixer device that is not the first one, like "Digital", then restart FPPD.
The setting will not persist, and the value will be forced back to the first mixer, in this case "Master"

The logs show the init process overriding the value back to the first mixer.

FPP - Found sound card of type snd_rpi_hifiberry_dacplus
FPP - Setting mixer device to Master

Expected behavior:
The expected behaviour is that the selected mixer should be persisted and used (even if it is wrong).

The bug is in FPPINIT.cpp, as the mixers list is truncated to the first entry using head -1

This fixes the issue.

diff --git a/src/boot/FPPINIT.cpp b/src/boot/FPPINIT.cpp
index 177ca31c..f6b41d86 100644
--- a/src/boot/FPPINIT.cpp
+++ b/src/boot/FPPINIT.cpp
@@ -1091,13 +1091,13 @@ static void setupAudio() {
         break;
     }
     PutFileContents("/root/.asoundrc", asoundrc);
-    std::string mixers = execAndReturn("/usr/bin/amixer -c " + std::to_string(card) + " scontrols | head -1 | cut -f2 -d\"'\"");
+    std::string mixers = execAndReturn("/usr/bin/amixer -c " + std::to_string(card) + " scontrols | cut -f2 -d\"'\"");
     if (mixers.empty()) {
         // for some sound cards, the mixer devices won't show up
         // until something is played.  Play one second of silence
         exec("/usr/bin/aplay -d 1 /opt/fpp/media/silence_5sec.wav >> /dev/null 2>&1  &");
         std::this_thread::sleep_for(std::chrono::milliseconds(200));
-        mixers = execAndReturn("/usr/bin/amixer -c " + std::to_string(card) + " scontrols | head -1 | cut -f2 -d\"'\"");
+        mixers = execAndReturn("/usr/bin/amixer -c " + std::to_string(card) + " scontrols | cut -f2 -d\"'\"");
     }

octalthorpe added a commit to octalthorpe/fpp that referenced this issue Dec 11, 2024
The list of mixer devices was limited to 1 due to 'head -1' in
the command pipeline.  This means you could only every set
and persist the first mixer device of a card.

Remove the 'head -1' call so all mixer devices are scraped.
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

No branches or pull requests

1 participant