davkean / audio-switcher

App that lets you easily switch Windows audio devices
MIT License
382 stars 53 forks source link

Make this a DLL, and add powershell support #19

Open zippy1981 opened 9 years ago

zippy1981 commented 9 years ago

I can open separate issues for these, but I think the "should we" needs to be discussed together.

It would be cool to have some powershell methods for switching the audio device from the CLI, for those of us into that kind of thing. Two that come to mind are of course Get-AudioDevice [-Active] [-Filter] and Set-AudioDevice [-Name]

To do that you need a DLL, not an exe. Rather than make a DLL and a wrapper EXE, it would be simpler to replace the static void Main() call with a call that rundll32.exe can make via UnmanagedExports The chocolatey package can then include a batch file to start this up manually, and add that batch file to the start menu.

Also, once this is a DLL, it makes sense to make this a regular nuget package and supporting an API as well.

davkean commented 9 years ago

Continuing from #20. I'd rather not use rundll32.exe, I'd rather a real CLI interface to handle this.

Well powershell Cmdlets, not CLI arguments, but why not both if someone wants to control the audio device from cmd.exe.

For CLI arguments I don't need to do this. For powershell cmdlets, I need this to be a DLL, not an exe so I can load it as a powershell module.

Maybe the powershell cmdlets just need to be in a separate dll.

I see. Have a few questions:

zippy1981 commented 9 years ago

A console app will play fine enough with powershell. A possible workaround for better powershell support is to have the -listdevices option return XML. Powershell is really awesome at parsing xml output, and people do things with the xml output of svn all the time.

Is there a non-friendly (e.g. guid) unique identifier for audio devices?