View Single Post
Old 2nd October 2009, 14:39   #1
rryk
Junior Member
 
Join Date: Oct 2009
Posts: 2
Playlist randomization

I would like to write a plugin to randomize playlist on load.

After some research online and through code of the Winamp API, I used code snippet to redefine WinProc function and was able to log all messages received by Winamp.

I found out, that IPC_PLAYLIST_MODIFIED is received whenever the playlist changes. I use this message to randomize list after adding files/directories to playlist. However Winamp receives this message for every item in the folder being added. Since I want to randomize only once after all elements are added - I wait for the last message. To find this last message I use timer and wait for 2 more seconds after each message. If no more messages come up - I consider the latter to be the trigger. Is there any better way to find out that whole directory was added?

I also want to randomize after Winamp load, but no IPC_PLAYLIST_MODIFIED. Therefore I wait for IPC_CB_OUTPUTCHANGED and then do the randomization. I also set up flag, so I won't react on similar message more then once. I decided to use this message since it was the last message in the log of Winamp message after startup and before it started to play first song. Is there are a better way to find out when Winamp is fully loaded?

Finally, as these two occasions I need to randomize list. I found playlist and plLoadEx folders in API. There is a class api_playlistmanager, which allows to randomize a list, however it requires a pointer to ifc_playlist. I couldn't find neither the class definition nor the way to get this pointer. Please advise...
rryk is offline   Reply With Quote