Hotkey to automate


#1

So I do a lot of things with Stream What You Hear frequently and need some help with automating it.

  • After it loads at startup, I need a way to connect it to a specific UPnP/DLNA renderer automatically and mute my system audio volume automatically too
  • If it can’t do that then at least give me a hotkey (keyboard shortcut) to connect to the 1 UPnP/DLNA renderer it finds and that same hotkey could mute my main volume.

Is that doable? It will save me a lot of repetitive steps which I have to do every time to play audio to some renderer.

Thank you.


#2

Alternatively, if there was some command line supported to stream to a specific UPnP/DLNA renderer, I could combine it in a batch file or script.


#3

OK I got it working after reading this topic: http://www.streamwhatyouhear.com/forums/topic/what-is-correct-syntax-for-command-line/

This software is amazing. I am telling everyone about it.

Btw, it would still be nice if there was a direct hotkey supported to connect to some renderer and press it again to disconnect and unmute local audio.


#4

Here is a simple AutoHotKey script to toggle Stream What You Hear using the hotkeys Ctrl+Shift+S. You can of course modify the --streamto portion to include your UPnP/DLNA renderer’s name so it starts directly streaming to it:

^+s::StartClose(“SWYH.exe”)

StartClose(exe)
{
Process, Exist, %exe% ; check to see if program is running
If (ErrorLevel = 0) ; If program is not running -> Run
{
Run, C:\Program Files (x86)\Stream What You Hear\SWYH.exe --streamto:
}
Else ; If program is running, ErrorLevel = process id for the target program -> Close
{
Process, Close, %ErrorLevel%
}
}


#5

Here is the final version. It starts Stream What You Hear rendering to my UPnP/DLNA renderer and mutes the system volume when you press Ctrl+Shift+S (for Stream). Press Ctrl+Shift+S again and it will exit SWYH and unmute your system volume):

^+s::StartClose(“SWYH.exe”)

StartClose(exe)
{
Process, Exist, %exe% ; check to see if program is running
If (ErrorLevel = 0) ; If program is not running -> Run
{
Run, C:\Program Files (x86)\Stream What You Hear\SWYH.exe --streamto:“foobar2000 Renderer (User) [Gaurav-PC]”
SoundSet, 1, , mute
}
Else ; If program is running, ErrorLevel = process id for the target program -> Close
{
Process, Close, %ErrorLevel%
SoundSet, 0, , mute
}
}


#6

If you experience audio dropouts, add a line:
Process, priority, SWYH.exe, High

After

Run, C:\Program Files (x86)\Stream What You Hear\SWYH.exe –streamto:“foobar2000 Renderer (User) [Computer-Name]”

and before:

SoundSet, 1, , mute

This raises the Process priority of Stream What You Hear so you will never experience audio pops/clicks/dropouts.