Windows, How to map output device to spectral monitor

I think I had a similar issue which as solved by @rich.e in this post Changin audio output

You can look a code sample I wrote for selecting audio inputs/outputs, it might help