Include.pcm_split.File "/common/pcm/split.conf"

Macro [
	{
		SplitPCM {
			Name "umc204hd_stereo_out"
			Direction Playback
			Format S32_LE
			Channels 2
			HWChannels 4
			HWChannelPos0 FL
			HWChannelPos1 FR
			HWChannelPos2 FL
			HWChannelPos3 FR
		}
	}
	{
		SplitPCM {
			Name "umc204hd_mono_in"
			Direction Capture
			Format S32_LE
			Channels 1
			HWChannels 2
			HWChannelPos0 MONO
			HWChannelPos1 MONO
		}
	}
]

Define.PCMCTLName "PCM Playback"

If.pcm_controls {
	Condition {
		Type ControlExists
		Control "name='UMC204HD 192k Output Playback Switch'"
	}
	True.Define.PCMCTLName "UMC204HD 192k Output Playback"
}

Include.ctl_remap.File "/common/ctl/remap.conf"

Macro [
	{
		CtlRemapStereoVolSw {
			Dst "Line A Playback"
			Src "${var:PCMCTLName}"
			Index0 0
			Index1 1
		}
	}
	{
		CtlRemapStereoVolSw {
			Dst "Line B Playback"
			Src "${var:PCMCTLName}"
			Index0 2
			Index1 3
		}
	}
	{
		CtlRemapMonoVolSw {
			Dst "Input 1 Capture"
			Src "Mic Capture"
			Index 0
		}
	}
	{
		CtlRemapMonoVolSw {
			Dst "Input 2 Capture"
			Src "Mic Capture"
			Index 1
		}
	}
]

SectionDevice."Line1" {
	Comment "Line A"
	Value {
		PlaybackPriority 200
		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" {
	Comment "Line B"

	Value {
		PlaybackPriority 100
		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" {
	Comment "Input 1"

	Value {
		CapturePriority 200
		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" {
	Comment "Input 2"

	Value {
		CapturePriority 100
		CaptureMixer "default:${CardId}"
		CaptureMixerElem "Input 2"
	}
	Macro.pcm_split.SplitPCMDevice {
		Name "umc204hd_mono_in"
		Direction Capture
		HWChannels 2
		Channels 1
		Channel0 1
		ChannelPos0 MONO
	}
}
