FWIW, I used to switch between S/PDIF and my Avantree Leaf Bluetooth transmitter in Windows 8.1, though I did have to use an Autohotkey keyboard macro to disable and re-enable the surround formats in the Windows Sound control panel for S/PDIF, because I found no way to do this programmatically through proper scripting. The same Sound control panel exists in Windows 10, so it may still work. Reviewing my Windows 8.1 image backup, I had Kodi configured to use WASAPI:default for audio device and specifically S/PDIF for the passthrough device. Disabling the surround formats for S/PDIF in the Sound control panel made things fine when the Leaf was the default audio device. I remember thinking, "Kodi must see that surround isn't enabled in Windows for its "passthroughdevice" (S/PDIF), so it punts it to its "audiodevice" (WASAPI:default), using the guisettings.xml terms, and with the Windows default playback device being temporarily the Leaf, I got the behavior I wanted, Kodi using the 2 channel Leaf for output, with surround formats playing back fine.
For the AHK macro, I had Ctrl+Win+A switching between my two output devices, and Ctrl+Shift+Win+A used internally by the macro to trigger the DisplayFusion function "Set next playback device as default," which served to toggle between them as I only had two. There are other ways to do the latter without DisplayFusion, but that was easiest for me. The default state is for S/PDIF to be default playback device with surround formats enabled. Kodi cannot be running while the macro executes. I think the following AHK script excerpt should run standalone. The key line is:
Code:
Send {Down}{Down}{Space}^{Tab}{Down}{Space}{Down}{Space}{Enter}{Enter}
After the macro opens the Sound control panel, it moves down the playback device list and opens the Properties dialog for S/PDIF, which was the second one in my two-item list, so "{Down}{Down}{Space}". Then it activates the second tab in Properties and toggles DD5.1 and DTS on or off, so "^{Tab}{Down}{Space}{Down}{Space}". Finally, it OKs out of the two dialogs with "{Enter}{Enter}". I hated having to do it this way, but it did work, and it was a single keypress, Ctrl+Win+A, to toggle between S/PDIF and the Leaf. It worked for all applications, and it didn't require using a separate Kodi profile.
Finally, note that I had only two audio devices, so the DisplayFusion function "Set next playback device as default" served to switch between them. Having more than two would have made things more complicated.
Code:
g_ByClass = ByClass
g_ByTitle = ByTitle
#^a::
ModWait()
SetTitleMatchMode 3
path = %A_WinDir%\system32\control.exe
RunOrActivate("Sound", path . " mmsys.cpl", g_ByTitle)
WinWaitActive, Sound
if ErrorLevel
return
Send {Down}{Down}{Space}^{Tab}{Down}{Space}{Down}{Space}{Enter}{Enter}
Send #^+a
return
RunOrActivate(idWnd, path, findMethod = "ByClass")
{
global g_ByClass
if (findMethod = g_ByClass)
prefix := "ahk_class "
else
prefix := ""
id := prefix . idWnd
IfWinNotExist %id%
Run %path%
else
{
WinActivate
WinShow
}
}
ModWait()
{
KeyWait Shift
KeyWait Ctrl
KeyWait Alt
KeyWait LWin
KeyWait RWin
}