HDMI audio on the mac

macOS & Mac Apps

Hi, I recently got a Mac Mini. I also got a 24 inch monitor that hooks up to the HDMI port on the mac. The monitor also has built in speakers. Buy default, the mac mini switches to the HDMI speakers. When I plug in a set of speakers to the mac mini, i still get audio from the monitor. I usually have my mac set to use the internal speakers of the computer. When i plug in headphones or a set of speakers to the jack on the computer, is there a way to tell the mac mini to automatically switch to the device hooked up to the audio jack and disable the internal monitor speakers? Any help would be appreciated.