Every time I plug-in either my HDMI monitor or the HDMI projector on my MacBook the playing music/audio on macOS stops for several seconds, switches to the plugged device (silently), and then comes back to the actual output device that I use (External Headphones).
I usually have music in the background; macOS goes to lock/screensaver, turns of the display and disables the external monitor. The music keeps playing. But when I touch it again the monitor is restored and it takes around 10 seconds to restore. In this time it switches to the monitor HDMI audio, interrupting the audio for several seconds, and then restoring the actual audio device when finished reactivating the monitor.
This is extremely annoying; if the operative system would know to ignore an audio device completely (the external HDMI audio) then this would not happen.
In macOS, how to disable/remove/hide/block an audio device so that is always excluded and never considered or temporarily activated?
I've searched other questions on stackexchange but apparently nobody has any clue. So I suppose it's impossible via GUI and one needs to
disable via some shell/
sudo Linux/BSD system command.