briankendall / proxy-audio-device

A virtual audio driver for macOS to sends all audio to another output
The Unlicense
514 stars 33 forks source link

Unplugging hdmi leaves the proxy audio device present #25

Closed alx242 closed 1 year ago

alx242 commented 1 year ago

I assumed that if the proxied device wasn't present anymore that also the proxy audio device would be removed.

At least that is how I interpreted the setting "Proxy Device is active: When proxied device is active".

For me the proxy device is there event though the plugged in HDMI device is removed and its device is disappears.

briankendall commented 1 year ago

Perhaps the wording is a little unclear, but it's true that the proxy device does not disappear. For that setting, "active" is about when the proxy device is technically playing audio as far as macOS is considered, since so long as its active and playing audio, the system will not go to sleep.

alx242 commented 1 year ago

Aha, got it :)

Would it perhaps be a valid feature request instead then or?

briankendall commented 1 year ago

Sure, I can consider that a feature request. But I've had so little time to work on this lately that I can't promise anything.

mwadeladdi commented 1 year ago

Hi, I know that this is closed but this is the only thing that keeps this app from being perfect. How can we achieve this functionality? I'm a java developer - I've never written macOS apps but I'm happy to try and help.

briankendall commented 1 year ago

@mwadeladdi I would certainly welcome a pull request that implements this feature. I think this is probably a tricky thing to dive into if you're not used to C++ or macOS programming, especially because Apple's documentation about this sort of audio plug-in is pretty much non-existent. I'm not even sure how this should be implemented yet! But somewhere in ProxyAudioDevice.cpp is a bit that tells the system whether or not the virtual (i.e. proxy) device is connected. You could add some logic that updates it so that when the proxied device is missing then the proxy device signals that it is disconnected somehow.

I can at least point to where in the code the proxied device is detected as being connected or disconnected.

When it finds and starts setting up the proxied device, execution hits this line:

DebugMsg("ProxyAudio: setupTargetOutputDevice setting up new device");

When the proxied device disconnects, execution will hit this line:

DebugMsg("ProxyAudio: outputDeviceAliveListener output device no longer alive");