Solved Mysterious behavior of amixer with fvwm and the console

Working on the miser control of fvwm.crystal, if I run into a console:
Code:
$ amixer -D pcm0 controls
ALSA lib control.c:1570:(snd_ctl_open_noupdate) Invalid CTL pcm0
amixer: Control pcm0 open error: No such file or directory

If the same command is into a fvwm Piperead command, fvwm send it to the shell and use the output of the Piperead (the output of echo "..." in that case) as fvwm config statements, and it works and I get the menu generated on the fly by the Piperead into the Preferences menu. See Preferences-Menu lines 604 to 610.
Code:
Test (EnvMatch FSYS_IS_FREEBSD 1) Test (x amixer) PipeRead `for i in $(grep -e pcm < /dev/sndstat | sed -e "s:\(pcm.\)\(.*\):\1:"); \
         do for j in $(amixer -D "$i" controls | grep Volume | sed -e 's:\\(numid=\\)\\(.*\\)\\(,iface.*\\):\\2:'); \
           do ControlT="$(amixer -D ${i} cget numid=${j})"; \
           Control="$(echo ${ControlT} | sed -e "s:\\(.*name='\\)\\(.*\\)\\('.*\\):\\2:")"; \
           echo "+ '%22x22/apps/alsamixer.png%$[gt.Sound Card] ${i} ${Control}' SelectSoundCard '${i}' '${j}'"; \
           done; \
     done`

Even if it works as wanted into fvwm, I found this non consistent behavior very unattended and not welcomed. How can I be sure that will work for another fvwm-crystal user if it don't work with a console started by fvwm-crystal for me.

Edit: A picture of the menu. That Piperead gives the part with the "Carte son..." lines:

Capture_écran-20241219_125702.png
 
Last edited:
Any reason to use the ALSA mixer instead of the native mixer()? Never used the ALSA compatibility library
audio/alsa-lib, I don't know whether it's capable of setting anything in the underlying OSS, if that's your intention.
Because fvwm-crystal support it. And no, fvwm-crystal don't mess with the system, it use what it find ( grep -e pcm < /dev/sndstat here). The mixer preferences is mostly used to setup key bindings and menu related functions. And before to add the support of mixer(), I first check the existing functions.
 
But you are right for using mixer. In addition to the Preferences system, fvwm-crystal read a Mixer file. What I can do is keep that file for linux, copy it as Mixer_BSD and read it instead, and change the preferences to use mixer.
 
Hm, I don't understand what amixer wants for device there, maybe a ALSA device which isn't there on FreeBSD. The canonical one for OSS would be /dev/mixer / /dev/mixerN. Interesting, the amixer command seems to pickup the OSS mixer values of the default audio device, so amixer may work in a system wide context as well.
 
Hm, I don't understand what amixer wants for device there, maybe a ALSA device which isn't there on FreeBSD. The canonical one for OSS would be /dev/mixer / /dev/mixerN. Interesting, the amixer command seems to pickup the OSS mixer values of the default audio device, so amixer may work in a system wide context as well.
After messing with the file, it don't work anymore. I changed it to use amixer -D default and it works fine now.
 
Back
Top