# Reference:
# https://gitlab.manjaro.org/manjaro-arm/packages/community/pinebookpro-post-install/-/blob/4b4206c57b21044bf9c00848bd1f8b6f710d19eb/asound.state
# https://gitlab.manjaro.org/manjaro-arm/packages/community/pinebookpro-audio/-/blob/1f567db09495acc3beb5405c9ef85c3c07b86785/audio_jack_plugged_in.sh
Define.Bluetooth "bluealsa"
Define.BtCardId "rockchipbt"

SectionVerb {
        EnableSequence [
                exec "/usr/bin/logger -t UCM -p info A2DPout_bt:SectionVerb:EnableSequence"
        ]

        Value {
                Priority 250
        }
}

#A2DP in this case only no SCO is usefull
#typical layout
#numid=1,iface=MIXER,name='rokpod - A2DP Playback Switch'
#numid=2,iface=MIXER,name='rokpod - A2DP Playback Volume'
#numid=3,iface=MIXER,name='rokpod - SCO Capture Switch'
#numid=4,iface=MIXER,name='rokpod - SCO Capture Volume'
#numid=5,iface=MIXER,name='rokpod - SCO Playback Switch'
#numid=6,iface=MIXER,name='rokpod - SCO Playback Volume'
#numid=7,iface=MIXER,name='rokpod | Battery Playback Volume'
SectionDevice."A2DPout_bt" {
        Comment "A2DP_sink"

        EnableSequence [
                exec "/usr/bin/logger -t UCM -p info A2DPout_bt:A2DP_out:EnableSequence"
        ]

        DisableSequence [
                exec "/usr/bin/logger -t UCM -p info A2DPout_bt:A2DP_out:DisableSequence"
        ]

        Value {
		PlaybackPriority 200
		PlaybackPCM "${var:Bluetooth}"
		PlaybackCTL "${var:Bluetooth}"
		#falback if on source
		CapturePCM "hw:${var:BtCardId}"
		CaptureRate 8000
		PlaybackRate 48000
		PlaybackChannels 2
		CaptureChannels 2
        }
}
