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;
Otherwise the check at the start of remap_find_numid_app will keep failing and you get stuck in an infinite loop in remap_numid_child_new. I will likely send a patch soon (might slip into the new year, getting close to the end of the year and I am rather unfamiliar with the user side of the alsa code), but I want double check things a little more first.
Any input on this change would be greatly appreciated?
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.
SectionDevice."Mic" { Comment "Microphones"
EnableSequence [ cset "name='cs42l43 PDM2 Switch' 1" ]
DisableSequence [ cset "name='cs42l43 PDM2 Switch' 0" ]
Value { CapturePriority 100 CapturePCM "hw:${CardId},4" } }
It would seem the primary issue is here, one needs to add:
CaptureCTL "default:${CardId}" PlaybackCTL "default:${CardId}"
This is because the control device will normally be the hw: one, which doesn't have the renaming applied to it, you need to switch to the device with the remapping, which was added as the one named default in lib/ctl-remap.conf.
Seems weird you have to do the PlaybackCTL in a capture only use case, but otherwise it complains about them being mismatched. Also weirdly you need to add this into some other devices in the same use-case, otherwise it appears it just ignores these lines and uses the hw device anyway. Still looking at what is going on with that but I would appreciate any thoughts on that as well?
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.
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.
Anyway any extra thoughts/corrections on all this would be really really appreciated. I am still very new to the ALSA userspace side of things, so sure I am still making lots of mistakes.
Thanks, Charles