Unit WAIPC

This unit will allow control of Nullsofts awesome Mp3 Player * Winamp from within Delphi 3 Applications (it will probably work with * Delphi 2 but I have not tried it). This unit is FREEWARE if you like * it or have any questions about it let me know emslie@gpu.srv.ualberta.ca *

Classes

Functions

AddMp3ToPlayList - IPC_GETVERSION is sent to the window, and the return value is the version Version 1.
AlwaysOnTop - pops up the preferences

pops up the preferences
Button1 - rewinds 5 seconds the following are the five main control buttons, with optionally shift or control pressed (for the exact functions of each, just try it out

the following are the five main control buttons, with optionally shift or control pressed (for the exact functions of each, just try it out
Button1_CTRL -
Button1_Shift -
Button2 -
Button2_CTRL -
Button2_Shift -
Button3 -
Button3_CTRL -
Button3_Shift -
Button4 -
Button4_CTRL -
Button4_Shift -
Button5 -
Button5_CTRL -
Button5_Shift -
ChangeDir -
DeletePlayList -
EQ - *ONLY AVAILABLE IN v1.
Forward5 - turns the volume down a little

turns the volume down a little
GetOutPutTime - IPC_ISPLAYING returns the status of playback.
GetVersion -
JumpToTime - IPC_GETOUTPUTTIME returns the position in milliseconds of the current song (lParam = 0), or the song length, in seconds (lParam = 1).
PlayBackStatus -
PlayList - toggles the EQ window

toggles the EQ window
PopUpAboutBox - toggles always on top

toggles always on top
PopUpLoadFile - always goes to the previous song (unlike button 1), 1.
PopUpPreferences - pops up the load file(s) box

pops up the load file(s) box
PrevSong -
Rewind5 - fast forwards 5 seconds

fast forwards 5 seconds
StartPlay -
VolumeDown - turns the volume up a little

turns the volume up a little
VolumeUp - toggles the playlist window

toggles the playlist window
WritePlaylist - *ONLY AVAILABLE IN v1.

Types

Constants

IPC_CHDIR
IPC_DELETE
IPC_GETOUTPUTTIME
IPC_GETVERSION
IPC_ISPLAYING
IPC_JUMPTOTIME
IPC_PLAYFILE
IPC_STARTPLAY
IPC_WRITEPLAYLIST
WINAMP_BUTTON1
WINAMP_BUTTON1_CTRL
WINAMP_BUTTON1_SHIFT
WINAMP_BUTTON2
WINAMP_BUTTON2_CTRL
WINAMP_BUTTON2_SHIFT
WINAMP_BUTTON3
WINAMP_BUTTON3_CTRL
WINAMP_BUTTON3_SHIFT
WINAMP_BUTTON4
WINAMP_BUTTON4_CTRL
WINAMP_BUTTON4_SHIFT
WINAMP_BUTTON5
WINAMP_BUTTON5_CTRL
WINAMP_BUTTON5_SHIFT
WINAMP_FFWD5S
WINAMP_FILE_PLAY
WINAMP_HELP_ABOUT
WINAMP_OPTIONS_AOT
WINAMP_OPTIONS_EQ
WINAMP_OPTIONS_PLEDIT
WINAMP_OPTIONS_PREFS
WINAMP_PREVSONG
WINAMP_REW5S
WINAMP_VOLUMEDOWN
WINAMP_VOLUMEUP

Variables


Functions


procedure AddMp3ToPlayList(mp3ToAdd:string);

IPC_GETVERSION is sent to the window, and the return value is the version Version 1.55 = 0x1551 Version 1.6b = 0x16A0 Version 1.60 = 0x16AF Version 1.61 = 0x16B0 Version 1.62 = 0x16B1 Version 1.64 = 0x16B3 Version 1.666 = 0x16B4 Version 1.69 = 0x16B5 Version 1.70 = 0x1700 Version 1.72 = 0x1702 Version 1.72 = 0x1703 the command_data parameter is 0.

IPC_GETVERSION is sent to the window, and the return value is the version Version 1.55 = 0x1551 Version 1.6b = 0x16A0 Version 1.60 = 0x16AF Version 1.61 = 0x16B0 Version 1.62 = 0x16B1 Version 1.64 = 0x16B3 Version 1.666 = 0x16B4 Version 1.69 = 0x16B5 Version 1.70 = 0x1700 Version 1.72 = 0x1702 Version 1.72 = 0x1703 the command_data parameter is 0. so, if (SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVERSION) != 0x1551) MessageBox(NULL,"Error, Winamp 1.55 not found","Warning",MB_OK);


Procedure AlwaysOnTop;

pops up the preferences

pops up the preferences


Procedure Button1;

rewinds 5 seconds the following are the five main control buttons, with optionally shift or control pressed (for the exact functions of each, just try it out

the following are the five main control buttons, with optionally shift or control pressed (for the exact functions of each, just try it out


Procedure Button1_CTRL;


Procedure Button1_Shift;


Procedure Button2;


Procedure Button2_CTRL;


Procedure Button2_Shift;


Procedure Button3;


Procedure Button3_CTRL;


Procedure Button3_Shift;


Procedure Button4;


Procedure Button4_CTRL;


Procedure Button4_Shift;


Procedure Button5;


Procedure Button5_CTRL;


Procedure Button5_Shift;


Procedure ChangeDir(DirToChangeTo:string);


Procedure DeletePlayList;


Procedure EQ;

*ONLY AVAILABLE IN v1.666+* IPC_WRITEPLAYLIST writes the current playlist to \\Winamp.pl } // THESE MIGHT CHANGE in the future :) //Also, you can send standard WM_COMMAND messages to the Winamp window (for other controls), including // Send using SendMessage(hwnd_winamp,WM_COMMAND,WINAMP_OPTIONS_EQ/*orwhatever*/,0);

Procedure Forward5;

turns the volume down a little

turns the volume down a little


Function GetOutPutTime( x : integer): Integer;

IPC_ISPLAYING returns the status of playback. If it returns 1, it is playing. if it returns 3, it is paused, if it returns 0, it is not playing. If it returns something other than 1,3,or 0, something is screwed.

IPC_ISPLAYING returns the status of playback. If it returns 1, it is playing. if it returns 3, it is paused, if it returns 0, it is not playing. If it returns something other than 1,3,or 0, something is screwed.


Procedure GetVersion;


function JumpToTime(new_song_pos:integer):integer;

IPC_GETOUTPUTTIME returns the position in milliseconds of the current song (lParam = 0), or the song length, in seconds (lParam = 1). Returns -1 if not playing or error.

IPC_GETOUTPUTTIME returns the position in milliseconds of the current song (lParam = 0), or the song length, in seconds (lParam = 1). Returns -1 if not playing or error.


Function PlayBackStatus : integer;


Procedure PlayList;

toggles the EQ window

toggles the EQ window


Procedure PopUpAboutBox;

toggles always on top

toggles always on top


Procedure PopUpLoadFile;

always goes to the previous song (unlike button 1), 1.666+

always goes to the previous song (unlike button 1), 1.666+


Procedure PopUpPreferences;

pops up the load file(s) box

pops up the load file(s) box


Procedure PrevSong;


Procedure Rewind5;

fast forwards 5 seconds

fast forwards 5 seconds


Procedure StartPlay;


Procedure VolumeDown;

turns the volume up a little

turns the volume up a little


Procedure VolumeUp;

toggles the playlist window

toggles the playlist window


Function WritePlaylist : Integer;

*ONLY AVAILABLE IN v1.60+* IPC_JUMPTOTIME sets the position in milliseconds of the current song (approximately) Returns -1 if not playing, 1 on eof, or 0 if successful

*ONLY AVAILABLE IN v1.60+* IPC_JUMPTOTIME sets the position in milliseconds of the current song (approximately) Returns -1 if not playing, 1 on eof, or 0 if successful


Types


Constants

IPC_CHDIR = 103

IPC_DELETE = 101

IPC_GETOUTPUTTIME = 105

IPC_GETVERSION = 0

WM_WA_IPC = WM_USER;

IPC_ISPLAYING = 104

IPC_JUMPTOTIME = 106

IPC_PLAYFILE = 100

IPC_STARTPLAY = 102

IPC_WRITEPLAYLIST = 120

WINAMP_BUTTON1 = 40044

WINAMP_BUTTON1_CTRL = 40154

WINAMP_BUTTON1_SHIFT = 40144

WINAMP_BUTTON2 = 40045

WINAMP_BUTTON2_CTRL = 40155

WINAMP_BUTTON2_SHIFT = 40145

WINAMP_BUTTON3 = 40046

WINAMP_BUTTON3_CTRL = 40156

WINAMP_BUTTON3_SHIFT = 40146

WINAMP_BUTTON4 = 40047

WINAMP_BUTTON4_CTRL = 40157

WINAMP_BUTTON4_SHIFT = 40147

WINAMP_BUTTON5 = 40048

WINAMP_BUTTON5_CTRL = 40158

WINAMP_BUTTON5_SHIFT = 40148

WINAMP_FFWD5S = 40060

WINAMP_FILE_PLAY = 40029

WINAMP_HELP_ABOUT = 40041

WINAMP_OPTIONS_AOT = 40019

WINAMP_OPTIONS_EQ = 40036

WINAMP_OPTIONS_PLEDIT = 40040

WINAMP_OPTIONS_PREFS = 40012

WINAMP_PREVSONG = 40198

WINAMP_REW5S = 40061

WINAMP_VOLUMEDOWN = 40059

WINAMP_VOLUMEUP = 40058


Variables