|
![]() |
#1 |
Junior Member
Join Date: May 2010
Posts: 37
|
Using IPC_SETPLAYLISTPOS
Hey again!
I need some help using "IPC_SETPLAYLISTPOS". I want to set the playlist position to 2 for example and then play that song. Right now I'm trying to it this way: Step 1. Pause the current song with WM_Command 40046 (pause/unpause) Step 2. set the playlist position using SendMessage(plugin.hwndParent,WM_WA_IPC,2,IPC_SETPLAYLISTPOS); Step 3. Here I want to start playing the song that has position 2. Any hints? |
![]() |
![]() |
![]() |
#2 | |
Join Date: Sep 2003
Posts: 27,873
|
Quote:
-daz |
|
![]() |
![]() |
![]() |
#3 |
Junior Member
Join Date: May 2010
Posts: 37
|
Thanks! I totally missed that about SETPLAYLISTPOS. But I keep getting "undeclared identifier" when trying to use "WINAMP_BUTTON2" for some reason.
|
![]() |
![]() |
![]() |
#4 |
Join Date: Sep 2003
Posts: 27,873
|
WINAMP_BUTTON2 should be defined in wa_msgids.h (was in an unofficial sdk i did and is something that is otherwise defined in the internal Winamp code). http://nunzioweb.com/daz/winamp/sdk/winamp/wa_msgids.h should be what you want.
-daz |
![]() |
![]() |
![]() |
#5 |
Junior Member
Join Date: May 2010
Posts: 37
|
Further problems, just using SETPLAYLISTPOS and WINAMP_BUTTON2 the following code is stuck on the first song in the playlist. It should progress to the next song in the playlist but it doesn't.
PHP Code:
|
![]() |
![]() |
![]() |
#6 |
Join Date: Sep 2003
Posts: 27,873
|
what do you mean by 'stuck' ? do you mean it only ever plays the first playlist item or is it causing Winamp to lock up.
not too sure about the code you posted and the mention of the timer stuff and sounds more like the logic for calling the action is wrong. what is it you're actually trying to achieve? -daz |
![]() |
![]() |
![]() |
#7 |
Junior Member
Join Date: May 2010
Posts: 37
|
It only plays the first song in the playlist. I want to skip to the next song after a set amount of time, these times are stored in the array
|
![]() |
![]() |
![]() |
#8 |
Join Date: Sep 2003
Posts: 27,873
|
well there has to be an issue with the indexing that you're trying to do. best to see if your code is actually working in the way expected which i don't think it will ever do as your pos is probably matching the first result in marker[] everytime the loop is run, causing the first item to play.
wouldn't it be better to just use a fixed timer via the SetTimer(..) and when the event for that happens then just get the current playlist position, increment that value and then use the IPC_SETPLAYLISTPOS part (you'd also need to remember to deal with getting to the end of the playlist and possibly looping back to the start if desired otherwise it'll just keep playing the last item i think). -daz |
![]() |
![]() |
![]() |
#9 |
Junior Member
Join Date: May 2010
Posts: 37
|
That sounds like a good idea but I haven't been able to implement a proper timer. Right now I'm doing it this way which is obviously a bad idea. How would I go about doing it the proper way?
PHP Code:
|
![]() |
![]() |
![]() |
#10 |
Join Date: Sep 2003
Posts: 27,873
|
first issue is that you're just responding to the WM_TIMER message without respecting the timer id i.e. you're just running on any call which is a bad thing to do (as some of the Winamp timers run on a small time delta which would make the cpu usgae increase a lot more than it should). you can still do it like you are but you'd need to make sure that you're using the timer id specified in the SetTimer(..) call.
i'd use SetTimer(..) with a 5000ms delay (assuming you want a 5 second delay) and set it to have a callback function so you know that it should just be for the event you've setup instead of any WM_TIMER action. and then in the timer callback, just use the IPC_SETPLAYLISTPOS and WINAMP_BUTTON2 after using IPC_GETLISTPOS to get the current position or whatever item it is that you want to play next. -daz |
![]() |
![]() |
![]() |
#11 |
Junior Member
Join Date: May 2010
Posts: 37
|
OK! I think it's starting to get trough
![]() PHP Code:
|
![]() |
![]() |
![]() |
#12 |
Join Date: Sep 2003
Posts: 27,873
|
yeah by setting a valid callback in the 4th param (the TIMERPROC), that would make it easier for you to have a timed event happening without having it interfere with other timers (the callback method also happens closer to the scheduled time delta than the message version i found in some setups).
-daz |
![]() |
![]() |
![]() |
#13 |
Junior Member
Join Date: May 2010
Posts: 37
|
I figured out that the identifier just needed to be defined. And the timer works now! But I need it to correspond to the position in the song. So when 5 seconds has passed in the song it should skip to the next song. As it is now the song skips every 5 seconds regardless.
|
![]() |
![]() |
![]() |
#14 |
Join Date: Sep 2003
Posts: 27,873
|
whatever is said on msdn help page for it.
-daz |
![]() |
![]() |
![]() |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|