LibraryConfig.pcm.Config {
	pcm.monomix {
		@args [ CARD ]
		@args.CARD.type string
		type route
		slave.pcm {
			@func concat
			strings [ "hw:CARD=" $CARD ",DEV=0" ]
		}
		ttable {
			0.1 0.49
			1.1 0.49
		}
	}
}

Define.MainCardId "rockchipes8388"
Define.BtCardId "rockchipbt"
Define.Bluetooth "bluealsa"

SectionVerb {
	EnableSequence [
		exec "/usr/bin/logger -t UCM -p info HiFi_dvt:SectionVerb:EnableSequence"
		cdev "hw:${var:MainCardId}"
		cset "name='Speaker Switch' off"
		cset "name='Main Mic Switch' off"
		cset "name='Headphone Switch' off"
		cset "name='Headset Mic Switch' off"
		cset "name='Right Mixer Playback Switch' on"
		cset "name='Output 1 Playback Volume' 100"
		cset "name='Output 2 Playback Volume' 100"
		cset "name='Left Mixer Playback Switch' on"
	]

	Value {
		Priority 300
	}
}

SectionDevice."Speakers" {
	Comment "Speakers"

	EnableSequence [
		exec "/usr/bin/logger -t UCM -p info HiFi_dvt:Speakers:EnableSequence"
		# Enable Speaker
		cdev "hw:${var:MainCardId}"
		cset "name='Speaker Switch' on"
	]

	DisableSequence [
		exec "/usr/bin/logger -t UCM -p info HiFi_dvt:Speakers:DisableSequence"
		# Disable Speaker
		cdev "hw:${var:MainCardId}"
		cset "name='Speaker Switch' off"
	]

	Value {
		PlaybackPriority 100
		#PlaybackPCM "hw:${var:MainCardId}"
		PlaybackPCM "monomix:CARD=${CardId}"
		PlaybackMasterElem "PCM Volume"
		PlaybackVolume "PCM Volume"
		PlaybackSwitch "Speaker Switch"
	}
}

SectionDevice."Mic" {
	Comment "Internal Microphone"

	EnableSequence [
		exec "/usr/bin/logger -t UCM -p info HiFi_dvt:Mic:EnableSequence"
		# Enable Mic
		cdev "hw:${var:MainCardId}"
		cset "name='Main Mic Switch' on"
	]

	DisableSequence [
		exec "/usr/bin/logger -t UCM -p info HiFi_dvt:Mic:DisableSequence"
		# Disable Mic
		cdev "hw:${var:MainCardId}"
		cset "name='Main Mic Switch' off"
	]

	Value {
		CapturePriority 100
		# working as loopback/don't work device if channels count < 4
		CaptureChannels "2"
		CapturePCM "hw:${var:MainCardId}"
		CaptureMixerElem "Capture Digital Volume"
		CaptureSwitch "Main Mic Switch"
	}
}
