Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Help with script to auto-switch output device (Read 4277 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Help with script to auto-switch output device

I have been struggling with a problem of needing 2 different output devices depending on whether I am playing 2 channel or 5.1 channel sources.  After getting an update of the ASUS driver I have eliminated the need to manually switch the ASUS and now all I need is some way to detect whether the track to be played is 2 or more channels (best case) or an .mp3 or .flac (worst case because some flacs are 2 channel) and then based on that determination set the output device to the proper setting.

Can someone please point me to a plugin that would be capable of doing this and possibly a sample script to use in the process.

Thanks!

Help with script to auto-switch output device

Reply #1
Well, fb2k doesn't really let you switch output devices like that.
elevatorladylevitateme

Help with script to auto-switch output device

Reply #2
That is too bad, however if there is a plugin that can cause even an external event of any kind (system call), then I can use something like audit to open the device page and arrow to the choice etc, so for openers can you tell me what plugin can detect the type of track that is playing?

Maybe if the developer or a hot plugin developer reads this, they can whip up something that will work.

Help with script to auto-switch output device

Reply #3
Progress - I have scripted autoit to change the device perfectly (2 scripts).  I have foo_run installed but I don't know how to write the script in foo_run to execute the autoit scripts which once I figure that out, I can at least have 2 different function keys setup to do a quick switch.

So my 3 issues at this point are:

1 - Figure out how to make foo_run run my Autoit scripts  (I can easily do this on a command line).

2 - Figure out how to execute a FB2K script at the start of play of each track

3 - Figure out how to test the number of channels in the track and then either execute the foo_run script or possible just execute my AutoIt scripts directly in this script thus eliminating the need for foo_run.

Any help would be greatly appreciated.

Help with script to auto-switch output device

Reply #4
Progress - I have scripted autoit to change the device perfectly (2 scripts).  I have foo_run installed but I don't know how to write the script in foo_run to execute the autoit scripts which once I figure that out, I can at least have 2 different function keys setup to do a quick switch.

So my 3 issues at this point are:

1 - Figure out how to make foo_run run my Autoit scripts  (I can easily do this on a command line).

2 - Figure out how to execute a FB2K script at the start of play of each track

3 - Figure out how to test the number of channels in the track and then either execute the foo_run script or possible just execute my AutoIt scripts directly in this script thus eliminating the need for foo_run.

Any help would be greatly appreciated.

I use autohotkey with this script. I run it from buttons via foo_run/
The script is a quick and dirty mod of the original ahk script published on HA originally for 0.9
it works great !

It would be great that the output device was part of the API so that dev could do that simple thing. But it seems foobar devs have always done, and continue to do what they want, not what we need.

Code: [Select]
;
; AutoHotkey Version: 1.x
; Language:       English
; Platform:       Win9x/NT
; Author:         A.N.Other <myemail@nowhere.com>
;
;
; save script in foobar folder as "outputSelection.ahk" or compile it as "outputSelection.exe"
; run script with foo_run
; for exemple C:\Program Files\foobar2000\output.ahk 0
; what is ending "0" ?
;   "0" is the first device output, if you want the 2nd
;   C:\Program Files\foobar2000\outputselection.ahk 2

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.


    SetTitleMatchMode, 2
    IfWinExist, Preferences
        Winclose
    Run, foobar2000.exe /config
        WinWait, Preferences, , 10
    
    WinActivate, Preferences            
    ControlFocus, SysTreeView321,Preferences
        
    WinGetText, win,Preferences
        IfNotInString, win, Output              
            Loop
            {send o
            WinGetText, win,Preferences
            IfInString, win, Output
            break
            }
              
ControlFocus, ComboBox1, Preferences
send, n
send, {home}
send, {Down %1%}
send, {return}

WinClose,Preferences
;Run, foobar2000.exe /stop
;Run, foobar2000.exe /play
return

 

Help with script to auto-switch output device

Reply #5
bring back this old question


Is there an alternative to %cwb_volume% ?

Help with script to auto-switch output device

Reply #6
No. Presumably it's not needed any more since title formatting is mostly reserved for formatting titles now, and not scripting volume widgets.

Posts merged from unrelated topic
elevatorladylevitateme