Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate

switch between headphones <-> speakers


  • Please log in to reply
21 replies to this topic
Vrokolos
  • Guests
  • Last active:
  • Joined: --
I made a program that can switch between speaker modes using the command line so you can use it in scripts.

Posted Image

Here it is: speakersetup

wtg
  • Members
  • 251 posts
  • Last active: Dec 19 2012 03:54 PM
  • Joined: 04 Oct 2006
Thanks for sharing that Vrokolos... I've been looking for a way to do exactly that.

Originally I was hoping to do it via an AutoHotkey script but the speaker setting doesn't appear to be accessible via the built-in sound support. Or at least didn't - I haven't looked for a while. Do you mind sharing what dll and function call you're using to change the setting?

Thanks again!

Vrokolos
  • Guests
  • Last active:
  • Joined: --
I use managed directsound. I don't think autohotkey can access it directly. Might be wrong though!

n-l-i-d
  • Guests
  • Last active:
  • Joined: --
Would you be willing to share the source code?

8)

Vrokolos
  • Guests
  • Last active:
  • Joined: --
Not yet. But i'm willing to create a dll for you to use.

n-l-i-d
  • Guests
  • Last active:
  • Joined: --
k.

Would be nice to have a DLL too, but not absolutely necessary, the CLI version is fine as is... But sure, maybe others would like to have a DLL version.

I'm simply curious if this could be done with AHK-only...

Vrokolos
  • Guests
  • Last active:
  • Joined: --
let me give it a try with autohotkey only then :)

Vrokolos
  • Members
  • 5 posts
  • Last active: Jan 10 2009 09:43 PM
  • Joined: 02 Apr 2008
Can you create a complex object in AHK? This can't be done with just basic types like strings and ints. You need to create objects for devices and speakers and pass those objects to directsound.

n-l-i-d
  • Guests
  • Last active:
  • Joined: --
I have no clue...

If the "complex object" you are talking about is a COM object, you might be able to use the COM lib for it.

Vrokolos
  • Members
  • 5 posts
  • Last active: Jan 10 2009 09:43 PM
  • Joined: 02 Apr 2008
I'm pretty sure autohotkey can't make calls to managed dll assemblies using complex types as parameters. What you might want to do is research on how to do what I did using plain old directsound dlls and not the managed ones, for which I really have not clue where to start :)

Oberon
  • Members
  • 442 posts
  • Last active: Jul 03 2008 11:34 PM
  • Joined: 18 Feb 2008

I'm pretty sure autohotkey can't make calls to managed dll assemblies using complex types as parameters.

Yes it can. You don't even need to export your CLR as a COM-aware DLL. How has been discussed on the forum...

Vrokolos
  • Members
  • 5 posts
  • Last active: Jan 10 2009 09:43 PM
  • Joined: 02 Apr 2008
Oops sorry didn't see that before. Well then it should be possible.. Let me try to create a script for it in the next few days. I'll report back :)

n-l-i-d
  • Guests
  • Last active:
  • Joined: --
Well, I'm not the right person to ask these questions. All I can say is that AHK does support creating structures (if that equals the complex types you are referencing to).

HTH

n-l-i-d
  • Guests
  • Last active:
  • Joined: --
Ah!

8)

  • Guests
  • Last active:
  • Joined: --
Why bothered to access the managed codes? You can access (unmanaged) DirectSound directly from AutoHotkey.