deandob
Jan 16 2004, 20:43
FB2K developers,
I want to run multiple instances of FB2K (via installations in separate directories) which are each bound to separate soundcards. I have a .NET application working for winamp which will play selected songs on specific winamp instances by changing the classname for each winamp instance via command line. I want to do the same thing with foobar - had a quick look in the SDK & various addons and it is not obvious how to:
- start multiple versions of FB2K with different classnames (or if there is any way to easily identify multiple Fb2K instances programmatically).
- Add a file to the playlist programmatically (I dont want to shell out to run the Fb2K command line) for a specific instance
- Clear the playlist for a specific instance.
Note I have some c++ experience but am not expert (or this would be easier). Appreciate any pointers or code samples to get me started. I am keen to replace winamp

Regards,
Dean
kode54
Jan 17 2004, 13:43
Easier than you might think. You can launch the appropriate executable with parameters to control it. /help will show you a partial list, but there are also a few undocumented commands:
"/command:blah"
"/playlist_command:blah"
"/playlist:blah"
deandob
Jan 17 2004, 16:33
Thanks for the feedback.
Any chance of doing this programatically without having to shell out to run the command line? Ideally I'd like to send windows messages (eg. WM_COMMAND) to foobar to PLAY, STOP, ADD to playlist, CLEAR playlist. I saw a winamp API wrapper for foobar a little while ago but it did not manipulate the playlist.
Regards.
Dean
Sorry to revive an old topic, but I'm trying to do the same thing as deandob, but using the commandline and I'm having no luck. I think it must be because foobar uses a mutex now? kode54 mentioned it on
this newer thread. (I'm not sure because I thought a mutex was supposed to prevent two instances of the same application running, like DC++ does).
To recap, I'd like to have two installs of foobar2000, say D:\fb2k-1 and D:\fb2k-2. If I run "fb2k-1" as the first instance and then run "fb2k-2" with a directory as a commandline parameter, the files get loaded on a second instance properly. Any further attempts to pass parameters to the first instance are "taken over" by the second one, even when using the full path to the first install.
Does anybody know of a way to achieve this? I'm no good at C/C++, but I know some VB, in case it can be done programatically.
TIA.
edit: silly typo
deandob
May 12 2005, 06:22
Multi-instance is not a feature that the foobar developers are interested in. I went ahead and wrote my own DirectX player with multi-instance capability using the DirectX SDK. The samples are pretty good to hack if you have some C++ experience.
I still use Foobar for another music application that I wrote a .NET front end for, but it shells to foobar on the command line, not very sophisticated. I have found with this method that:
1) I have a single song playlist that when you reset the playlist from the command line and play the new song the first 200 seconds of the old song play before the new one starts. I suspect this is a problem with a foobar internal buffer not being cleared properly.
2) To recognize when a song has completed in foobar and its time to load another one, I look for the foobar window title to change from the song title back to foobar, however occassionally the song title stays in the title bar once the song finishes, which stops my front end from loading the next song.
This method is pretty primitive, if anyone has any better ideas, let me know.
Regards,
Dean
seanyseansean
May 13 2005, 12:34
Aren't there functions in win32 to enumerate all windows? You could get each instance of the foobar window class, and from there work out which is which, maybe by reading the home directory for the parent process of each foobar window. Then simply sendmessage() to whatever window handle you find.
My win32 is a bit rusty i'm afraid...
foosion
May 13 2005, 13:51
Neither the window class nor any windows messages are part of the foobar2000 SDK. This is thus not a reliable or recommended way to interface with foobar2000.
seanyseansean
May 13 2005, 17:46
QUOTE(foosion @ May 13 2005, 08:51 PM)
Neither the window class nor any windows messages are part of the foobar2000 SDK. This is thus not a reliable or recommended way to interface with foobar2000.
It did seem a bit hacky. They seemed resigned to having to do it that way unfortunately due to the limitations.
IceBrain
Aug 31 2006, 12:47
Hi.
I got an idea of building a FM transmitter, connect it to a secondary sound card in order to listen to downloaded music without recording CDs. (I know, it's a bit stupid, but I'm sick of having to switch CDs. This way, I can make a 500 files playlist and let it play). Then, I found out Foobar v0.9.3.1 can't open multiple instances. So I opened OllyDbg, hacked the mutex name and <i>pronto</i>, although the "main" foobar "steals" all the command line messages (play, stop, etc).
The whole point of this post is to remind you can control the other Foobar2k using the HTTP Writer.
Oh, and excuse my english: I'm portuguese.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.