Change 'Playback Devices' in Control Panel (Sound)

If you have a question or need help, this is the place to be.

Change 'Playback Devices' in Control Panel (Sound)

Postby tstack77 » Fri Feb 19, 2010 6:24 am

I have my system setup where I watch WMC on a connected display and a have Toslink cable running to my receiver. Most of the time I use my computer with the speakers so it's annoying when WMC changes the device to digital audio but neglects to change it back when I close out.

Is there a way to do this in EG?

Side--I have tried VistaAudioChanger but had to nix it for being too buggy...sometimes it changed the audio, other times it just displayed that it did in the program but the setting remained in Sound.
tstack77
 
Posts: 6
Joined: Sat Feb 13, 2010 8:24 pm

Re: Change 'Playback Devices' in Control Panel (Sound)

Postby scat » Mon Mar 15, 2010 1:29 pm

tstack77

I am also interested in how to do this in EventGhost.

I have Vista x64 and EventGhost 0.3.7.r1436
I have found a vb script on this website : http://social.technet.microsoft.com/Forums/en/ITCG/thread/05fff6f4-264d-4610-b1a6-76a84acec1ed

I have modified it for my system, but I would rather have it controlled
by EventGhost via a python script, any python script GURU's around
please download the attached file and convert it to python, Please.

Also how would one run this vb script from EventGhost?

Thanks
Scat
Attachments
How to change default sound device with a VBScript.zip
User Note: Use at your own risk, view in notepad prior to using. I didn't create the scrips.
(1.11 KiB) Downloaded 95 times
scat
 
Posts: 28
Joined: Sat May 05, 2007 12:55 pm

Re: Change 'Playback Devices' in Control Panel (Sound)

Postby jitterjames » Thu Mar 18, 2010 9:25 pm

you can do something similar like this:
(note you can paste this code into your macro tree in eventghost and then it will be easier to understand what is going on too...)
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1194">
    <Macro Name="output = headset" Expanded="True">
        <Event Name="SoundOutHeadset" />
        <Action>
            System.Execute(u'rundll32.exe', u'shell32.dll,Control_RunDLL mmsys.cpl,,0', 0, False, 2, u'')
        </Action>
        <Action>
            EventGhost.ShowOSD(u'Headset', u'0;-48;0;0;0;700;0;0;0;0;3;2;1;34;Arial', (255, 255, 255), (0, 0, 0), 4, (0, 0), 0, 4.0, True)
        </Action>
        <Action>
            EventGhost.Wait(0.10000000000000001)
        </Action>
        <Action>
            Window.FindWindow(u'rundll32.exe', u'Sound', u'#32770', u'', u'SysListView32', 1, False, 8.0, 0)
        </Action>
        <Action>
            Window.SendKeys(u'{Down}', False)
        </Action>
        <Action>
            EventGhost.Wait(0.10000000000000001)
        </Action>
        <Action>
            Window.SendKeys(u'{Tabulator}{Tabulator}{Return}{Escape}', False)
        </Action>
        <Action>
            Window.FindWindow(u'rundll32.exe', u'Sound', u'#32770', u'', u'SysListView32', 1, False, 0.10000000000000001, 0)
        </Action>
        <Action>
            Window.SendKeys(u'{Escape}', False)
        </Action>
    </Macro>
</EventGhost>


It is doing the same thing as the vbscript basically, by emulating keyboard input. I don't know how reliable it is.

Note that I am using 1 down to select the first audio device, by using two or more downs you get the other devices...

if you want to use the vbscript you can execute it from eventGhost as you would any other file by creating an action going to "system" and choosing "start application", and then entering the path and filename or using the browse button.
Last edited by jitterjames on Thu Mar 18, 2010 9:42 pm, edited 2 times in total.
User avatar
jitterjames
Experienced User
 
Posts: 649
Joined: Thu Aug 13, 2009 4:36 pm
Location: Quebec, Canada

Re: Change 'Playback Devices' in Control Panel (Sound)

Postby jitterjames » Thu Mar 18, 2010 9:32 pm

now if I can just find a way to retask my realtek outputs so that I can switch them between headphone out and rear speaker out!
User avatar
jitterjames
Experienced User
 
Posts: 649
Joined: Thu Aug 13, 2009 4:36 pm
Location: Quebec, Canada

Re: Change 'Playback Devices' in Control Panel (Sound)

Postby scat » Mon Mar 22, 2010 9:52 am

jitterjames

Thank you for your code, I modified mine to include your code and it works perfect.
I did leave the old vb script in there and attached a zip containing those if anyone wanted them.
I have included my EventGhost xml file for anyone to see how I am using the sound changing routine and folder usage.

Scat
Attachments
vbscripts.zip
VB scripts for changing outputs from pc speakers to the digital SPIDF and back again.
(1.04 KiB) Downloaded 106 times
my media computer-2.zip
includes sections for SageTV, PowerDVD, Hulu, Media Player Classic HC,TotalMedia Theatre 3, and the changing of sound output from pc speakers to digital SPDIF
(9.81 KiB) Downloaded 107 times
scat
 
Posts: 28
Joined: Sat May 05, 2007 12:55 pm

Re: Change 'Playback Devices' in Control Panel (Sound)

Postby Livin » Wed Mar 24, 2010 6:58 am

Have you tried Vista Audio Changer? Supposed to work on Win7 as it is the same sound subsystem.

http://www.raymond.cc/blog/archives/200 ... ta-and-xp/
setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system
User avatar
Livin
Experienced User
 
Posts: 749
Joined: Wed Oct 08, 2008 4:56 am

Re: Change 'Playback Devices' in Control Panel (Sound)

Postby scat » Wed Mar 24, 2010 8:28 am

Livin

Thanks for your suggestion, I have looked at Vista Audio Changer but I didn't want another program running all the time that I would only use maybe once a day.

Scat
scat
 
Posts: 28
Joined: Sat May 05, 2007 12:55 pm

Re: Change 'Playback Devices' in Control Panel (Sound)

Postby jitterjames » Wed Mar 24, 2010 11:47 am

I think this version works slightly better (faster / more reliable), the final stage uses a mouse click instead of the keyboard...

Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1194">
    <Macro Name="output = headset">       
        <Action>
            System.Execute(u'rundll32.exe', u'shell32.dll,Control_RunDLL mmsys.cpl,,0', 0, False, 2, u'')
        </Action>
        <Action>
            EventGhost.ShowOSD(u'Headset', u'0;-48;0;0;0;700;0;0;0;0;3;2;1;34;Arial', (255, 255, 255), (0, 0, 0), 4, (0, 0), 0, 4.0, True)
        </Action>
        <Action>
            EventGhost.Wait(0.10000000000000001)
        </Action>
        <Action>
            Window.FindWindow(u'rundll32.exe', u'Sound', u'#32770', u'', u'SysListView32', 1, False, 8.0, 0)
        </Action>
        <Action>
            Window.SendKeys(u'{Down}', False)
        </Action>
        <Action>
            EventGhost.Wait(0.10000000000000001)
        </Action>
        <Action>
            Window.FindWindow(u'rundll32.exe', u'Sound', u'#32770', u'&amp;Set Default', u'Button', 1, False, 1.1000000000000001, 0)
        </Action>
        <Action>
            Window.SendMessage(245, 0, 0, 0)
        </Action>
        <Action>
            Window.SendKeys(u'{Escape}', False)
        </Action>
    </Macro>
</EventGhost>
User avatar
jitterjames
Experienced User
 
Posts: 649
Joined: Thu Aug 13, 2009 4:36 pm
Location: Quebec, Canada

Re: Change 'Playback Devices' in Control Panel (Sound)

Postby Livin » Wed Mar 24, 2010 5:33 pm

scat,
I'm with you. I'll try out the script... I could use audio switching for when I want to play XBMC thoughout the house.

If I could get multiple audio outputs are the same time that would be nice too... do you know a way?
setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system
User avatar
Livin
Experienced User
 
Posts: 749
Joined: Wed Oct 08, 2008 4:56 am

Re: Change 'Playback Devices' in Control Panel (Sound)

Postby seth.feinberg » Tue May 10, 2011 12:20 am

I know this is old, but I thought I'd share what I found out/know (not much:)). I needed dual audio outputs because my Denon Receiver's Zone 2 only takes an Analog signal and I mostly need to use HDMI for the 5.1. After a WHOLE ton of frustration I realized that Windows 7 just flat out doesn't allow 2 audio outs (if you find out differently please let me know).

As far as a fix: I had to go into Sound under the Control panel and click on the Recording tab. There should be a Stereo Mix item (or maybe it's part of my card. either way for this to work you need to be able to record), right-click it, show properties and click on the Listen tab. Click on the "Listen to this Device" radio button and then select your HDMI Audio output from the dropdown list just below titled, "Playback through this Device" . This will have your soundcard (I think?) RECORD the sound your computer is sending out through the analog signal and then play it back through the HDMI. Then under the Playback tab of the Sound window, you'll have to make sure Speakers (your analog output) is set as the Default player and not the HDMI. Unfortunately this means only stereo (2channel) sound is outputted through the HDMI which is why I needed EventGhost, so I could create macros to switch back and forth from my Logitech remote so I can enjoy 5.1 99% of the time, but analog when I want to play music through my Zone 2.

In case you are curious these are my EventGhost's:

"Enable HDMI":
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1494">
    <Macro Name="Enable HDMI" Expanded="True">
        <Event Name="Keyboard.LCtrl+LAlt+1" />
        <Event Name="Keyboard.RCtrl+RAlt+1" />
        <Action>
            System.Execute(u'rundll32.exe', u'shell32.dll,Control_RunDLL mmsys.cpl,,0', 0, False, 2, u'')
        </Action>
        <Action>
            EventGhost.ShowOSD(u'HDMI', u'0;-48;0;0;0;700;0;0;0;0;3;2;1;34;Arial', (255, 255, 255), (0, 0, 0), 4, (0, 0), 0, 4.0, True)
        </Action>
        <Action>
            EventGhost.Wait(0.10000000000000001)
        </Action>
        <Action>
            Window.FindWindow(u'rundll32.exe', u'Sound', u'#32770', u'', u'SysListView32', 1, False, 8.0, 0)
        </Action>
        <Action>
            Window.SendKeys(u'{Down}', False)
        </Action>
        <Action>
            EventGhost.Wait(0.10000000000000001)
        </Action>
        <Action>
            Window.SendKeys(u'{Tabulator}{Tabulator}{Enter}', False)
        </Action>
        <Action>
            EventGhost.Wait(0.10000000000000001)
        </Action>
        <Action>
            Window.SendKeys(u'{Escape}', False)
        </Action>
    </Macro>
</EventGhost>


...and "Enable Analog":

Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1494">
    <Macro Name="Enable Analog" Expanded="True">
        <Event Name="Keyboard.LCtrl+LAlt+2" />
        <Event Name="Keyboard.RCtrl+RAlt+2" />
        <Action>
            System.Execute(u'rundll32.exe', u'shell32.dll,Control_RunDLL mmsys.cpl,,0', 0, False, 2, u'')
        </Action>
        <Action>
            EventGhost.ShowOSD(u'Analog', u'0;-48;0;0;0;700;0;0;0;0;3;2;1;34;Arial', (255, 255, 255), (0, 0, 0), 4, (0, 0), 0, 4.0, True)
        </Action>
        <Action>
            EventGhost.Wait(0.10000000000000001)
        </Action>
        <Action>
            Window.FindWindow(u'rundll32.exe', u'Sound', u'#32770', u'', u'SysListView32', 1, False, 8.0, 0)
        </Action>
        <Action>
            Window.SendKeys(u'{Down}{Down}', False)
        </Action>
        <Action>
            EventGhost.Wait(0.10000000000000001)
        </Action>
        <Action>
            Window.SendKeys(u'{Tabulator}{Tabulator}{Enter}', False)
        </Action>
        <Action>
            EventGhost.Wait(0.10000000000000001)
        </Action>
        <Action>
            Window.SendKeys(u'{Escape}', False)
        </Action>
    </Macro>
</EventGhost>


On an unrelated note, I'm worried about such contingencies as me accidentally firing the "Enable HDMI" EventGhost when HDMI is already enabled or maybe when the Sound dialog box is already open. Does anybody have any tips/tricks for making these a bit more idiot proof?
seth.feinberg
 
Posts: 7
Joined: Mon May 09, 2011 11:29 pm

Re: Change 'Playback Devices' in Control Panel (Sound)

Postby Koke » Sat Feb 11, 2012 11:35 pm

Anyone else looking for a solution to this, at least in windows 7, should check out: http://www.daveamenta.com/2011-05/progr ... windows-7/
Koke
 
Posts: 8
Joined: Fri Jul 10, 2009 1:52 am

Re: Change 'Playback Devices' in Control Panel (Sound)

Postby Livin » Fri Feb 17, 2012 6:13 pm

Seth,
You solutions looks good/creative. I may need to use it if I start using my whole/house audio more.

I'm not sure how you have EG setup, but I suggest using "Activity" based macros. Examples: Watch Video Library, Watch DVD/BR, Watch DVR Recorded Shows, Watch Live TV, Listen to Music Library, Listen to Radio, Listen to CD, etc
... a single Activity holds all the needed changes (apps/hardware/OS/etc), thus you should be assured you never 'accidentally' enable/disable something you need. Just map each Activity to a single button on your remote.
setup... XBMC, W7MC for DVR & Live OTA TV, JRMC for multi-zone audio, EG, MiCasaVerde Vera3, USB-UIRT IR receiver, Harmony remote, 5.2 home theater system
User avatar
Livin
Experienced User
 
Posts: 749
Joined: Wed Oct 08, 2008 4:56 am


Return to General Support

Who is online

Users browsing this forum: No registered users and 2 guests