|
|
#1 |
|
Junior Member
|
I'm writing a plug-in, and try to do some actions when Winamp starts playing a file.
Is there any way to know that Winamp is starting to play a new file? |
|
|
|
|
|
#2 |
|
Guest
Posts: n/a
|
you check here?
http://www.winamp.com/nsdn/winamp2x/dev/sdk/api.jhtml |
|
|
|
#3 |
|
Winamp3 Component Guuuru
Beta Team |
Although you can capture when someone hits play, stop, etc. Those functions won't tell you when the next song starts playing in a playlist...
I am writing a plugin that needs that ability, so I simply set a windows timer, and then poll Winamp for what the current song is and whether winamp is currently playing. If the song changed from the last time I did it - then I perform my action. Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. - Albert Einstein Winamp 3 Projects | Winamp 2x Plugin Manager | Explorer Playlist | FileSystem Object | Shoutcast List | Sashimi
|
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Nov 2000
Location: germany
Posts: 201
|
If you hook into winamp's wndProc() and catch the WM_USER+2 message then the input plugin tells winamp that the data stream has ended. After ~50ms winamp's internal buffer is then empty, too, and it will go on with the next file (if any).
So you can catch the 'stream has ended' notification, wait about 50ms and if winamp is playing after the timer fired you know that winamp is playing the next track. Regards, -Søren |
|
|
|
|
|
#5 |
|
Winamp3 Component Guuuru
Beta Team |
But then how do you capture when someone double clicks on a song in the playlist...
That does not send a Play Event the same way as hitting the Play button. Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. - Albert Einstein Winamp 3 Projects | Winamp 2x Plugin Manager | Explorer Playlist | FileSystem Object | Shoutcast List | Sashimi
|
|
|
|
|
|
#6 |
|
Senior Member
Join Date: Nov 2000
Location: germany
Posts: 201
|
Well... then capture the WM_SETTEXT message, since winamp sets its text when a new song is played.
...BUT... If 'scroll song title in taskbar' is enabled then the message will be sent a couple of times every second. That's not the problem - the problem is that each time the window caption is different ![]() So you can't make a simple string comparion to see whether there is a new title being played... Regards, -Søren PS: I just noticed that the playlist editor notifies winamp when the user wants to play a track using the WM_USER message with wParam being 0x0000029A and lParam containing the ID the track has in the playlist. I think that if you catch the [WM_USER+2 (track ends)], [WM_USER & wParam = 0x29A (new song from playlist)] and [WM_COMMAND & wParam = 40045 (user starts playing by clicking on the PLAY button or pressing the X key)] messages you don't miss any song changes. [Edited by Abraxa on 04-10-2001 at 04:24 PM] |
|
|
|
|
|
#7 |
|
Winamp3 Component Guuuru
Beta Team |
Excellent - Thanks a lot.
I'll give that a shot, I'd rather not suck time away from winamp with a timer going off every 1/4 second... Not to mention the fact that when I query Winamp for bitrate/sample rate info of the current track, it doesn't always return valid data when I do it based off of a timer. Maybe Winamp will be more ready if I do this. Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. - Albert Einstein Winamp 3 Projects | Winamp 2x Plugin Manager | Explorer Playlist | FileSystem Object | Shoutcast List | Sashimi
|
|
|
|
|
|
#8 | |
|
Senior Member
Join Date: Jun 2000
Location: Home
Posts: 269
|
Quote:
|
|
|
|
|
|
|
#9 |
|
Winamp3 Component Guuuru
Beta Team |
Even Better! I'll give that a try later...
As far as what I'm writing, its no big deal. Its an IRC notification plugin. Yes, I know there are a dozen of em - but they're all for mIRC and I use dIRC. So I'm writing one that connects to dIRC as a COM server and is very customizable. Thanks for the help. Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. - Albert Einstein Winamp 3 Projects | Winamp 2x Plugin Manager | Explorer Playlist | FileSystem Object | Shoutcast List | Sashimi
|
|
|
|
|
|
#10 |
|
Junior Member
|
Where do you catch Winamp event ?
hi everyone
i'm writing a very simple plugin which has only one purpose for now: sending the name of the song playing to another program. It's working now with a function like this: DWORD WINAPI ThreadProc(LPVOID lpParameter) { char* title; while (1) { getSongName(title); sendSongName(title); Sleep(1000); } return 0; } I don't like this solution and I'd prefer the one with Winamp events, but I can't find where do you catch them... thanks in advance |
|
|
|
|
|
#11 |
|
Senior Member
Join Date: Nov 2000
Location: germany
Posts: 201
|
Check this out: http://www1.inetmail.de/Bitfummler/gen_skeleton.zip
This small example just hooks itself into winamp's WndProc. So in order to catch some of the messages winamp receives, just place an appropriate switch()-instruction into the WndProc() function. Regards, -Søren |
|
|
|
|
|
#12 | |
|
Junior Member
|
thanks again for your help my plugin is now working just fine.
I use this method to detect a song change: code: but i'm curious and i like to see how your method works... Quote:
|
|
|
|
|
|
|
#13 |
|
Senior Member
Join Date: Nov 2000
Location: germany
Posts: 201
|
I would have posted the code here, but as this board's CODE tag sucks ass I put it here: http://www1.inetmail.de/Bitfummler/wParam666Example.c
The code should be quite clear ![]() Regards, -Søren |
|
|
|
|
|
#14 |
|
Winamp3 Component Guuuru
Beta Team |
However...
It looks as if WM_USER with a wParam == 666 can be sent more then once during a song change. So you might want to keep track of which song is currently playing, and then compare the one that is playing when the message is sent to make sure it isn't the same. Only two things are infinite, the universe and human stupidity, and I'm not sure about the former. - Albert Einstein Winamp 3 Projects | Winamp 2x Plugin Manager | Explorer Playlist | FileSystem Object | Shoutcast List | Sashimi
|
|
|
|
|
|
#15 |
|
Senior Member
Join Date: Nov 2000
Location: germany
Posts: 201
|
Yes, I've also noticed this...
One thing I forgot to mention in my last msg: It's better to use CallWindowProc() then using SendMessage() if you want to send messages to the window you hooked into - especially if you hook into winamp where you will send many messages to. Regards, -Søren |
|
|
|
|
|
#16 |
|
Junior Member
|
great
![]() thanks, now i think i understand how all this is working. |
|
|
|
|
|
#17 |
|
Junior Member
|
CallWindowProc() ?
by using callwindowproc you're sure that the message you send will not be catch by the function i use to intercept winamp message ?? i'm not sure about it
|
|
|
|
|
|
#18 |
|
Senior Member
Join Date: Nov 2000
Location: germany
Posts: 201
|
Well... it's exactly the other way round
![]() So you now found out yourself why I suggest you to use CallWindowProc(), otherways you might run into problems with SendMessage() calling your own customized WndProc() ![]() Regards, -Søren |
|
|
|
|
|
#19 |
|
Junior Member
|
thanks for all your advices Abraxa.
i went to your page with yume and i'm very interested in your project as i also have a project to do for my school which is to connect a lcd display (it's a varitronix too )to a parallel port in order to monitor programs running and system resources. that's why i needed to build this winamp plugin to get info about the song to display them...thanks again |
|
|
|
|
|
#20 |
|
Senior Member
Join Date: Nov 2000
Location: germany
Posts: 201
|
Cool thing!
I wish I would have had the chance to do such projects for school... ![]() Good luck! Regards, -Søren PS: what resolution does your LCD have? Just being curious, you know
|
|
|
|
|
|
#21 |
|
Junior Member
|
i'm not sure of the exact model of the lcd as it's one of my friend who got it in an electronic shop where the shopkeeper gave him this screen
i think it's a 128x128... i'll tell you exactly next week if you want
|
|
|
|
|
|
#22 |
|
Senior Member
Join Date: Nov 2000
Location: germany
Posts: 201
|
Yeah, would be cool
![]() Regards, -Søren |
|
|
|
|
|
#23 |
|
Member
|
Hi all. Great topic about the timer. I dont know C or C++ at all, so I don't understand a whole lot about whats going on. What I do know is Visual Basic 6 and I have almost completed my plug-in with it. Unfortunately for me, a timer is just too much of a hog on resources in VB6 and if I run it every second, sometimes the song skips the first second when I have to stop and restart due to an ID3 tag change.
Anyway, is there anyway you could port over a function that does the above for VB6? I'd like to have something like this: Private Sub Winamp_SongChanged() ...do whatever End Sub I would be forever greatful. Ethan |
|
|
|
|
|
#24 |
|
Junior Member
Join Date: Oct 2009
Location: Netherlands
Posts: 1
|
pauze event?
@wa21guy: I do now know any VB, but as far as I know, it's possible to use windows api functions from VB6, so it should be possible.
But I have another question. I have hooked the windows, and I can see the 0x29A(666) messages when a song starts or stops playing. But when I pause the song, there is no message. Can I catch the pause event somehow. I would like to detect when the users pauses the playback. (without constant polling) |
|
|
|
![]() |
|
|||||||
| Thread Tools | Search this Thread |
| Display Modes | |
|
|