#
# Macro HDMI
#
# Arguments:
#
#   Number        HDMI number
#   Device        PCM device number
#   Priority      UCM device priority
#

DefineMacro.HDMI.If.hdmi {
	Condition {
		Type ControlExists
		Control "iface=CARD,name='HDMI/DP,pcm=${var:__Device} Jack'"
	}
	True {
		SectionDevice."HDMI${var:__Number}" {
			Comment "HDMI / DisplayPort ${var:__Number} Output"

			EnableSequence [
				cset "name='IEC958 Playback Switch',index=${eval:($__Number-1)} on"
			]

			DisableSequence [
				cset "name='IEC958 Playback Switch',index=${eval:($__Number-1)} off"
			]

			Value {
				PlaybackPriority "${var:__Priority}"
				PlaybackPCM "hw:${CardId},${var:__Device}"
				JackControl "HDMI/DP,pcm=${var:__Device} Jack"
			}
		}
	}
}
