]> git.alsa-project.org Git - alsa-ucm-conf.git/commitdiff
UMC204HD: Use newly introduced macros to simplify configs
authorJaroslav Kysela <perex@perex.cz>
Tue, 17 May 2022 17:44:56 +0000 (19:44 +0200)
committerJaroslav Kysela <perex@perex.cz>
Fri, 27 May 2022 08:16:28 +0000 (10:16 +0200)
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 "<<<SplitPCM=1>>>hw:1" dump text

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
ucm2/USB-Audio/Behringer/UMC204HD-HiFi.conf
ucm2/USB-Audio/USB-Audio.conf

index f920d81fe66cd3e6ba9f62c77cbf1df2bf09d7c6..1fa10c66e236accc0bf9c8adf10b4512ee172e25 100644 (file)
-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
+       }
 }
index f196ce7520324f1608b90967c4da7e79c696a8de..c4959813cb721167d9cdf7b09b25794d175daba4 100644 (file)
@@ -1,4 +1,4 @@
-Syntax 4
+Syntax 6
 
 Define.ProfileName ""
 Define.MixerRemap ""