IPB

Welcome Guest ( Log In | Register )

7 Pages V   1 2 3 > »   
Reply to this topicStart new topic
COM Automation Server for 0.9, Public technology preview
foosion
post Dec 21 2005, 22:57
Post #1





Group: FB2K Moderator (Donating)
Posts: 4432
Joined: 24-February 03
Member No.: 5153



What it does

The purpose of this component is to allow other programs to control some aspects of foobar2000.

What it does not do

The component does not enable you to implement foobar2000 components in languages other than C++.

It does not enable you to control or launch more than one instance of foobar2000, be it from the same or different (installation) locations.

Features

The features implemented in 0.7 alpha 2 are:
  • querying information about the foobar2000 instance
  • querying and modifying playback state and settings
  • receiving notifications about changes in the playback state and settings
  • querying and modifying the list of open playlists
  • receiving notifications about changes in the list of open playlists
  • querying the contents of open playlists
  • querying the contents of the media libary
  • performing the default action on a playlist entry (i.e. the equivalent of double-clicking a playlist entry)
  • querying information about tracks through titleformatting
More features are planned for the final version.

Documentation

There is not much documentation yet. The existing documentation as well as the test and demo scripts/applications are included in the installer (except for the proof-of-concept web panel which is to be announced in a separate post).

Compatibility

The component requires foobar2000 0.9 or compatible.

The current release is targeted primarily at Visual Basic 6 and scripting clients. It should be useable with clients written in C++, but it has not been tuned yet for this situation.

The component has been tested successfully with clients written in the following languages:
  • Visual Basic 6
  • VBScript
  • Lua 5.0.2 with LuaCOM (some problems with event callbacks)
  • Python 2.3 with Pythonwin (no event support AFAIK)
  • C# and VB.Net (.Net 1.1)
Known installer issues

The uninstallation function fails to remove some information from the registry. The following batch file can be used to remove the entries in question from the registry:

CODE
reg delete HKCR\TypeLib\{CB8F14D8-736E-4BB7-ADCF-BE26C39B576B} /f
reg delete HKCR\CLSID\{1bffc1e4-21a6-45af-8831-5ee045281633} /f
reg delete HKCR\Foobar2000.Application.0.7 /f

The file is also available for download (see below). Windows NT4 users have to install reg.exe from the Windows NT4 Resource Kit; reg.exe is a native command on Windows 2000 and XP, I suspect it is present on later versions as well.
You have to close foobar2000 and all programs that use the installed type library to run this successfully.

Disclaimer

This is the last section between you and the download links, but please read this carefully!

This component is a work in progress. It is currently labeled as an alpha version, which is primarily due to the incomplete functionality; I try to make sure there are no bugs in the released versions, but I cannot guarantee it. The (COM) interfaces currently exposed by the component are not the ones that the will be in the final version.

While the exposed functionality is quite limited, it may be sufficient for some people. For example the access to playback controls is rather complete; on the other hand, you only get read access to the open playlists and the media library.

There is no scheduled release date for the final version. I will try to advance this component as time permits.

Download

Installer
Registry cleaner tool (not necessary for latest versions, see below)

This post has been edited by foosion: Jun 12 2006, 14:15


--------------------
http://foosion.foobar2000.org/ - my components for foobar2000
Go to the top of the page
+Quote Post
LTourist
post Jan 3 2006, 20:21
Post #2





Group: Members
Posts: 58
Joined: 19-September 05
Member No.: 24563



Hi,

First, THX for this wonderful, usefull plugin!! biggrin.gif I'm working on it for a few times on vb6, and I can do all I want, execpt one thing : I can't find a fonction wich would able me to know which tracknumber is playing in the playlist, or wich is selected. Or this will be pretty good for the program I code.... Is this planned for future version, or am I just a blind man?? smile.gif

THX

PS : I know you didn't schedule any release dates, but do you know if the next version (even beta like this one) will be come soon? biggrin.gif Because I'm so hungry of a new version tongue.gif
Go to the top of the page
+Quote Post
foosion
post Jan 3 2006, 20:25
Post #3





Group: FB2K Moderator (Donating)
Posts: 4432
Joined: 24-February 03
Member No.: 5153



Version 0.7 only has rudimentary playlist support, a later version will add more functionality in that area, though a release date is completely unknown.


--------------------
http://foosion.foobar2000.org/ - my components for foobar2000
Go to the top of the page
+Quote Post
LTourist
post Jan 3 2006, 20:54
Post #4





Group: Members
Posts: 58
Joined: 19-September 05
Member No.: 24563



ok, Thanks wink.gif
Go to the top of the page
+Quote Post
mazy
post Jan 5 2006, 15:40
Post #5





Group: Members
Posts: 680
Joined: 11-July 03
From: Brno, Czech Rep.
Member No.: 7705



great work foosion. is there any delphi example too? i remember seeing it in older version ...

i know that this is of much more use to the community, though you can guess what i would prefer wink.gif. i'm afraid i would have to abandon my lua scripts when 0.9 final comes. not willing to do so, however ...


--------------------
info about my tag guesser script for foo_lua (preview version available):
http://www.hydrogenaudio.org/index.php?showtopic=16987
Go to the top of the page
+Quote Post
Ran Sagy
post Jan 7 2006, 18:00
Post #6





Group: Members
Posts: 462
Joined: 30-March 04
From: Israel
Member No.: 13133



foosion, I tried messing with it in mIRC's com scripts, couldnt get alot to work, but the no-argument functions worked fine, like the media library count. Poke me on irc if you know how to use mIRC's com $idents to control foobar further (i couldnt get it to work exactly right after a few hours of fiddling).

Is there a C# example aswell? seeing as you commented it was tested successfully with it.
Go to the top of the page
+Quote Post
LTourist
post Jan 8 2006, 17:14
Post #7





Group: Members
Posts: 58
Joined: 19-September 05
Member No.: 24563



Why some formattgin string won't wotk with COMServer, %isplaying% for example every return a "?", but if I put it in foobar2000, it works fine....
Go to the top of the page
+Quote Post
foosion
post Jan 8 2006, 17:41
Post #8





Group: FB2K Moderator (Donating)
Posts: 4432
Joined: 24-February 03
Member No.: 5153



QUOTE (ChaosBladE @ Jan 7 2006, 06:00 PM)
foosion, I tried messing with it in mIRC's com scripts, couldnt get alot to work, but the no-argument functions worked fine, like the media library count. Poke me on irc if you know how to use mIRC's com $idents to control foobar further (i couldnt get it to work exactly right after a few hours of fiddling).
*

Sorry, I have no experience what-so-ever with mIRC scripting. Perhaps you can get some help about COM scripting in general from the mIRC people. I'll see what I can do, if the problem can be traced to my implementation in foo_comserver.

QUOTE (ChaosBladE @ Jan 7 2006, 06:00 PM)
Is there a C# example aswell? seeing as you commented it was tested successfully with it.
*

The C# code for the latest version needs to be cleaned up, before I will include it in the installer.

QUOTE (LTourist @ Jan 8 2006, 05:14 PM)
Why some formattgin string won't wotk with COMServer, %isplaying% for example every return a "?", but if I put it in foobar2000, it works fine....
*

There are several possible reasons for this. A Track (or Tracks) object does not remember where it originated from, so even if you retrieve the tracks contained in a playlist, you will not be able to access any playlist specific information on the returned object.
On the other hand, the FormatTitle method on the Playback object is hardcoded to use a "display level" that does not include all dynamic information. You can use FormatTitleEx to explicitly set a display level. The possible values for the display level come from the fbDisplayLevel enumeration in the type library. The numeric values for the enumeration members are 0 to 3, where 0 corresponds only to basic static information and 3 means all dynamic information including the current bitrate and the like.


--------------------
http://foosion.foobar2000.org/ - my components for foobar2000
Go to the top of the page
+Quote Post
LTourist
post Jan 8 2006, 19:04
Post #9





Group: Members
Posts: 58
Joined: 19-September 05
Member No.: 24563



OK, thanks for helping us wink.gif
Go to the top of the page
+Quote Post
Ran Sagy
post Jan 12 2006, 18:43
Post #10





Group: Members
Posts: 462
Joined: 30-March 04
From: Israel
Member No.: 13133



foosion, Thanks for the reply. I'll try to mess with the mIRC Scripting side some more and wait for the C# example aswell.
Go to the top of the page
+Quote Post
foosion
post Jan 15 2006, 20:01
Post #11





Group: FB2K Moderator (Donating)
Posts: 4432
Joined: 24-February 03
Member No.: 5153



There is a bug in the Volume property: if you retrieve the value, it is scaled down by a factor of 0.01; setting the volume works normally.

Please redownload the installer to get a fixed version (no other changes for now).


--------------------
http://foosion.foobar2000.org/ - my components for foobar2000
Go to the top of the page
+Quote Post
Ran Sagy
post Jan 15 2006, 23:47
Post #12





Group: Members
Posts: 462
Joined: 30-March 04
From: Israel
Member No.: 13133



Thanks for the heads up.
Go to the top of the page
+Quote Post
matthijs
post Jan 18 2006, 20:49
Post #13





Group: Members
Posts: 7
Joined: 18-January 06
Member No.: 27192



Hey, this is really cool.
Thanks for writing this foosion, a friendly foobar2k event sender to other applications is exactly what I needed. biggrin.gif

However, I'm running into a strange bug(?).
I have referenced the foobar COM component in my C# project, and have added the following (pseudo)code:
CODE
private void connectFoobar()
{
// Connect to foobar
foobar = new Application07Class();
foobar.Playback.PositionChanged += new _IVBPlaybackEvents_PositionChangedEventHandler(Playback_PositionChanged);
}

private void Playback_PositionChanged(double dSecondsFromStart, bool bSeekFlag)
{
info.Position = (int)dSecondsFromStart;
// Draw track information to Logitech G15 LCD.
}

This works for 5 or 6 events, then I stop recieving events.

(.. after many edits of this post..)
Aha, it appears calling the garbage collector (GC.Collect()) stops me from recieving COM events. This is why I stop recieving events after 5 or 6 memory-intensive operations. After a couple hundred k's of memory have been moved the GC is called.
I could try to fix this or use a timer instead. I'm glad to have found the cause anyways. biggrin.gif

This post has been edited by matthijs: Jan 18 2006, 22:17
Go to the top of the page
+Quote Post
foosion
post Jan 18 2006, 22:48
Post #14





Group: FB2K Moderator (Donating)
Posts: 4432
Joined: 24-February 03
Member No.: 5153



Short version:

You should store a reference to the Playback object somewhere; then you can safely invoke the GC.

Long version:

There is only a single Playback object on the COM side. This COM object is wrapped into a CLR object of type Playback07Class when you access it in C#. Similarly the delegates you create translate between the COM event mechanism and that of the CLR. After you create and register a delegate, it is only referenced in the wrapper class instance (Playback07Class). So unless you keep a reference to the wrapper object, this object and all the delegates can be finalized by the GC anytime, causing them to clean up things on the COM side, i.e. releasing the reference to the wrapped COM object and removing the event subscriptions.


--------------------
http://foosion.foobar2000.org/ - my components for foobar2000
Go to the top of the page
+Quote Post
foosion
post Jan 19 2006, 21:12
Post #15





Group: FB2K Moderator (Donating)
Posts: 4432
Joined: 24-February 03
Member No.: 5153



foo_comserver2 v0.7 alpha 4

Changes:
  • Added helper COM object to detect if server is running (also supports start and exit events)
  • Updated example for Visual Basic 6
  • Added test script for the helper object for VBScript
  • Added example for C#
  • Uninstaller now cleans registry (self-unregistration of foo_comserver2.dll is still broken)

The helper object can be used to detect when the server is starting or exiting. However proper error handling does not become unncessary because of this: 1) you receive the exit notification after the server has exited, and 2) the notification is only sent if the server terminates gracefully (in other words: when foobar2000 does not crash).
The C# example implements rigorous error checking by protecting every access to the server (the Foobar2000.Application.0.7 object and all objects reachable through it) with a try-catch block.

The helper object is implemented in a separate EXE (COMServer2Helper.exe). This EXE starts when a client accesses the Foobar2000.ApplicationHelper.0.7 object and - assuming all clients behave correctly - exits when it is no longer needed. At the moment the server also keeps a reference to the helper as long as it is running, so in effect the helper always runs when foobar2000 is running. This may change in future versions so that the helper is only running when it is indeed used by clients.

If you do not want to use the helper, you can unregister it running the following command on the command line:
CODE
COMServer2Helper.exe /UnregServer

To reenable the helper, use:
CODE
COMServer2Helper.exe /RegServer

(The commands are actually not case-sensitive... wink.gif)

Disabling the helper has no negative effects on the server.


--------------------
http://foosion.foobar2000.org/ - my components for foobar2000
Go to the top of the page
+Quote Post
matthijs
post Jan 19 2006, 22:27
Post #16





Group: Members
Posts: 7
Joined: 18-January 06
Member No.: 27192



QUOTE (foosion @ Jan 18 2006, 10:48 PM)
Short version:
You should store a reference to the Playback object somewhere; then you can safely invoke the GC.

Yay, this and the new C# example have allowed me to finish my code.
I now have a very efficient application which shows Foobar2000 information on a Logitech G15 LCD. Thanks for making it possible. smile.gif
Go to the top of the page
+Quote Post
Ran Sagy
post Jan 19 2006, 23:36
Post #17





Group: Members
Posts: 462
Joined: 30-March 04
From: Israel
Member No.: 13133



We'll be working on a foobar2000 display in GTSdll v2 (for mIRC spamming and such).
Go to the top of the page
+Quote Post
david_dl
post Jan 22 2006, 05:25
Post #18





Group: Members
Posts: 604
Joined: 17-December 05
From: New Zealand
Member No.: 26461



I was just wondering how much functionality this plugin would eventually provide. It would be very cool to be able to script repetitive stuff using this plugin. For example, when I (legally) download an album in the format of an APE cd image and a cue file, within a zip file, I have to:

1. Extract the file

2. Reencode APE to FLAC

3. Embed cue-sheet in FLAC usign CUESHEET tag

4. Move .flac to D:\music\artist\album

5. Add it to foobar's database

6. Delete all the original files.

Almost all of this can be done through foobar and its components, so if I could access this functionality from COM, it would be very easy to make a JScript or similar completely automating this.

I'm not sure how easy it would be for you to provide the functionality of other components that might/might not be installed, perhaps this could be done within the plugins themselves, eg. foo_comserver would provide a QueryComponents function through which a script can discover, if, for example "diskwriter" is available, and retrieve an interface through which its functionality can be accessed.

I have no idea on how this would best be done, but it would be very very cool if it was possible cool.gif

And of course using COM instead of some sort of internal scripting makes many other cool things possible, eg. in the example above, the resultant file could also be added to iTunes's library using it's COM interface, and even transcoded and loaded onto an iPod. The ultimate in laziness.
Go to the top of the page
+Quote Post
foosion
post Jan 22 2006, 20:29
Post #19





Group: FB2K Moderator (Donating)
Posts: 4432
Joined: 24-February 03
Member No.: 5153



The functionality available through foo_comserver2 will always be a subset of what can be done programmatically on the foobar2000 side. So for the most part this will be things that every component could do using just the SDK. This will include access to the playback engine (mostly complete already), the playlist, the media library (not much there right now, but not much to add either) and perhaps tagging (haven't decided yet).

As for access to other (third-pary) components, well, many of those (including masstagger and converter) cannot be controlled from other components anyway, so binding them to COM is not possible without extra work (by the author of the specific component).

In short, automating what you sketched out above will stay a dream for the foreseeable future.


--------------------
http://foosion.foobar2000.org/ - my components for foobar2000
Go to the top of the page
+Quote Post
darkain
post Feb 4 2006, 05:04
Post #20





Group: Members
Posts: 89
Joined: 19-June 04
From: Tacoma, WA
Member No.: 14782



Error: "This application has failed to start because shared.dll was nout fid. Re-installing the application may fix this problem."

ERROR (CORE) : Failed to load DLL: foo_comserver2.dll, reason: Unable to load DLL.

sad sad.gif i wanted to try this out, too...


--------------------
-=- Darkain Dragoon -=-
Go to the top of the page
+Quote Post
darkain
post Feb 4 2006, 06:19
Post #21





Group: Members
Posts: 89
Joined: 19-June 04
From: Tacoma, WA
Member No.: 14782



oh, heh, i'm sorry, i found the problem... it installed to the wrong foobar installation on my system. (thats what i get for having billions of test installs of every app imaginable)...

however, now that COM stuff is wokring, LuaCOM isnt. it just keep crashing. oh well. i'll look into it more a bit later. smile.gif


--------------------
-=- Darkain Dragoon -=-
Go to the top of the page
+Quote Post
jimbo11883
post Feb 25 2006, 20:38
Post #22





Group: Members
Posts: 59
Joined: 28-September 04
Member No.: 17362



It seems the Playback.Back and Playback.Forward commands do not work.

I've tried recompiling my program.

I've installed foobar2000 and the COM Automation Server on a clean copy of Windows XP.
Go to the top of the page
+Quote Post
foosion
post Feb 25 2006, 22:19
Post #23





Group: FB2K Moderator (Donating)
Posts: 4432
Joined: 24-February 03
Member No.: 5153



QUOTE (jimbo11883 @ Feb 25 2006, 08:38 PM)
It seems the Playback.Back and Playback.Forward commands do not work.
*
Well, they simply do not exist. There are only Playback.Previous() and Playback.Next().


--------------------
http://foosion.foobar2000.org/ - my components for foobar2000
Go to the top of the page
+Quote Post
jimbo11883
post Feb 25 2006, 23:59
Post #24





Group: Members
Posts: 59
Joined: 28-September 04
Member No.: 17362



QUOTE (foosion @ Feb 25 2006, 04:19 PM)
QUOTE (jimbo11883 @ Feb 25 2006, 08:38 PM)
It seems the Playback.Back and Playback.Forward commands do not work.
*
Well, they simply do not exist. There are only Playback.Previous() and Playback.Next().
*


Sorry, that is what I meant. I should clarify by saying that when I use the Previous() and Next() commands, they don't move to the next or previous item in the playlist.
Go to the top of the page
+Quote Post
foosion
post Feb 26 2006, 02:15
Post #25





Group: FB2K Moderator (Donating)
Posts: 4432
Joined: 24-February 03
Member No.: 5153



Thanks for reporting. This was due to a bug in the SDK. Fixed version of COM server should be up tomorrow.


--------------------
http://foosion.foobar2000.org/ - my components for foobar2000
Go to the top of the page
+Quote Post

7 Pages V   1 2 3 > » 
Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 18th September 2014 - 12:14