From 11bd316562485ae3c1aa7d5f001b40af8d197fad Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Tue, 17 May 2022 19:44:56 +0200 Subject: [PATCH] UMC204HD: Use newly introduced macros to simplify configs Although the information is somehow duplicated, the current macros support both "alsa-lib PCM channel split" and "application side PCM channel split". The key is the readability. Test: alsaucm -c "hw:1" dump text vs. alsaucm -c "<<>>hw:1" dump text Signed-off-by: Jaroslav Kysela --- ucm2/USB-Audio/Behringer/UMC204HD-HiFi.conf | 191 +++++++++----------- ucm2/USB-Audio/USB-Audio.conf | 2 +- 2 files changed, 84 insertions(+), 109 deletions(-) diff --git a/ucm2/USB-Audio/Behringer/UMC204HD-HiFi.conf b/ucm2/USB-Audio/Behringer/UMC204HD-HiFi.conf index f920d81..1fa10c6 100644 --- a/ucm2/USB-Audio/Behringer/UMC204HD-HiFi.conf +++ b/ucm2/USB-Audio/Behringer/UMC204HD-HiFi.conf @@ -1,127 +1,82 @@ -LibraryConfig.pcm.Config { - pcm.umc204hd_stereo_out { - @args [ CARD CHN0 CHN1 ] - @args { - CARD.type string - CHN0.type integer - CHN1.type integer - } - type dshare - ipc_key 572442 - slave { - pcm { - type hw - card $CARD - device 0 - chmap [ FL FR FL FR ] - } - channels 4 - } - bindings.0 $CHN0 - bindings.1 $CHN1 - } +Include.pcm_split.File "/common/pcm/split.conf" - pcm.umc204hd_mono_in { - @args [ CARD CHN0 ] - @args { - CARD.type string - CHN0.type integer +Macro [ + { + SplitPCM { + Name "umc204hd_stereo_out" + Direction Playback + Channels 2 + HWChannels 4 + HWChannelPos0 FL + HWChannelPos1 FR + HWChannelPos2 FL + HWChannelPos3 FR } - type dsnoop - ipc_key 572542 - slave { - pcm { - type hw - card $CARD - device 0 - chmap [ MONO MONO ] - } - channels 2 - } - bindings.0 $CHN0 } - - pcm.umc204hd_line1 { - @args [ CARD ] - @args.CARD.type string - type empty - slave.pcm { - @func concat - strings [ "umc204hd_stereo_out:" $CARD ",0,1" ] + { + SplitPCM { + Name "umc204hd_mono_in" + Direction Capture + Channels 1 + HWChannels 2 + HWChannelPos0 MONO + HWChannelPos1 MONO } } +] - pcm.umc204hd_line2 { - @args [ CARD ] - @args.CARD.type string - type empty - slave.pcm { - @func concat - strings [ "umc204hd_stereo_out:" $CARD ",2,3" ] - } - } +Include.ctl_remap.File "/common/ctl/remap.conf" - pcm.umc204hd_mic1 { - @args [ CARD ] - @args.CARD.type string - type empty - slave.pcm { - @func concat - strings [ "umc204hd_mono_in:" $CARD ",0" ] +Macro [ + { + CtlRemapStereoVolSw { + Dst "Line A Playback" + Src "UMC204HD 192k Output Playback" + Index0 0 + Index1 1 } } - - pcm.umc204hd_mic2 { - @args [ CARD ] - @args.CARD.type string - type empty - slave.pcm { - @func concat - strings [ "umc204hd_mono_in:" $CARD ",1" ] + { + CtlRemapStereoVolSw { + Dst "Line B Playback" + Src "UMC204HD 192k Output Playback" + Index0 2 + Index1 3 } } - - ctl.default.map { - "name='Line A Playback Volume'"."name='UMC204HD 192k Output Playback Volume'" { - vindex.0 0 - vindex.1 1 - } - "name='Line A Playback Switch'"."name='UMC204HD 192k Output Playback Switch'" { - vindex.0 0 - vindex.1 1 - } - "name='Line B Playback Volume'"."name='UMC204HD 192k Output Playback Volume'" { - vindex.0 2 - vindex.1 3 + { + CtlRemapMonoVolSw { + Dst "Input 1 Capture" + Src "Mic Capture" + Index 0 } - "name='Line B Playback Switch'"."name='UMC204HD 192k Output Playback Switch'" { - vindex.0 2 - vindex.1 3 - } - "name='Input 1 Capture Volume'"."name='Mic Capture Volume'" { - vindex.0 0 - } - "name='Input 1 Capture Switch'"."name='Mic Capture Switch'" { - vindex.0 0 - } - "name='Input 2 Capture Volume'"."name='Mic Capture Volume'" { - vindex.0 1 - } - "name='Input 2 Capture Switch'"."Name='Mic Capture Switch'" { - vindex.0 1 + } + { + CtlRemapMonoVolSw { + Dst "Input 2 Capture" + Src "Mic Capture" + Index 1 } } -} +] SectionDevice."Line1" { Comment "Line A" Value { PlaybackPriority 200 - PlaybackChannels 2 - PlaybackPCM "umc204hd_line1:${CardId}" PlaybackMixer "default:${CardId}" PlaybackMixerElem "Line A" } + Macro.pcm_split.SplitPCMDevice { + Name "umc204hd_stereo_out" + Direction Playback + HWChannels 4 + Channels 2 + Channel0 0 + Channel1 1 + ChannelPos0 FL + ChannelPos1 FR + } } SectionDevice."Line2" { @@ -129,11 +84,19 @@ SectionDevice."Line2" { Value { PlaybackPriority 100 - PlaybackChannels 2 - PlaybackPCM "umc204hd_line2:${CardId}" PlaybackMixer "default:${CardId}" PlaybackMixerElem "Line B" } + Macro.pcm_split.SplitPCMDevice { + Name "umc204hd_stereo_out" + Direction Playback + HWChannels 4 + Channels 2 + Channel0 2 + Channel1 3 + ChannelPos0 FL + ChannelPos1 FR + } } SectionDevice."Mic1" { @@ -141,11 +104,17 @@ SectionDevice."Mic1" { Value { CapturePriority 200 - CaptureChannels 1 - CapturePCM "umc204hd_mic1:${CardId}" CaptureMixer "default:${CardId}" CaptureMixerElem "Input 1" } + Macro.pcm_split.SplitPCMDevice { + Name "umc204hd_mono_in" + Direction Capture + HWChannels 2 + Channels 1 + Channel0 0 + ChannelPos0 MONO + } } SectionDevice."Mic2" { @@ -153,9 +122,15 @@ SectionDevice."Mic2" { Value { CapturePriority 100 - CaptureChannels 1 - CapturePCM "umc204hd_mic2:${CardId}" CaptureMixer "default:${CardId}" CaptureMixerElem "Input 2" } + Macro.pcm_split.SplitPCMDevice { + Name "umc204hd_mono_in" + Direction Capture + HWChannels 2 + Channels 1 + Channel0 1 + ChannelPos0 MONO + } } diff --git a/ucm2/USB-Audio/USB-Audio.conf b/ucm2/USB-Audio/USB-Audio.conf index f196ce7..c495981 100644 --- a/ucm2/USB-Audio/USB-Audio.conf +++ b/ucm2/USB-Audio/USB-Audio.conf @@ -1,4 +1,4 @@ -Syntax 4 +Syntax 6 Define.ProfileName "" Define.MixerRemap "" -- 2.47.1