PDA

View Full Version : Remote Control Winamp?


hipopony66
18th May 2002, 03:35
Ok, I know this can be done, and I can't find an .OCX out there anywhere. I want to remote control winamp with my VB application. I've created some custom Mp3 organizing software for myself and some friends, and I'm tired of playing my mp3s through Windows Media Player. Winamp is 100 times better. I'm looking for something that when you click the play button etc. in my program, it will click the play button in winamp. I'm dealing with Winamp 2.0 +. I can ShellExecute a file with winamp, but my problem is I can't check to see when the file is done playing. In the mediaplayer.ocx you have an ENDOFSTREAM event. So basically I want to be able to remote pretty much anything in Winamp, including the slider progress bar. Any info anyone can give on this is extremely appreciated. I'm sick of Mediaplayer. Thanks

-Jeremy

Gourou
18th May 2002, 12:11
there isnt a good one, not a really good one anyway, gimme a list of every single thing you want to get from winamp and I'll make your ocx

hipopony66
18th May 2002, 15:01
I want to be able to click the all the basic buttons (Play, Pause, Stop, Forward, Back, eject). I want to be able to remote these buttons as well as the progress slider bar. Nothing fancy really. Also, if possible I'd like to get info from winamp such as bitrate, sampling rate, etc. However, this is not required, just if you have time. Basically, I just want to control the basic player functions and the slider.

Gourou
19th May 2002, 02:09
ok, it's in the works right now

Gourou
19th May 2002, 15:33
I'm gonna make an activeX dll, that way you can make your own gui and stuff, it wont make it any harder either.

hipopony66
19th May 2002, 18:09
I appreciate it

Aus
20th May 2002, 22:29
just make generic message pump that does sendmessage() with the correct messages to winamp.

You can also manipulate the playlist, but, it's not documented very well...

I'll try and write some sample code that does winamp2x playlist insertion and swapping.

Gourou
20th May 2002, 23:05
and what did you think I was doing? :)

Aus
20th May 2002, 23:16
I always like to make sure that people are going for the ideally reusable solution. :)

saruman
22nd May 2002, 05:48
For my school project I am creating a remote just as you described it, and with alot of success. I'm using VB plus my own hardware to communicated with the computer through the com port. I've so far worked out all bugs except for loading preset playlists (buttons 1-3).
However my program doesn't work unless you use my hardware, if you're interested in any of my project, I am happy to tell you anymore information, or every sell you the finished product once done.
Anthony
:up:

Gourou
23rd May 2002, 22:22
gimme another day, I havent had a day off, so far I have it all hashed out, but there are a couple bugs as yet

Gourou
24th May 2002, 02:16
copy the dll to preferably the same directory as your exe, reference it from visual basic, called WinampCommandControl, then make a declare, Dim wcc As New WinampCC, also can be, Dim whatever As New WinampCC_HWND, the second requires you to supply the HWND value of the winamp you wish to control for each you call, meaning, whatever.BitRate(winamp1HWND), to get the song file, or song title, call wcc.SongTitle(-1), to get the current songs title, or wcc.SongTitle(22) to get the song title at playlist position 23, cuz it starts at 0 :p also, I can add calls to get the current length of the playlist, and the current position, just give me a holler back and I'll add those, and nearly anything else you can think of.

Gourou
24th May 2002, 02:53
plz note: this is NOT a plugin, it's an ActiveX dll to be called from inside visual basic, it can control any winamp, and it doesnt require that winamp be started to access the dll, since it isnt a plugin.

Gourou
24th May 2002, 22:17
fixed a song length bug..

Gourou
24th May 2002, 23:52
I'm nice like this, and I hope ppl appreciate it
the source code....

:up:

ibsteveog
29th May 2002, 06:02
Originally posted by hipopony66
So basically I want to be able to remote pretty much anything in Winamp, including the slider progress bar.
-Jeremy

You can get all the info regarding song length and position using IPC_GETOUTPUTTIME. Here's the definition from frontend.h.

#define IPC_GETOUTPUTTIME 105

/*
** int res = SendMessage hwnd_winamp,WM_WA_IPC,mode,IPC_GETOUTPUTTIME);
**
** IPC_GETOUTPUTTIME returns the position in milliseconds of the
** current song (mode = 0), or the song length, in seconds (mode = 1).
** Returns -1 if not playing or error.
*/

If you need an ocx, then I think you've already got that from another poster here, but if you just wanted to send some messages then I think this would do it. Just poll using this SendMessage and you should be set.

Stephen

hipopony66
31st May 2002, 18:19
That DLL should be very useful to me. Thanks for all of your help.

biscoradio
3rd June 2002, 20:00
First of all, thanks for the dll. I think it'll help me a bit.

However, I am having a little bit of a problem getting it to find my winamp window, and perhaps it is because I'm attempting to use it through an asp page. I'm hoping to use your DLL to create a good song/folder request program for my radio station. Here's the code I'm running just to test out the page.

<%@ LANGUAGE="JSCRIPT" %>
<HTML>
<TITLE>winamp test dll</TITLE>
<BODY>

<%
wcc=Server.CreateObject("WinampCommandControl.WinampCC")
Response.Write(wcc.Playstatus())
wcc.Stop_Normal()

%>

</BODY>
</HTML>


The object is created, but Playstatus is always 0, if I try to get song title or position, I get 0 as well. And of course, Stop_Normal or any other command does not work. Any idea what I'm doing wrong? I registered the DLL and am running Winamp 2.76 on Win2K.

Thanks!
rob

Gourou
3rd June 2002, 23:06
you need to go into the Services, and go down to whatever you are using as a web server, right click and click stop, then right click again and click properties, on the second tab is a checkbox, allow this service to modify the desktop, turn that on, hit ok, then start the server, it should work now

biscoradio
4th June 2002, 00:02
Thanks for the quick reply. I am using IIS. I went through and checked the box to allow interaction with the desktop for both the World Wide Web Publishing Service and then the IIS Admin Service. (After giving access to the desktop for WWW and it not working, I figured I might as well try the admin service just in case)

Any other ideas or suggestions? As far as I can tell it should work, and it seems to be creating the object properly, it just isn't finding the window. I only have one instance of winamp running.

Thanks again,
Rob

I'll be happy to post all my code for the song/directory request program once I'm done with it.

Gourou
4th June 2002, 14:57
that was my problem with apache, have you restarted both services?, stopped them, then started them again?
IIS might be accessing something else, I could try and see what it could be doing, if you can wait a bit I'll move my cgi script over to IIS and check it out.

biscoradio
4th June 2002, 16:30
Hey-

Yeah, I stopped and restarted both services, no luck. Stopped and restarted them both again, didn' work. Rebooted, made sure the properties stuck within the services (so they could both interact with the desktop) and it still doesn't work. I'm quite sure it is not a problem with your DLL, but it seems to be a goofy IIS thing. We know it is creating the object, though. I'll test it out on another computer tonight if I don't figure it out today.

Thanks for your help & for making this dll,
rob

Gourou
5th June 2002, 02:45
I copied out your asp, I see your problem, and I'm looking for a solution, but I have a feeling there isnt one :( IIS has application protection built in, the lowest level you can get is the IIS level, which means it's blocking you into the IIS memory pool, making calling dll's from outside ineffective if they modify the desktop. :(
I'm still looking, still working on it, if you can convert it to VB cgi, that might be a solution, or I can give you a cgi script to do it.

Gourou
5th June 2002, 04:02
I went on a web rampage for your answer, then a bit of detective work, IIS is, as I said, locking your ASP page, and the dll you call into a protected mode memory space, making any calls to outside of that space null, so nothing gets returned, you are getting 0 as the result because that's what it returns if it fails to find winamp, which is what's happening, you can see this using wcc.WHWND()
I went to codehound and looked there, only to find that you are not alone, any component access to the desktop is prohibited, and the solutions I found were insane, such as using sockets or IP connections to an EXE that is external to the server :p
I hope this at least answers the confusion, if you still would like to use this dll, as I said, I can write you a cgi script that will run under apache, I can even write you a stand alone program to do it, if you need it, this can be left up, and need not be a plugin of winamp, so you can close winamp and not get Page Not Found errors. just ask, and I'll send a cgi script over, or the program.

Gourou
5th June 2002, 04:17
btw, to prove that, that dll works, and cgi under apache works, check out right under the title here: http://efnx.ath.cx
it's a valid live title update, it refreshes every 5 seconds, and it will change as soon as the song is over. I'm working on adding the time left, and total to it also :up:

biscoradio
5th June 2002, 05:08
Hey-

Thanks for looking into it further for me. I looked into it a little bit as well, and found the same info you did.

I would love to take a look at your cgi script. I can run apache on this server, no problem. I haven't done any cgi scripting, but it can't be too difficult.

Thanks for the dll and all the help.
rob

Gourou
5th June 2002, 23:26
this is a work in progress, what I'm going to do is post a link up here to a website, that way I dont have to keep adding on every time I add a feature. This cgi is written in VB, and I'm thinking about putting the source code up here, but PLEASE!!! dont steal the code, ASK me first, the only reason I ask that is to see where this code is going.
The basis is simple, it works just like most parsers, it reads a text file you specify in the url, parses it and checks for certain strings, I would be willing to add any string to search for, and any style of formatting, if only people would give me feedback, I have loops for listing the song titles, with a seperate file for if you had a table that needed to repeat, I have options for admin controls of winamp, and am actively working to make a queue, the queue would also be independant of winamp, and the cgi supports more than one instance of winamp, or will soon anyway :p
this also supports filesets, which allows you some organization when it comes to your site, allowing multiple sets of the same file.
I am also looking into admin controls and true playlist editing, but we'll see.

Gourou
6th June 2002, 02:05
http://cgi-proggy.efnx.ath.cx