Author Topic: SDK to allow writing a "remote control" plugin ?  (Read 11367 times)

Simon George

  • Guest
Hi,

I'm looking for a way to drive XMPlay programatically (eg. for a "remote control" plugin).  Currently I am aware of only input and DSP plugin SDKs - both of which act on the currently playing song.  As I want to control *which* song is actually playing, neither are useful :(

Is there any way of doing this currently (or planned for the future) ?

Thanks in advance,

Simon

Dotpitch

  • Posts: 2878
Re: SDK to allow writing a "remote control" plugin ?
« Reply #1 on: 13 Feb '09 - 08:19 »
DSP plugins have access to the playlist and can control which track is playing, xmp-wavis can do this. I don't know what other controls are implemented though. What actions would you like to perform?

Simon George

  • Guest
Re: SDK to allow writing a "remote control" plugin ?
« Reply #2 on: 13 Feb '09 - 09:17 »
Ok thanks - ideally I would like to access the library itself and make a dynamic playlist from whatever songs the user wants to queue remotely (say all songs from ablum X by artist Y). 

I guess I could make a playlist out of all the songs in the library (like https://www.un4seen.com/forum/?topic=9445.0) and then manipulate that.  What functions would I call to get a playlist item based on metadata (artist, album, etc) ?  Something from XMPFUNC_FILE or XMPFUNC_MISC maybe ?  Nothing in there seems immediately obvious...

The drawback with this approach is that it would require more work my end - I would have to skip between arbitrary items in the playlist in order to aceive my "dynamic" list (If I'm right, XMPlay only has one "in memory" playlist at a time - unlike foobar ?).  Another drawback is that a "whole library" playlist doesn't get updated when new songs get added to the library.

So, possible to (just) do what I want maybe but would be a whole lot easier with (read-only) access to the library itself.

Thanks again,

Simon

Barna

  • Posts: 107
Re: SDK to allow writing a "remote control" plugin ?
« Reply #3 on: 16 Feb '09 - 18:01 »
Hi there

Here's some code that I was able to come up with after a few hours.
This xmplay plugin runs a webserver which allow some simple functions. It can list the current playlist and jump to an entry. Searching through the library and playing a song from it is also possible. It doesn't depend on the XMPlay plugin API for the library feature as there are no functions related to the library (as far as I know). It parses the entire library independent from XMPlay itself. Means that changes are only visible after the plugin gets reloaded and also that the same data ends up being in memory twice.
It adds library files through DDE as I couldn't find another way within the API or the supported Winamp IPC calls. Another option would be through the command line (-list). At least that would support adding URL entries (doesn't work via DDE). Not sure about Unicode then though. Unicode file names work fine via DDE.

http://www.nukular.ch/xmp-remcon.cpp

Greetings from Tokyo,
Bernhard

Ian @ un4seen

  • Administrator
  • Posts: 26178
Re: SDK to allow writing a "remote control" plugin ?
« Reply #4 on: 17 Feb '09 - 14:34 »
Ok thanks - ideally I would like to access the library itself and make a dynamic playlist from whatever songs the user wants to queue remotely (say all songs from ablum X by artist Y). 

There isn't currently any way for plugins to access/manipulate the library/playlist entries, but it is something that I have been thinking of adding for 3.5, eg. the ability to add/remove tracks and get their tags/etc. If you like, I could probably whip something together for you to try.

Here's some code that I was able to come up with after a few hours.

Clever! :)

Elrinth

  • Posts: 141
Re: SDK to allow writing a "remote control" plugin ?
« Reply #5 on: 1 Mar '09 - 22:31 »
thanx for sharing barna!

I built a dll outta it and xmplay says it's loaded (my xmplay.log says so atleast), tho I can't get it to work.
I changed the portnr in the cpp to 6113 and I try to connect to http://127.0.0.1:6113 when playing a tune and nothing is shown.
The plugin doesn't show up in any of the options/preferences/config stuff. hmmm what have I done wrong?
I built it using this:
http://www.un4seen.com/download.php?xmpdsp

Barna

  • Posts: 107
Re: SDK to allow writing a "remote control" plugin ?
« Reply #6 on: 2 Mar '09 - 08:14 »
You need to add it under Options and Stuff -> Plugins -> DSP and general plugins (select XMPlay Remote Control from the dropdown and click Add). From that moment on the web server should be running.

Elrinth

  • Posts: 141
Re: SDK to allow writing a "remote control" plugin ?
« Reply #7 on: 3 Mar '09 - 09:48 »
It doesn't show up there  ???

raina

  • Posts: 1163
Re: SDK to allow writing a "remote control" plugin ?
« Reply #8 on: 3 Mar '09 - 18:20 »
How about updating to http://un4seen.com/stuff/xmplay.exe and seeing if it shows up in Options and stuff > Plugins? (The pull down menu.)

Elrinth

  • Posts: 141
Re: SDK to allow writing a "remote control" plugin ?
« Reply #9 on: 4 Mar '09 - 19:17 »
I tried with that exe too, but it won't show up. I'm guessing the dll is at fault somewhere. I built with visual studio 8 pro. had to change character set to Not Set from Unicode for it to build at all because else it would say some character strings weren't okay...

Dotpitch

  • Posts: 2878
HTTP remote control plugin
« Reply #10 on: 4 Jun '10 - 20:36 »
Dead thread revival... sorry about that ;D.

So, remote control over HTTP is on the Suggestions for 3.6-list, and Barna gave a nice example of some code over a year ago. Ian pointed out to me why it's not working properly.
Regarding why you may have had trouble building/loading it, that was probably due to it being C++, resulting in the XMPDSP_GetInterface2 function name getting mangled. To fix that, do this...
Code: [Select]
extern "C"
XMPDSP *WINAPI XMPDSP_GetInterface2(DWORD face, InterfaceProc faceproc)
{
...
Test build by Ian is here. It can be loaded by XMPlay and display the playlist, but it can't read the library or change the currently playing song yet. The library format changed a bit with 3.5 (rating information), so the library parser should be adapted. I myself have no experience in C/C++ programming (seriously, none at all...), so would someone else be willing to work on this? Know that you can count on a lot of support and testers!

Ian @ un4seen

  • Administrator
  • Posts: 26178
Re: SDK to allow writing a "remote control" plugin ?
« Reply #11 on: 7 Jun '10 - 15:25 »
Yep, the library processing just needed updating for the 3.5 format. Here's an updated build (and source)...

   www.un4seen.com/stuff/xmp-remcon.zip

Ian @ un4seen

  • Administrator
  • Posts: 26178
Re: SDK to allow writing a "remote control" plugin ?
« Reply #12 on: 25 Nov '16 - 17:00 »
Bump! In case any one would like to use this plugin with XMPlay 3.8.2, here's an update:

   www.un4seen.com/stuff/xmp-remcon.zip