Old 27th June 2008, 21:55   #1
MichaelErgot
Junior Member
 
Join Date: Jun 2008
Posts: 6
Changing Track Playing Using Visual Basic

I’m developing an outside (non-plugin) music application in Visual Basic (actually in MS Access Basic, pre-.NET version, Access 97) and have been trying out various API calls to remotely operate Winamp. So far I have succeeded in creating routines such as AddFileToPlaylist, ClearWinampInternalPlaylist, GetPlaylistTrack, GetNumberOfTracksInPlaylist, JumpToSpecifiedTimeInCurrentFile, StartPlayback, StopPlaying etc.

However, I am hung up on trying to specify a different track in a playlist and getting it to play. So far, I can do something like this:

lRet& = SendMessageBynum&(ghwndWinamp&, WM_USER, lNumTrack&, 121)

and this moves the highlighting cursor in the playlist to the desired track.

However, I have not figured out how to get this highlighted track to actually play. When I invoke commands to play the track such as

lRet& = SendMessageBynum&(ghwndWinamp&, WM_USER, 0, 102)

it is apparent that some other track is often still the active one which plays. This is really confusing. Is there a reliable way to truly select and play a different track using Visual Basic calls?

Thank you very much.
MichaelErgot is offline   Reply With Quote
Old 27th June 2008, 22:55   #2
QOAL
[STILL a retard!]
 
QOAL's Avatar
 
Join Date: Apr 2002
Location: Bristol, UK
Posts: 1,168
Looking at wa_ipc.h

Quote:
#define IPC_SETPLAYLISTPOS 121
/* (requires Winamp 2.0+)
** SendMessage(hwnd_winamp,WM_WA_IPC,position,IPC_SETPLAYLISTPOS)
** IPC_SETPLAYLISTPOS sets the playlist position to the specified 'position'.
** It will not change playback status or anything else. It will just set the current
** position in the playlist and will update the playlist view if necessary.
**
** If you use SendMessage(hwnd_winamp,WM_COMMAND,MAKEWPARAM(WINAMP_BUTTON2,0),0);
** after using IPC_SETPLAYLISTPOS then Winamp will start playing the file at 'position'.
*/
If you look at the bottom bit of that you'll see it says what to send to play the selected file.

msdn on MAKEWPARAM(), you'll need to make a function to do the same I think.

Although I don't know what the value of WINAMP_BUTTON2 is, I can't find it any where in the SDK.

I hope that's of some help.

count!last.fmdastylishplanner
QOAL is offline   Reply With Quote
Old 28th June 2008, 00:31   #3
MichaelErgot
Junior Member
 
Join Date: Jun 2008
Posts: 6
Yes this is very helpful, I'm amazed but the MakeWParam routine seems to make the difference. I had to create this routine in Visual Basic using some C-based DLL routines I employ, but there is probably a more straightforward way to do it if you’re not as rusty and confused as I am.

I would have thought that the API would have a more specific command to "Play the highlighted track" (specifically, WM_User=102 “Begins play of selected track”) but apparently this functionality is provided only by Press Play as you advise.

Incidentally, my function JumpToSpecifiedTimeInCurrentFile&(ByVal lMilliseconds&)
invokes
lRet& = SendMessageBynum&(ghwndWinamp&, WM_USER, lMilliseconds&, gklJumpToMilliseconds&)
but in this case I don't see how I can fixup the long integer wparam value lMilliseconds& using MakeWParam, since its value typically exceeds 65536 (16 bits). Would you anticipate problems because of this and have any suggestions? The fact is that the routine seems to work currently.

Thank you very much.
MichaelErgot is offline   Reply With Quote
Old 28th June 2008, 00:37   #4
MichaelErgot
Junior Member
 
Join Date: Jun 2008
Posts: 6
Incidentally,

Const WINAMP_BUTTON2 = 40045 ' Press Play button WM_COMMAND
MichaelErgot is offline   Reply With Quote
Old 7th June 2009, 22:37   #5
mhm-winamp
Junior Member
 
Join Date: Jun 2009
Posts: 2
VB WinAmp interface

Hi,

Are you willing to share the VB/WinAmp interface routines you've developed?

Thanks
mhm-winamp is offline   Reply With Quote
Old 11th June 2009, 05:28   #6
MichaelErgot
Junior Member
 
Join Date: Jun 2008
Posts: 6
VBA Module to manipulate Winamp

Here you go mhm-winamp, the full VBA modules I created for manipulating Winamp. Enjoy. Some may be unpolished or incomplete since I did not prepare this for publication, and there is no help file! Any ideas for improvements would always be appreciated.

At this point, my much desired missing capabilities are being able to read the currently playing file name and especially the track metadata using VBA calls to Winamp. Any solutions on adding these would be appreciated.

Michael
Attached Files
File Type: txt winampmodule.txt (28.1 KB, 392 views)
MichaelErgot is offline   Reply With Quote
Old 13th June 2009, 23:34   #7
mhm-winamp
Junior Member
 
Join Date: Jun 2009
Posts: 2
VBA Module to manipulate Winamp

Hi, Thanks for reply. I won't have a chance to check it out until next week but I'll let you know how it goes and if I have any 'improvements'.
mhm-winamp is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > Winamp Development

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump