Giter Club home page Giter Club logo

Comments (4)

omriharel avatar omriharel commented on May 18, 2024

Hi there @jordaneast1, thanks for writing! I'm glad you like deej :)

I'd like to treat your question as two separate ones, with the first being about switching output devices altogether and the second one about doing it on a per-app basis. The TL;DR for these would be that (1) is possible via some means but not supported officially (and isn't planned to, due to reasons I'll go into momentarily) and (2), AFAIK, isn't possible.

Switching devices (altogether)

Unfortunately, at the time of writing switching output devices programatically (via Windows Core Audio APIs) isn't supported by the OS. Microsoft has somewhat sensible reasoning for this, in that they don't want vendor software to potentially clash with one another and cause conflicts, but the implication is that nobody else can set that preference other than the user (via their Windows Settings panels).

There are several external applications available that do support switching audio devices on your behalf, and they do so using reverse-engineered, undocumented APIs that mimic what the user would have to do in order to set the preference. I don't plan to do the same as part of deej, because undocumented APIs are by definition unstable and can break without any notice. I also don't want to package external apps with deej (or rely on them being installed separately), so for now I have no plans to support this.

There is a fork of deej called Phenipa/deej_toggle that supports toggling output devices in response to a button press by relying on you running one such external program (and triggering a keyboard shortcut that it listens on). This is currently the only good option for this use-case, but again - it's not officially supported and isn't guaranteed to keep up with newer deej releases. You'd also have to build deej yourself, but I imagine that's not a problem.

Switching devices (per-app)

I don't have much to say about this, except that I don't think that it's possible (at least not trivially). Since Windows doesn't support programatically switching output devices in general, I doubt it would include support for switching them for other apps. Of course, all apps that produce audio have the ability to route their audio to whichever device they want - the preference window from your above screenshot is just a default, but can be overridden by the software (i.e. if set explicitly by the user in that software's preferences).

I'm sure with enough reverse-engineering skills you'd be able to figure out a way to do this, but the walls you'd encounter would be at the Windows level anyway - adapting Windows API calls (via COM/OLE) to Go won't be the hard part here.

In summary

While I haven't given you a decent solution, I hope I managed to somewhat paint the landscape of what your options are with the knowledge I have. If you have any more questions, please don't hesitate to ask!

from deej.

jordaneast1 avatar jordaneast1 commented on May 18, 2024

Thanks so much for the great response!

This is all really useful to know, and SoundSwitch looks like it could be a good solution. for at least having some functionality to switch between my two outputs.

Per-app would be ideal but yes it looks like it would be some reverse engineering! Thanks for pointing me in the right direction.

Interesting, I did not think about changing the in-app settings, perhaps i could do that through hotkeys for each app. But seems like a lot to figure out as I'm using a wide range of software (Adobe, chrome, spotify... list will go on)

Another not as fun but much easier solution would be to have a button on my deej controleer that simply opens the App volume device preferences, I and I can change it manually from there...
at the moment I have a desktop shortcut that runs the program:

C:\Windows\System32\cmd.exe /k Start ms-settings:apps-volume && exit

which nicely opens the right settings panel with the URI command ms-settings:apps-volume

perhaps i could integrate that somehow into deej?

Thanks!

from deej.

omriharel avatar omriharel commented on May 18, 2024

Hey @jordaneast1,

If you're going to go with the fork I mentioned, you should be able to fairly trivially add support for a second button and respond to it by launching the above command as a process (I think deej already has some logic for launching a process implemented, because it supports opening the config file for editing from the tray menu).

In the future, native support for buttons over deej's serial protocol will be added and then you'll be able to bind them to actions (such as pressing a keyboard shortcut or executing a command) right from your config file - but there's no time frame for this yet.

from deej.

omriharel avatar omriharel commented on May 18, 2024

Closing this for now - please feel free to open a new issue if you have any other questions :)

from deej.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.