proxy-audio-device icon indicating copy to clipboard operation
proxy-audio-device copied to clipboard

Automatically switch to builtin speakers

Open Tuxie opened this issue 3 years ago • 16 comments

Please make it possible to output audio to the DisplayPort when the external monitor is connected, then reroute to Builtin Speakers when disconnected and reconnect to DisplayPort again when it's reconnected.

Tuxie avatar Aug 30 '20 15:08 Tuxie

I've actually made a build that does something similar to this, switching between built in speakers and headphones. Basically I see the feature being a list of devices to output to, in order of priority. I'll see if I can get this in at some point!

briankendall avatar Aug 30 '20 15:08 briankendall

That sounds awesome and exactly what I need! I have a whole bunch of audio outputs I switch between, but the monitor is the only one I can't use the normal volume control with, without something like proxy-audio-device or eqMac (which is overkill for my needs, but also doesn't automatically switch back to Displayport when reconnected to the monitor).

Tuxie avatar Aug 30 '20 15:08 Tuxie

I agree 100% with the intention of this request, but I wonder if the right way to handle it would be to "disconnect" PAD when the proxied device disconnects. That way the system's built in audio routing logic will take over.

n8gray avatar Sep 11 '20 17:09 n8gray

Can you build a "beta" release from your experimental branch that supports automatic switching? I tried to build it, but then the Settings panel says that no Proxy Audio Device could be found (I probably build it wrong, as the same happens if I build from the master branch).

xflashxx avatar Oct 20 '20 17:10 xflashxx

@xflashxx @Tuxie You can give this build a try: https://nextcloud.briankendall.net/index.php/s/TaETdJa2BLN2mpo

It should automatically switch to built-in speakers if the proxied device isn't available. Note though that I've only tested it on a 2017 iMac. I'm not sure how well it'll work in general.

briankendall avatar Oct 22 '20 14:10 briankendall

@n8gray I can see this working both ways, since with the proxy device simulating a disconnection macOS would behave just like when using the proxied device directly. However I think an explicit list of priority would be very useful too. macOS's logic for automatically switching audio devices is a bit strange and something of a black box, and I'm often finding myself frustrated with it because it will unpredictably switch to a device I don't want it to when I disconnect the current one.

In fact this happens often enough that I'm considering writing another utility whose sole purpose is to enforce a list of priority for audio devices rather than leaving it up to macOS.

briankendall avatar Oct 22 '20 14:10 briankendall

@briankendall thanks for your work and your beta build! I really like your work, doing what apple should just provide as a build-in function in my opinion.

xflashxx avatar Oct 24 '20 10:10 xflashxx

I agree 100% with the intention of this request, but I wonder if the right way to handle it would be to "disconnect" PAD when the proxied device disconnects. That way the system's built in audio routing logic will take over.

I would like it done this way as well. Especially because I've noticed that the built-in speakers' native volume control has better audio quality than the virtual volume control used for the built-in speakers

ell-c avatar Nov 10 '20 03:11 ell-c

@TheBestE Can you elaborate on what you mean by:

I've noticed that the built-in speakers' native volume control has better audio quality than the virtual volume control used for the built-in speakers

briankendall avatar Nov 10 '20 15:11 briankendall

@TheBestE Can you elaborate on what you mean by:

I've noticed that the built-in speakers' native volume control has better audio quality than the virtual volume control used for the built-in speakers

I'm not sure, it just sounds different; I guess "quality" wasn't the best word to use. It sounded more shallow or something, so maybe the EQ is different? The external display I used this driver with sounded fine so it's not really a big deal.

ell-c avatar Nov 10 '20 15:11 ell-c

Well there's definitely no EQ adjustment, unless you have something like SoundSource installed and configured to change it.

The volume curve you get as you adjust the volume on the proxy device will be different than the proxied device, since that's driver dependent and will vary for each device. I tried to pick one that felt intuitive and didn't result in changes that were too big or too small when the volume was near its maximum or minimum.

The only other thing I can think of is that the proxy device is applying a gain adjustment to an existing signal, so if the volume on your built-in speakers isn't at maximum, you're technically degrading the audio fidelity of the signal slightly by lowering the volume on it twice. In most cases though this shouldn't create any perceptible change in quality.

briankendall avatar Nov 10 '20 15:11 briankendall

That makes sense. But yeah, I prefer the built-in speakers' native volume adjustment which is why I would like the proxy device to be able to disconnect and reconnect depending on the proxied device.

ell-c avatar Nov 10 '20 22:11 ell-c

I'd love to see this get implemented! Is this relatively easily hackable?

wez avatar Nov 25 '22 22:11 wez

I suppose that depends on what you consider easy. You can see how the driver selects its output device in the function setupTargetOutputDevice(). You could pretty easily hack some logic in there to have a fallback output device if the main one isn't found.

Though I think the "right" way to do this would be to actually make a change to its settings app. Best would be having a list of audio sources in order of priority, and the proxy device will output to the topmost device it can find. That'd take a fair deal more work. A faster, less flexible solution would be to add a check box that turns this behavior on and off. (Though then you'd need to become familiar with the really, really hacky way the settings app communicates with the driver!)

briankendall avatar Nov 26 '22 01:11 briankendall

I've actually made a build that does something similar to this, switching between built in speakers and headphones. Basically I see the feature being a list of devices to output to, in order of priority. I'll see if I can get this in at some point!

Has this feature made it into master yet?

QFSW avatar Sep 18 '23 17:09 QFSW