Define.pbk_mux "SPK"

If.1 {
	Condition {
		Type ControlExists
		Control "name='Internal Speakers Switch'"
	}

	True {
		Define.pbk_mux "HP"
		SectionDevice."Speaker".EnableSequence [
			cset "name='Internal Speakers Switch' on"
		]

		SectionDevice."Speaker".DisableSequence [
			cset "name='Internal Speakers Switch' off"
		]
	}
}

SectionDevice."Speaker" {
	Comment "Internal Speaker"

	EnableSequence [
		cset "name='Playback Mux' ${var:pbk_mux}"
	]

	Value {
		PlaybackMixerElem "Master Playback Volume"
		PlaybackPriority 100
		PlaybackPCM "hw:${CardId}"
	}

	ConflictingDevice [
		"Headphones"
	]
}

SectionDevice."Mic" {
	Comment "Microphone"

	Value {
		CapturePriority 100
		CapturePCM "hw:${CardId}"
		CaptureMixerElem "Mic Capture Gain"
		CaptureMasterElem "Master Capture Volume"
	}
}

SectionDevice."Headphones" {
	Comment "Headphones"

	EnableSequence [
		cset "name='Playback Mux' HP"
	]

	Value {
		PlaybackMixerElem "Master Playback Volume"
		PlaybackPriority 200
		PlaybackPCM "hw:${CardId}"
		JackControl "Headphones Jack"
		JackHWMute "Speaker"
	}

	ConflictingDevice [
		"Speaker"
	]
}
