Hi, On Fri, Dec 11, 2020 at 10:00:42AM +0900, Susie B. wrote: > Now let me move on to the problems I'm having. There are two. The amixer tool in alsa-utils has two set of options; * scontrols/scontents/sset/sget * controls/contents/cset/cget The former is application of 'simple mixer' interface in alsa-lib. The latter is application of 'hctl' interface[2]. [1] https://www.alsa-project.org/alsa-doc/alsa-lib/group___simple_mixer.html [2] https://www.alsa-project.org/alsa-doc/alsa-lib/group___h_control.html As long as I know, the former interface (=implementation inner alsa-lib) cannot handle control element with multiple values properly. It includes some design faults for the case. > The first problem is on the notaion of volume level. > When I operate my AF4 via alsa mixer apps, I can't set/get the value of > a volume in decibel(dB), while I can do that with the on-board sound of > my motherboard: > > [~]$ amixer -c2 set 'output-volume' -20dB > amixer: invalid option -- '2' > Invalid switch or option needs an argument. > amixer: invalid option -- '0' > Invalid switch or option needs an argument. > amixer: invalid option -- 'B' > Invalid switch or option needs an argument. > > [~]$ amixer -c1 sset 'Master' 0dB > Simple mixer control 'Master',0 > Capabilities: pvolume pvolume-joined pswitch pswitch-joined > Playback channels: Mono > Limits: Playback 0 - 64 > Mono: Playback 64 [100%] [0.00dB] [on] In a convention of command line tools, 'hyphen-minus' sign is used for the prefix of options. For example, we can find it in draft of IEEE Std 1003.-2017[3]. [3] https://pubs.opengroup.org/onlinepubs/9699919799/ Thus you need to escape these character, like: $ amixer -c2 set 'output-volume' '\-20dB' $ amixer -c2 set 'output-volume' \\-20dB Additionally, amixer doesn't parse the value with 'dB' suffix. It can handle two types of values; raw control value and percentage. Therefore you can't configure the control element with dB value. Furthermore, as long as I know, the parser of command line argument for the values includes some bugs. It comes from alsa-lib implementation[4]. I'd like to fix it if I keep enough time for it, but currently now, as you know I'm busy for the service programs... [4] https://github.com/alsa-project/alsa-lib/blob/master/src/control/ctlparse.c > I also can't read meters of AF4 in dB: > > [~]$ amixer -c2 get 'input-meter' > Simple mixer control 'input-meter',0 > Capabilities: volume > Playback channels: Front Left - Front Right - Rear Left - Rear Right - Front Center - Woofer > Capture channels: Front Left - Front Right - Rear Left - Rear Right - Front Center - Woofer > Limits: 0 - 8388607 > Front Left: 0 [0%] > Front Right: 0 [0%] > Rear Left: 0 [0%] > Rear Right: 0 [0%] > Front Center: 0 [0%] > Woofer: 0 [0%] > > Can I use dB suffix in these operations with some additional settings? > > The second is on storing the mixer settings into my AF4. > The users manual of AF4 for the Windows users [1] states; > > When the console is closed, all the console mixer settings for your AudioFire are > saved to flash memory in the AudioFire. So, these settings will be recalled when > you reboot your AudioFire or move it to another computer. > > Your AudioFire need not be connected to a computer to operate. This is called > stand-alone mode. Simply set the mixer setting as you desire in the console and > close the console to save those settings to flash memory. Then, when you turn on > your AudioFire, those settings will automatically be loaded into the AudioFire’s > internal mixer. Yes. Fireworks board module is designed to have flash memory for permanent storage. The module allows software to update the content of memory by asynchronous transaction in IEEE 1394 bus. The memory is used for two purposes; for several types of firmwares, and for configuration. In this August, I posted the series of patchset to update the content in firmware part only[1]. [5] Not merged yet for several resons. [PATCH 00/25] alsa-tools: efw-downloader: add initial version of firmware downloader for Echo Audio Fireworks devices https://mailman.alsa-project.org/pipermail/alsa-devel/2020-August/172711.html > But actually when I turn my AF4's power off, the mixer setting is lost. > Can I use these features in Linux via ALSA and snd-fireworks-ctl-service? At this point, I have no plan for it. I have a reason. It requires to investigate data structure in the part of flash memory, however it seems to vary depending on models (AF4, Af8, Robot Interface Pack, and so on.) > Of course any other means is also OK. But I've not found such means yet. > > Though FFADO mixer has a button to explicitly store the settings to AF4, > it seemed not to work properly even in the latest version. Yes. I guess it comes from the hard point to identify the data structure. For example, if the data structure is different depending on each driver implementation for Operating systems such as Windows, MacOS, the difference easily causes software runtime failure. > I'm also trying to save the settings in my desktop with "alsactl store" > command but I'm struggling to make it work. It's relevant to issue #9[6]. [6] Restart alsa-restore.service after launching the service program #9 https://github.com/alsa-project/snd-firewire-ctl-services/issues/9 As another side, as long as I know, alsactl tool includes bugs to handle control element with multiple values (again...). > So if I can use the features above via ALSA and the service, it is very > helpful. And they are also convenient for my another use case, in which > my AF4 works as a standalone mic preamp. > > I would appreciate any advice or suggestions to solve these problems. > > [1] "Owner’s Manual Version 2.2 for Windows" p.39 http://files.echoaudio.com/manuals/audiofire_windows_manual_v2.2.pdf In my opinion, basic ALSA tools (amixer, alsamixer, and alsactl) includes many bugs for control elements with multiple values. In the meaning, we stand in the first place to start fixing them. (I wonder the reason, but I guess the ALSA project has little integration for the kind of devices which have control elements with many channels in recent decades.) At present, I leave them as is because the most of my time is used to develop the service programs and in-kernel packet streaming engine. Regards Takashi Sakamoto _______________________________________________ Alsa-user mailing list Alsa-user@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/alsa-user