deweller / switchaudio-osx

Change the audio source for Mac OS X from the command line.
Other
1.16k stars 88 forks source link

Switch all types #22

Closed OliverJAsh closed 3 years ago

OliverJAsh commented 4 years ago

IIUC, -s only works on the provided type, which defaults to output.

If you want to select a device for all types, you have to run

function switchAllAudio() {
  DEVICE=$1
  echo Switching all audio to $DEVICE
  SwitchAudioSource -t output -s $DEVICE && \
    SwitchAudioSource -t input -s $DEVICE && \
    SwitchAudioSource -t system -s $DEVICE
}

switchAllAudio "Earphones"

Perhaps we could add a flag to switch all types simultaneously? I rarely want my input to use a different device from the output.

deweller commented 3 years ago

This is a helpful tip. I think your solution is good.

I generally want to stay with the unix philosophy here and keep this utility as a simple building block for solutions like this.