How to stop sound output switching to a monitor when it gets plugged in? When I plug my (HDMI) display into my laptop, the sound output switches to it. I can switch it back, but is there any way to stop this automatic switch?

(I've found many people complaining, but no answers. A script which reversibly disabled HMDI audio would be acceptable.)
I have multiple devices I connect to my mac and for some they had the same issue. 



The work around (or actual fix) is to open 'Audio MIDI setup' in your Applications>Utility and:


Click + in the lower left corner.
Click Create Aggregate Device
Turn off/on the inputs/outputs sound based on needs.