Force manual audio device?

For some reason Plex is not showing the proper HDMI device for me to use my AVR until I have manually forced it to connect (Opening audio control panel or using something like aplay)

I have HDMI Nvidia #0,2,3

The device I need is Nvidia #1 which only shows up for me AFTER it's been used by something else, then says Onkyo HT-R390 Nvidia #1

I've no problem setting this up like that once, but it does not remember it at all, disappears when I restart and it shows only #0,2 & 3 again

Any one had this issue before? Any recommendations? Any way I could just make ALSA (Bypassing pulse due to that playback speed problem) remap the device to 0,2 or 3?

 

Edit:

 

Been doing some more digging. Now I've got the right terms down (I hope)

I've got 4 codecs in my /proc/asound/NVidia folder

Codec#0/1/2/3

Looking at the information in the files, the codec I need to use is codec#1

In Plex the audio settings are set to HDMI in the standard options and in the advanced options, I only see codecs#0,2+3 until I have manually 'activated' codec#1

If I make something use codec#1 and then go into the settings, I can select the right output device and it all works perfectly.

Anyone know how to allow Plex to show codec#1 all the time? It currently loses the setting on restart and has to be set back once I have 'activated' codec#1

Ok, posting a new reply to separate the answer from the question:

The solution turned out to be good old Pulseaudio

It was hijacking the sound device before it could be accessed by Plex and causing the device not to appear until it had be poked into life again by me.

Solution is very simple on a dedicated machine. Throw pulse out the window and use only ALSA.

In Linux Mint 16 (What I'm using) and probably most distros that use it, this should be solvable in the file:

/etc/pulse/client.conf

Edit it and turn

; autospawn = yes

into

 autospawn = no

This disables pulseaudio without uninstalling (And causing all sorts of dependency issues to crop up)

Voila, sound works again.