MacOS join/leave computer audio

Hello

I can’t find in the MacOS API an option to programatically join or leave computer audio. I can change the audio device etc, just can’t see how to perform the join/leave action.

Thanks!

Richard