On 19. 12. 23 17:45, Charles Keepax wrote:
On Fri, Dec 08, 2023 at 12:00:26PM +0000, Charles Keepax wrote:
On Thu, Dec 07, 2023 at 02:56:17PM +0100, Jaroslav Kysela wrote:
On 07. 12. 23 10:55, Charles Keepax wrote:
On Wed, Dec 06, 2023 at 06:26:17PM +0100, Jaroslav Kysela wrote:
On 06. 12. 23 17:46, Charles Keepax wrote:
Oh, I was not aware we could do that. I would yes much rather handle the switches and volumes in this way. I will see if I can figure it out, but if you had any good examples that already exist that would really be handy?
You may look for "LibraryConfig.remap.Config" and "Include.ctl-remap.File" strings in .conf files.
Apologies still struggling to get this working. I think there must some important boiler plate or limitation I am missing. Would really appreciate if you could have a look at this and let me know if it looks sane. I am starting out with just the simplest thing I can think of, just trying to rename a control:
Ok it seems starting with the simplest thing was not the best idea :-)
If you only have a remap, no map then it looks like one needs to do something like this:
+++ b/src/control/control_remap.c @@ -1192,7 +1192,7 @@ int snd_ctl_remap_open(snd_ctl_t **handlep, const char *name, snd_config_t *rema goto _err; }
- priv->numid_remap_active = priv->map_items > 0;
- priv->numid_remap_active = priv->map_items > 0 || priv->remap_items > 0;
It's not a correct fix. I applied this quick fix with your Reported-by tag:
@@ -148,7 +148,7 @@ static snd_ctl_numid_t *remap_numid_child_new(snd_ctl_remap_t *priv, unsigned in
if (numid_child == 0) return NULL; - if (remap_find_numid_app(priv, numid_child)) { + if (priv->numid_remap_active && remap_find_numid_app(priv, numid_child)) {
It seems that I did tests only with 'amixer set/get' commands and not 'amixer cget/cset' commands. The PA/pipewire uses the simple mixer API (set/get) so I have not noticed this issue. Thanks for reporting.
LibraryConfig.remap.Config { ctl.default.remap { "name='cs42l43 PDM2 Switch'" "name='cs42l43 Decimator 3 Switch'" } }
To answer part of my own question, and in the hope that if anyone else is having similar difficulties they will find this thread, the remapping works the other way around, it should go:
"name='cs42l43 Decimator 3 Switch'" "name='cs42l43 PDM2 Switch'"
With the newly mapped control second, kinda confusing as the .map sections do it the other way around, but fair enough.
The description for the alsa-lib's remap plugin is here:
https://www.alsa-project.org/alsa-doc/alsa-lib/control_plugins.html
It would seem the primary issue is here, one needs to add:
CaptureCTL "default:${CardId}" PlaybackCTL "default:${CardId}"
Look for 'PlaybackMixer "default:' strings in configs for sound servers and PlaybackMixerElem corresponding values. Sound servers does not use the control API directly but the simple mixer API.
The LibraryConfig blocks are added to the standard configuration and there are 2 ways to use them.
1) private configuration - _ucm####. prefix (only in memory for UCM apps) 2) blocks can be saved using cfg-save sequence command (used in ucm2/lib/ctl-remap.conf)
The second case - ctl-remap.conf - should save new configurations to /var/lib/alsa/card#.conf.d and the global configuration (/usr/share/alsa/alsa.conf) will include them. So the default devices should be modified. You may also prepare/test configs in ~/.asoundrc and then copy them to ucm configuration files.
Also note that the remapping is for the application side (API), UCM sequences are using the direct hw: controls.
Some notes are also here: https://github.com/alsa-project/alsa-ucm-conf/blob/master/ucm2/DEBUG.md
Also if there are any docs I should read happy to go there first?
Updating this to any suggestions on where to add some docs would also be appreciated?
Hopefully I can find sometime to document some of this a little and save someone else spending the quite large amount of time I have sunk into working this lot out so far.
Yes, documentation needs more improvements. The contents should go probably to https://www.alsa-project.org/alsa-doc/alsa-lib/group__ucm__conf.html (ucm_confdoc.h in alsa-lib's source tree).
Finally, does anyone have any idea what is going on with the current users of the remap. It looks like rt5660, rt5677, rt5651, rt5645, rt5640, rt5682 all currently have remap sections in their config. However almost the remapped controls are never used, which might not be surprising given the likely bug at the start of this email. But curious if anyone has any ideas that the remapping is actually being used for something non-obvious on those devices? Kinda wonder if we should just remove some of the unused remapping as I found it quite confusing whilst trying to figure this out.
The configs are for standard applications (case 2 - ctl-remap.conf).
Jaroslav