From c161afa53f627566111bc5aad7ddd36503069112 Mon Sep 17 00:00:00 2001 From: Lance Date: Fri, 25 Nov 2005 12:38:34 +0000 Subject: [PATCH] Added a bunch of "user" functions, winamp is mostly covered, though menu_media needs a bit of work done to it.. I'm only a C noob so I'm not good with graphic stuff :P git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1582 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/m_mp3.c | 561 ++++++++++++++++++++-- engine/client/winamp.h | 1032 +++++++++++++++++++++++++++++++--------- 2 files changed, 1315 insertions(+), 278 deletions(-) diff --git a/engine/client/m_mp3.c b/engine/client/m_mp3.c index f8fc007c9..ae14b2358 100644 --- a/engine/client/m_mp3.c +++ b/engine/client/m_mp3.c @@ -6,6 +6,9 @@ #include "glquake.h"//fixme #endif +#include // needed for itoi +#include // needed for itoi? + #if !defined(__CYGWIN__) && !defined(NOMEDIA) @@ -39,6 +42,8 @@ static mediatrack_t currenttrack; int lasttrackplayed; int media_playing=true;//try to continue from the standard playlist +cvar_t winamp_dir = {"winamp_dir", "c:/program files/winamp5/"}; +cvar_t winamp_exe = {"winamp_exe", "winamp.exe"}; cvar_t media_shuffle = {"media_shuffle", "1"}; cvar_t media_repeat = {"media_repeat", "1"}; #ifdef WINAMP @@ -61,6 +66,8 @@ qboolean WinAmp_GetHandle (void) return true; if ((hwnd_winamp = FindWindow("Winamp v1.x", NULL))) return true; + if ((hwnd_winamp = FindWindow("winamp", NULL))) + return true; *currenttrack.nicename = '\0'; @@ -83,7 +90,7 @@ qboolean WinAmp_StartTune(char *name) SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_DELETE); SendMessage(hwnd_winamp,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds); SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)0,IPC_STARTPLAY ); - + for (trys = 1000; trys; trys--) { pos = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETOUTPUTTIME); @@ -104,7 +111,7 @@ void WinAmp_Think(void) int len; if (!WinAmp_GetHandle()) - return; + return; pos = bgmvolume.value*255; if (pos > 255) pos = 255; @@ -121,7 +128,7 @@ void WinAmp_Think(void) } #endif void Media_Seek (float time) -{ +{ soundcardinfo_t *sc; #ifdef WINAMP if (media_hijackwinamp.value) @@ -304,45 +311,457 @@ void Media_LoadTrackNames (char *listname); #define MEDIA_SHUFFLE -2 #define MEDIA_REPEAT -1 +// Start Moodles Attempt at Winamp Commands +// Note strange bug, load up FTE normally. And type winamp_version, for me the output is 0, but if I do winamp_version a second time it says 24604 (which is hex for 5010, my version of winamp is 5.10) + +void Winamp_Play_f(void) +{ + if (!WinAmp_GetHandle()) + { + Con_Printf("Winamp not loaded\n"); + return; + } + + //SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_BUTTON2, 0); <- is below fails, uncomment this. + + SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_STARTPLAY); + Con_Printf("Attempting to start playback\n"); +} + +void Winamp_Version_f(void) +{ + int version = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVERSION); + + if (!WinAmp_GetHandle()) + { + Con_Printf("Winamp not loaded\n"); + return; + } + + //itoa (version, temp, 16); // should convert it to hex + + Con_Printf("Winamp Version: %d\n",version); //wtf work you stupid fuckin pos +} + +void Winamp_TimeLeft_f(void) +{ + int tracklength = SendMessage(hwnd_winamp,WM_WA_IPC,1,IPC_GETOUTPUTTIME); + int trackposition = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETOUTPUTTIME); + int timeleft; + + if (!WinAmp_GetHandle()) + { + Con_Printf("Winamp not loaded\n"); + return; + } + + timeleft = tracklength-(trackposition/1000); + + Con_Printf("Time Left: %d seconds\n",timeleft); // convert it to h:m:s later +} + +void Winamp_JumpTo_f(void) // input is a percentage +{ + int tracklength = SendMessage(hwnd_winamp,WM_WA_IPC,1,IPC_GETOUTPUTTIME); + float inputpercent; + double trackpercent; + char *input; + int res; + + if (!WinAmp_GetHandle()) + { + Con_Printf("Winamp not loaded\n"); + return; + } + + input = Cmd_Argv(1); + + inputpercent = atoi(input); + + if (inputpercent > 100) + { + Con_Printf("ERROR: Choose a percent between 0 and 100\n"); + return; + } + + inputpercent = inputpercent/100; + + trackpercent = (tracklength*1000)*inputpercent; + + res = SendMessage(hwnd_winamp,WM_WA_IPC,trackpercent,IPC_JUMPTOTIME); + + if (res == 0) + { + Con_Printf("Successfully jumped to %s percent\n",input,trackpercent); + return; + } + else if (res == -1) + { + Con_Printf("There are no songs playing\n"); + return; + } + else if (res == 1) + { + Con_Printf("End of file\n"); + } + + + Con_Printf("Oh oh spagettioes you shouldn't see this"); +} + +void Winamp_GoToPlayListPosition_f(void) // the playlist selecter doesn't actually work +{ + //int length = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTLENGTH); //set a max + char *input; + int inputnumber; + + if (!WinAmp_GetHandle()) + { + Con_Printf("Winamp not loaded\n"); + return; + } + + input = Cmd_Argv(1); + + inputnumber = atoi(input); + + SendMessage(hwnd_winamp,WM_WA_IPC,inputnumber,IPC_SETPLAYLISTPOS); + Sleep(100); + + SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_STARTPLAY); // the above only selects it, doesn't actually play it. + + Con_Printf("Attemped to set playlist position %s\n",input); +} + +void Winamp_Volume_f(void) // I think this only works when the client did the winamp_play +{ + char *input; + int inputnumber; + + if (!WinAmp_GetHandle()) + { + Con_Printf("Winamp not loaded\n"); + return; + } + + input = Cmd_Argv(1); + + inputnumber = atoi(input); + + if ((input == "") || (inputnumber > 255)) + { + Con_Printf("Choose a number between 0 and 255\n"); + return; + } + + SendMessage(hwnd_winamp,WM_WA_IPC,inputnumber,IPC_SETVOLUME); + + Con_Printf("Winamp volume set to: %s\n",input); +} + +void Winamp_ChannelPanning_f(void) // doesn't seem to work for me +{ + char *input; + int inputnumber; + + if (!WinAmp_GetHandle()) + { + Con_Printf("Winamp not loaded\n"); + return; + } + + input = Cmd_Argv(1); + + inputnumber = atoi(input); + + if ((input == "") || (inputnumber > 255)) + { + Con_Printf("Choose a number between 0 (left) and 255 (right). Center is about 127\n"); + return; + } + + SendMessage(hwnd_winamp,WM_WA_IPC,inputnumber,IPC_SETPANNING); + + Con_Printf("Winamp channel panning set to: %s\n",input); +} + +void Winamp_PlayListLength_f(void) // has a habit of returning 0 when you dont use winamp_play to start off playing +{ + int length = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTLENGTH); + + if (!WinAmp_GetHandle()) + { + Con_Printf("Winamp not loaded\n"); + return; + } + + Con_Printf("Winamp playlist length: %d\n",length); +} + +void Winamp_PlayListPosition_f(void) // has a habit of return 0 of 0 +{ + int pos = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTPOS); + int length = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTLENGTH); + + if (!WinAmp_GetHandle()) + { + Con_Printf("Winamp not loaded\n"); + return; + } + + Con_Printf("Winamp currently on position '%d' of '%d'\n",pos,length); +} + +void Winamp_SongInfo_f(void) +{ + char title[255]; + int res = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISPLAYING); + int samplerate = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETINFO); + int bitrate = SendMessage(hwnd_winamp,WM_WA_IPC,1,IPC_GETINFO); + int channels = SendMessage(hwnd_winamp,WM_WA_IPC,2,IPC_GETINFO); + GetWindowText(hwnd_winamp, title, sizeof(title)); + + if (!WinAmp_GetHandle()) + { + Con_Printf("Winamp not loaded\n"); + return; + } + + if (res == 0) + { + Con_Printf("WinAmp is off\n"); + return; + } + else if (res == 1) + { + Con_Printf("Currently playing: %s\nSamplerate: %dkHz\nBitrate: %dkbps \nChannels: %d\n",title,samplerate,bitrate,channels); + return; + } + else if (res == 3) + { + Con_Printf("Winamp is paused\n"); + return; + } +} + +void Winamp_Restart_f(void) +{ + if (!WinAmp_GetHandle()) + { + Con_Printf("Winamp not loaded\n"); + return; + } + + SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_RESTARTWINAMP); + + Con_Printf("Attempting to restart winamp\n"); +} + +void Winamp_Shuffle_f(void) //it works, thats all i can say lol +{ + char *input; + int inputnumber; + int inputnumber2; + int get = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_SHUFFLE); + + if (!WinAmp_GetHandle()) + { + Con_Printf("Winamp not loaded\n"); + return; + } + + input = Cmd_Argv(1); + + inputnumber2 = atoi(input); + + inputnumber = Cmd_Argc(); + + if (inputnumber2 == 1) + { + PostMessage(hwnd_winamp,WM_WA_IPC,1,IPC_SET_SHUFFLE); + Con_Printf("Winamp shuffle turned on\n"); + return; + } + else if ((inputnumber2 == 0) && (inputnumber == 2)) + { + SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_SET_SHUFFLE); + Con_Printf("Winamp shuffle turned off\n"); + return; + } + else if (get == 1) + { + Con_Printf("Winamp shuffle is currently on\n"); + } + else if (get == 0) + { + Con_Printf("Winamp shuffle is currently off\n"); + } + + Con_Printf("Enter 1 to to turn Winamp shuffle on, 0 to turn it off\n"); + return; +} + +void Winamp_Repeat_f(void) // it works, thats all i can say lol +{ + char *input; + int inputnumber; + int inputnumber2; + int get = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_REPEAT); + + if (!WinAmp_GetHandle()) + { + Con_Printf("Winamp not loaded\n"); + return; + } + + input = Cmd_Argv(1); + + inputnumber2 = atoi(input); + + inputnumber = Cmd_Argc(); + + if (inputnumber2 == 1) + { + SendMessage(hwnd_winamp,WM_WA_IPC,1,IPC_SET_REPEAT); + Con_Printf("Winamp repeat turned on\n"); + return; + } + else if ((inputnumber2 == 0) && (inputnumber == 2)) + { + SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_SET_REPEAT); + Con_Printf("Winamp repeat turned off\n"); + return; + } + else if (get == 1) + { + Con_Printf("Winamp repeat is currently on\n"); + } + else if (get == 0) + { + Con_Printf("Winamp repeat is currently off\n"); + } + + Con_Printf("Enter 1 to to turn Winamp repeat on, 0 to turn it off\n"); + return; +} + +void Winamp_VolumeUp_f(void) +{ + SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_VOLUMEUP, 0); + + Con_Printf("Winamp volume incremented\n"); +} + +void Winamp_VolumeDown_f(void) +{ + SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_VOLUMEDOWN, 0); + + Con_Printf("Winamp volume decremented\n"); +} + +void Winamp_FastForward5Seconds_f(void) +{ + SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_FFWD5S, 0); + + Con_Printf("Winamp fast forwarded 5 seconds\n"); +} + +void Winamp_Rewind5Seconds_f(void) +{ + SendMessage(hwnd_winamp, WM_COMMAND, WINAMP_REW5S, 0); + + Con_Printf("Winamp rewinded 5 seconds\n"); +} + +// End Moodles Attempt at Winamp Commands + + void M_Media_Draw (void) { mpic_t *p; mediatrack_t *track; int y; int op, i; + char samplerate[20]; // usually 44kHz + char bitrate[20]; + char channels[20]; + char sr2[20]; + char br2[20]; + char chns2[20]; + char title[255]; + int res = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISPLAYING); + + int sr = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETINFO); // M_Print wants chars, not int's + int br = SendMessage(hwnd_winamp,WM_WA_IPC,1,IPC_GETINFO); + int chns = SendMessage(hwnd_winamp,WM_WA_IPC,2,IPC_GETINFO); + + if (!WinAmp_GetHandle()) + return false; + + GetWindowText(hwnd_winamp, title, sizeof(title)); + + strcpy(samplerate,"Samplerate: "); + strcpy(bitrate,"Bitrate: "); + strcpy(channels,"Channels: "); + + itoa ( sr, sr2, 10); + itoa ( br, br2, 10); + itoa ( chns, chns2, 10); + + strcat(samplerate,sr2); + strcat(bitrate,br2); + strcat(channels,chns2); + + strcat(samplerate,"kHz"); + strcat(bitrate,"kbps"); #define MP_Hightlight(x,y,text,hl) (hl?M_PrintWhite(x, y, text):M_Print(x, y, text)) p = Draw_CachePic ("gfx/p_option.lmp"); M_DrawPic ( (320-p->width)/2, 4, p); - if (!bgmvolume.value) - M_Print (12, 32, "Not playing - no volume"); - else if (!*currenttrack.nicename) + + if (res == 0) { - if (!tracks) - M_Print (12, 32, "Not playing - no track to play"); - else - { + M_Print (12, 32, "WinAmp is off"); + } + else if (res == 1) + { + M_Print (12, 32, "WinAmp is on and Currently playing:"); + M_Print (12, 40, title); + M_Print (12, 48, samplerate); + M_Print (12, 56, bitrate); + M_Print (12, 64, channels); + } + else if (res == 3) + { + M_Print (12, 32, "WinAmp is paused and on:"); + M_Print (12, 40, currenttrack.nicename); + } + + /*if (!bgmvolume.value) + M_Print (12, 32, "Not playing - no volume"); + if (!*currenttrack.nicename) //elseif + { + #ifdef WINAMP if (!WinAmp_GetHandle()) M_Print (12, 32, "Please start WinAmp 2"); else #endif M_Print (12, 32, "Not playing - switched off"); - } } else { M_Print (12, 32, "Currently playing:"); M_Print (12, 40, currenttrack.nicename); - } + }*/ op = selectedoption - (vid.height-52)/16; if (op + (vid.height-52)/8>numtracks) op = numtracks - (vid.height-52)/8; if (op < MEDIA_MIN) op = MEDIA_MIN; - y=52; + y=100; while(op < 0) { switch(op) @@ -377,25 +796,43 @@ void M_Media_Draw (void) break; case MEDIA_SHUFFLE: if (media_shuffle.value) + { MP_Hightlight (12, y, "Shuffle on", op == selectedoption); + SendMessage(hwnd_winamp,WM_WA_IPC,1,IPC_SET_SHUFFLE); + } else + { MP_Hightlight (12, y, "Shuffle off", op == selectedoption); + SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_SET_SHUFFLE); + } y+=8; break; case MEDIA_REPEAT: if (media_shuffle.value) { if (media_repeat.value) + { MP_Hightlight (12, y, "Repeat on", op == selectedoption); + SendMessage(hwnd_winamp,WM_WA_IPC,1,IPC_SET_REPEAT); + } else - MP_Hightlight (12, y, "Repeat off", op == selectedoption); + { + MP_Hightlight (12, y, "Repeat off", op == selectedoption); + SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_SET_REPEAT); + } } else { if (media_repeat.value) + { MP_Hightlight (12, y, "(Repeat on)", op == selectedoption); + SendMessage(hwnd_winamp,WM_WA_IPC,1,IPC_SET_REPEAT); + } else - MP_Hightlight (12, y, "(Repeat off)", op == selectedoption); + { + MP_Hightlight (12, y, "(Repeat off)", op == selectedoption); + SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_SET_REPEAT); + } } y+=8; break; @@ -420,12 +857,12 @@ int Com_CompleatenameCallback(char *name, int size, void *data) { if (*compleatenamename) compleatenamemultiple = true; - strcpy(compleatenamename, name); + strcpy(compleatenamename, name); return true; } void Com_CompleateOSFileName(char *name) -{ +{ char *ending; compleatenamemultiple = false; @@ -444,7 +881,7 @@ void Com_CompleateOSFileName(char *name) void M_Media_Key (int key) { - int dir; + int dir; if (key == K_ESCAPE) M_Menu_Main_f(); else if (key == K_RIGHTARROW || key == K_LEFTARROW) @@ -561,7 +998,7 @@ void M_Media_Key (int key) case MEDIA_ADDLIST: if (*media_iofilename) Media_LoadTrackNames(media_iofilename); - break; + break; case MEDIA_SHUFFLE: Cvar_Set(&media_shuffle, media_shuffle.value?"0":"1"); break; @@ -573,7 +1010,7 @@ void M_Media_Key (int key) { media_playing = true; nexttrack = selectedoption; - Media_Next_f(); + Media_Next_f(); } break; } @@ -585,7 +1022,7 @@ void M_Media_Key (int key) if (key == K_TAB) Com_CompleateOSFileName(media_iofilename); else if (key == K_BACKSPACE) - { + { dir = strlen(media_iofilename); if (dir) media_iofilename[dir-1] = '\0'; @@ -604,8 +1041,8 @@ void M_Media_Key (int key) tr=tracks; while(tr) { - if (num == selectedoption) - break; + if (num == selectedoption) + break; prevtrack = tr; tr=tr->next; @@ -615,7 +1052,7 @@ void M_Media_Key (int key) return; if (key == K_BACKSPACE) - { + { dir = strlen(tr->nicename); if (dir) tr->nicename[dir-1] = '\0'; @@ -636,7 +1073,7 @@ void M_Media_Key (int key) //safeprints only. void Media_LoadTrackNames (char *listname) -{ +{ char *lineend; char *len; char *filename; @@ -687,7 +1124,7 @@ void Media_LoadTrackNames (char *listname) snprintf(newtrack->filename, sizeof(newtrack->filename)-1, "/mnt/%c/%s", filename[0]-'A'+'a', filename+3); while((filename = strchr(newtrack->filename, '\\'))) *filename = '/'; - + } else #endif @@ -711,7 +1148,7 @@ void Media_LoadTrackNames (char *listname) if (!lineend && !*data) break; - lineend[-1]='\0'; + lineend[-1]='\0'; data = lineend+1; newtrack = Z_Malloc(sizeof(mediatrack_t)); @@ -1090,7 +1527,7 @@ soundpos=0; return true; } #endif - + Con_Printf("Failed to find file %s\n", name); return false; } @@ -1102,12 +1539,12 @@ qboolean Media_ShowFilm(void) // soundcardinfo_t *sc; float curtime = Sys_DoubleTime(); - + switch (media_filmtype) { case MFT_ROQ: if (curtime>16:0xFF; #define LIMIT(x) ((((x) > 0xffffff) ? 0xff0000 : (((x) <= 0xffff) ? 0 : (x) & 0xff0000)) >> 16) unsigned char *pa=roqfilm->y[0]; @@ -1128,7 +1565,7 @@ qboolean Media_ShowFilm(void) { //convert it properly. for(x = 0; x < num_columns; ++x) { - + int r, g, b, y1, y2, u, v, t; y1 = *(pa++); y2 = *(pa++); u = pb[x] - 128; @@ -1157,7 +1594,7 @@ qboolean Media_ShowFilm(void) } if(y & 0x01) { pb += num_columns; pc += num_columns; } - } + } } else if (vid.numpages == 1) //previous frame is still in page. { @@ -1211,7 +1648,7 @@ qboolean Media_ShowFilm(void) currentframe = (curtime - filmstarttime)*filmfps; if (currentframe>=num_frames) - { + { Media_PlayFilm(NULL); return false; } @@ -1219,13 +1656,13 @@ qboolean Media_ShowFilm(void) lpbi = (LPBITMAPINFOHEADER)AVIStreamGetFrame(pgf, currentframe); // Grab Data From The AVI Stream currentframe++; if (!lpbi || lpbi->biBitCount != 24)//oops - { + { SCR_SetUpToDrawConsole(); #ifdef SWQUAKE D_EnableBackBufferAccess (); // of all overlay stuff if drawing directly #endif Draw_ConsoleBackground(vid.height); - Draw_String(0, 0, "Video stream is corrupt\n"); + Draw_String(0, 0, "Video stream is corrupt\n"); } else { @@ -1247,7 +1684,7 @@ qboolean Media_ShowFilm(void) AVIStreamRead(pavisound, soundpos, AVISTREAMREAD_CONVENIENT, pBuffer, lSize, NULL, &samples); - S_RawAudio(-1, pBuffer, pWaveFormat->nSamplesPerSec, samples, pWaveFormat->nChannels, 2); + S_RawAudio(-1, pBuffer, pWaveFormat->nSamplesPerSec, samples, pWaveFormat->nChannels, 2); } } return true; @@ -1363,7 +1800,7 @@ void Media_RecordFrame (void) { case CT_AVI: //ask gl for it - qglReadPixels (glx, gly, glwidth, glheight, GL_RGB, GL_UNSIGNED_BYTE, framebuffer ); + qglReadPixels (glx, gly, glwidth, glheight, GL_RGB, GL_UNSIGNED_BYTE, framebuffer ); // swap rgb to bgr c = glwidth*glheight*3; @@ -1375,7 +1812,7 @@ void Media_RecordFrame (void) } //write it hr = AVIStreamWrite(recordavi_video_stream, recordavi_video_frame_counter++, 1, framebuffer, glwidth*glheight * 3, AVIIF_KEYFRAME%15, NULL, NULL); - if (FAILED(hr)) Con_Printf("Recoring error\n"); + if (FAILED(hr)) Con_Printf("Recoring error\n"); break; case CT_SCREENSHOT: @@ -1417,7 +1854,7 @@ void Media_RecordAudioFrame (short *sample_buffer, int samples) if (recordingdemo) if (scr_con_current > 0) - { + { return; } @@ -1440,7 +1877,7 @@ void Media_RecordAudioFrame (short *sample_buffer, int samples) hr = AVIStreamWrite(recordavi_uncompressed_audio_stream, recordavi_audio_frame_counter++, 1, captureaudiomem, samps*recordavi_wave_format.nBlockAlign, AVIIF_KEYFRAME, NULL, NULL); - if (FAILED(hr)) Con_Printf("Recoring error\n"); + if (FAILED(hr)) Con_Printf("Recoring error\n"); //save excess for later. memmove(captureaudiomem, captureaudiomem+samps*2, captureaudiosamples*4); @@ -1450,7 +1887,7 @@ void Media_StopRecordFilm_f (void) if (recordavi_uncompressed_video_stream) AVIStreamRelease(recordavi_uncompressed_video_stream); if (recordavi_compressed_video_stream) AVIStreamRelease(recordavi_compressed_video_stream); if (recordavi_uncompressed_audio_stream) AVIStreamRelease(recordavi_uncompressed_audio_stream); - if (recordavi_file) AVIFileRelease(recordavi_file); + if (recordavi_file) AVIFileRelease(recordavi_file); if (capturevideomem) BZ_Free(capturevideomem); if (captureaudiomem) BZ_Free(captureaudiomem); @@ -1565,7 +2002,7 @@ void Media_RecordFilm_f (void) stream_header.fccHandler = recordavi_codec_fourcc; stream_header.dwScale = 100; stream_header.dwRate = (unsigned long)(0.5 + 100.0/recordavi_frametime); - SetRect(&stream_header.rcFrame, 0, 0, glwidth, glheight); + SetRect(&stream_header.rcFrame, 0, 0, glwidth, glheight); hr = AVIFileCreateStream(recordavi_file, &recordavi_uncompressed_video_stream, &stream_header); if (FAILED(hr)) @@ -1579,7 +2016,7 @@ void Media_RecordFilm_f (void) { AVICOMPRESSOPTIONS opts; AVICOMPRESSOPTIONS* aopts[1] = { &opts }; - memset(&opts, 0, sizeof(opts)); + memset(&opts, 0, sizeof(opts)); opts.fccType = stream_header.fccType; opts.fccHandler = recordavi_codec_fourcc; // Make the stream according to compression @@ -1591,7 +2028,7 @@ void Media_RecordFilm_f (void) return; } } - + hr = AVIStreamSetFormat(recordavi_video_stream, 0, &bitmap_info_header, sizeof(BITMAPINFOHEADER)); if (FAILED(hr)) @@ -1604,15 +2041,15 @@ void Media_RecordFilm_f (void) if (capturesound.value) { memset(&recordavi_wave_format, 0, sizeof(WAVEFORMATEX)); - recordavi_wave_format.wFormatTag = WAVE_FORMAT_PCM; + recordavi_wave_format.wFormatTag = WAVE_FORMAT_PCM; recordavi_wave_format.nChannels = 2; // always stereo in Quake sound engine recordavi_wave_format.nSamplesPerSec = sndcardinfo->sn.speed; recordavi_wave_format.wBitsPerSample = 16; // always 16bit in Quake sound engine - recordavi_wave_format.nBlockAlign = recordavi_wave_format.wBitsPerSample/8 * recordavi_wave_format.nChannels; - recordavi_wave_format.nAvgBytesPerSec = recordavi_wave_format.nSamplesPerSec * recordavi_wave_format.nBlockAlign; - recordavi_wave_format.cbSize = 0; + recordavi_wave_format.nBlockAlign = recordavi_wave_format.wBitsPerSample/8 * recordavi_wave_format.nChannels; + recordavi_wave_format.nAvgBytesPerSec = recordavi_wave_format.nSamplesPerSec * recordavi_wave_format.nBlockAlign; + recordavi_wave_format.cbSize = 0; + - memset(&stream_header, 0, sizeof(stream_header)); stream_header.fccType = streamtypeAUDIO; stream_header.dwScale = recordavi_wave_format.nBlockAlign; @@ -1669,6 +2106,26 @@ void Media_Init(void) Cmd_AddCommand("capturedemo", Media_RecordDemo_f); Cmd_AddCommand("capturestop", Media_StopRecordFilm_f); +#ifdef WINAMP + Cmd_AddCommand("winamp_play", Winamp_Play_f); + Cmd_AddCommand("winamp_version", Winamp_Version_f); + Cmd_AddCommand("winamp_timeleft", Winamp_TimeLeft_f); + Cmd_AddCommand("winamp_jumpto", Winamp_JumpTo_f); + Cmd_AddCommand("winamp_gotoplaylistposition", Winamp_GoToPlayListPosition_f); + Cmd_AddCommand("winamp_volume", Winamp_Volume_f); + Cmd_AddCommand("winamp_channelpanning", Winamp_ChannelPanning_f); + Cmd_AddCommand("winamp_playlistlength", Winamp_PlayListLength_f); + Cmd_AddCommand("winamp_playlistposition", Winamp_PlayListPosition_f); + Cmd_AddCommand("winamp_songinfo", Winamp_SongInfo_f); + Cmd_AddCommand("winamp_restart", Winamp_Restart_f); + Cmd_AddCommand("winamp_shuffle", Winamp_Shuffle_f); + Cmd_AddCommand("winamp_repeat", Winamp_Repeat_f); + Cmd_AddCommand("winamp_volumeup", Winamp_VolumeUp_f); + Cmd_AddCommand("winamp_volumedown", Winamp_VolumeDown_f); + Cmd_AddCommand("winamp_fastforward5seconds", Winamp_FastForward5Seconds_f); + Cmd_AddCommand("winamp_rewind5seconds", Winamp_Rewind5Seconds_f); +#endif + Cvar_Register(&capturemessage, "AVI capture controls"); Cvar_Register(&capturesound, "AVI capture controls"); Cvar_Register(&capturerate, "AVI capture controls"); @@ -1680,14 +2137,14 @@ void Media_Init(void) #endif Cvar_Register(&media_shuffle, "Media player things"); Cvar_Register(&media_repeat, "Media player things"); + Cvar_Register(&winamp_dir, "Winamp Things"); + Cvar_Register(&winamp_exe, "Winamp Things"); + } - - - #else void Media_Init(void){} void M_Media_Draw (void){} diff --git a/engine/client/winamp.h b/engine/client/winamp.h index 6feb71208..436bae3fa 100644 --- a/engine/client/winamp.h +++ b/engine/client/winamp.h @@ -1,106 +1,114 @@ /* -** Winamp frontend/plug-in control API documentation v1.1. -** By Justin Frankel. Updates by Christophe Thibault. -** Copyright (C) 1997-2000, Nullsoft Inc. -** Last updated: JUL.12.2000. -** -** Introduction -** ----------------------- -** This file describes a means to easily communicate to Winamp -** via the classic Win32 Message API. +** Copyright (C) 2003 Nullsoft, Inc. ** -** These definitions/code assume C/C++. Porting to VB/Delphi shouldn't -** be too hard. -** -** First, you find the HWND of the Winamp main window. From a plug-in -** you can easily extract this from the plug-in structure (hMainWindow, -** hwndParent, whatever). For external apps, use: +** This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held +** liable for any damages arising from the use of this software. ** -** HWND hwnd_winamp = FindWindow("Winamp v1.x",NULL); +** Permission is granted to anyone to use this software for any purpose, including commercial applications, and to +** alter it and redistribute it freely, subject to the following restrictions: ** -** (note: I know, we're in Winamp 2.x, but it's 1.x for compatibility) +** 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. +** If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. ** -** Once you have the hwnd_winamp, it's a good idea to check the version -** number. To do this, you send a WM_WA_IPC message to hwnd_winamp. -** Note that WM_WA_IPC is defined as Win32's WM_USER. +** 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +** +** 3. This notice may not be removed or altered from any source distribution. ** -** Note that sometimes you might want to use PostMessage instead of -** SendMessage. */ -#ifndef _WAFE_H_ -#define _WAFE_H_ - -#define WM_WA_IPC WM_USER - -/**************************************************************************/ - -#define IPC_GETVERSION 0 +#ifndef _WA_IPC_H_ +#define _WA_IPC_H_ /* -** int version = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVERSION); +** This is the modern replacement for the classic 'frontend.h'. Most of these +** updates are designed for in-process use, i.e. from a plugin. +** +*/ + +/* message used to sent many messages to winamp's main window. +** most all of the IPC_* messages involve sending the message in the form of: +** result = SendMessage(hwnd_winamp,WM_WA_IPC,(parameter),IPC_*); +*/ +#define WM_WA_IPC WM_USER +/* but some of them use WM_COPYDATA. be afraid. +*/ + +#define IPC_GETVERSION 0 +/* int version = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVERSION); ** ** Version will be 0x20yx for winamp 2.yx. versions previous to Winamp 2.0 ** typically (but not always) use 0x1zyx for 1.zx versions. Weird, I know. -** -** The basic format for sending messages to Winamp is: -** int result=SendMessage(hwnd_winamp,WM_WA_IPC,command_data,command); -** (for the version check, command_data is 0). +*/ + +#define IPC_GETREGISTEREDVERSION 770 + + +typedef struct { + char *filename; + char *title; + int length; +} enqueueFileWithMetaStruct; // send this to a IPC_PLAYFILE in a non WM_COPYDATA, +// and you get the nice desired result. if title is NULL, it is treated as a "thing", +// otherwise it's assumed to be a file (for speed) + +#define IPC_PLAYFILE 100 // dont be fooled, this is really the same as enqueufile +#define IPC_ENQUEUEFILE 100 +/* sent as a WM_COPYDATA, with IPC_PLAYFILE as the dwData, and the string to play +** as the lpData. Just enqueues, does not clear the playlist or change the playback +** state. */ #define IPC_DELETE 101 - -/* -** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_DELETE); -** -** You can use IPC_DELETE to clear Winamp's internal playlist. +#define IPC_DELETE_INT 1101 // don't use this, it's used internally by winamp when + // dealing with some lame explorer issues. +/* SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_DELETE); +** Use IPC_DELETE to clear Winamp's internal playlist. */ -#define IPC_STARTPLAY 102 +#define IPC_STARTPLAY 102 // starts playback. almost like hitting play in Winamp. +#define IPC_STARTPLAY_INT 1102 // used internally, don't bother using it (won't be any fun) -/* -** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_STARTPLAY); -** -** Using IPC_STARTPLAY is like hitting 'Play' in Winamp, mostly. + +#define IPC_CHDIR 103 +/* sent as a WM_COPYDATA, with IPC_CHDIR as the dwData, and the directory to change to +** as the lpData. */ #define IPC_ISPLAYING 104 - -/* -** int res = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISPLAYING); -** -** IPC_ISPLAYING returns the status of playback. -** If it returns 1, it is playing. if it returns 3, it is paused, +/* int res = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISPLAYING); +** If it returns 1, it is playing. if it returns 3, it is paused, ** if it returns 0, it is not playing. */ #define IPC_GETOUTPUTTIME 105 - -/* -** int res = SendMessage(hwnd_winamp,WM_WA_IPC,mode,IPC_GETOUTPUTTIME); -** -** IPC_GETOUTPUTTIME returns the position in milliseconds of the -** current song (mode = 0), or the song length, in seconds (mode = 1). -** Returns -1 if not playing or error. +/* int res = SendMessage(hwnd_winamp,WM_WA_IPC,mode,IPC_GETOUTPUTTIME); +** returns the position in milliseconds of the current track (mode = 0), +** or the track length, in seconds (mode = 1). Returns -1 if not playing or error. */ #define IPC_JUMPTOTIME 106 - /* (requires Winamp 1.60+) ** SendMessage(hwnd_winamp,WM_WA_IPC,ms,IPC_JUMPTOTIME); -** IPC_JUMPTOTIME sets the position in milliseconds of the +** IPC_JUMPTOTIME sets the position in milliseconds of the ** current song (approximately). ** Returns -1 if not playing, 1 on eof, or 0 if successful */ +#define IPC_GETMODULENAME 109 +#define IPC_EX_ISRIGHTEXE 666 +/* usually shouldnt bother using these, but here goes: +** send a WM_COPYDATA with IPC_GETMODULENAME, and an internal +** flag gets set, which if you send a normal WM_WA_IPC message with +** IPC_EX_ISRIGHTEXE, it returns whether or not that filename +** matches. lame, I know. +*/ #define IPC_WRITEPLAYLIST 120 - /* (requires Winamp 1.666+) ** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_WRITEPLAYLIST); ** @@ -112,115 +120,47 @@ #define IPC_SETPLAYLISTPOS 121 - /* (requires Winamp 2.0+) ** SendMessage(hwnd_winamp,WM_WA_IPC,position,IPC_SETPLAYLISTPOS) -** -** IPC_SETPLAYLISTPOS sets the playlsit position to 'position'. +** IPC_SETPLAYLISTPOS sets the playlist position to 'position'. It +** does not change playback or anything, it just sets position, and +** updates the view if necessary */ #define IPC_SETVOLUME 122 - /* (requires Winamp 2.0+) ** SendMessage(hwnd_winamp,WM_WA_IPC,volume,IPC_SETVOLUME); -** ** IPC_SETVOLUME sets the volume of Winamp (from 0-255). */ #define IPC_SETPANNING 123 - /* (requires Winamp 2.0+) ** SendMessage(hwnd_winamp,WM_WA_IPC,panning,IPC_SETPANNING); -** ** IPC_SETPANNING sets the panning of Winamp (from 0 (left) to 255 (right)). */ #define IPC_GETLISTLENGTH 124 - /* (requires Winamp 2.0+) ** int length = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTLENGTH); -** ** IPC_GETLISTLENGTH returns the length of the current playlist, in ** tracks. */ -#define IPC_SETSKIN 200 - -/* (requires Winamp 2.04+, only usable from plug-ins (not external apps)) -** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)"skinname",IPC_SETSKIN); -** -** IPC_SETSKIN sets the current skin to "skinname". Note that skinname -** can be the name of a skin, a skin .zip file, with or without path. -** If path isn't specified, the default search path is the winamp skins -** directory. -*/ - - -#define IPC_GETSKIN 201 - -/* (requires Winamp 2.04+, only usable from plug-ins (not external apps)) -** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)skinname_buffer,IPC_GETSKIN); -** -** IPC_GETSKIN puts the directory where skin bitmaps can be found -** into skinname_buffer. -** skinname_buffer must be MAX_PATH characters in length. -** When using a .zip'd skin file, it'll return a temporary directory -** where the ZIP was decompressed. -*/ - - -#define IPC_EXECPLUG 202 - -/* (requires Winamp 2.04+, only usable from plug-ins (not external apps)) -** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)"vis_file.dll",IPC_EXECPLUG); -** -** IPC_EXECPLUG executes a visualization plug-in pointed to by WPARAM. -** the format of this string can be: -** "vis_whatever.dll" -** "vis_whatever.dll,0" // (first mod, file in winamp plug-in dir) -** "C:\\dir\\vis_whatever.dll,1" -*/ - - -#define IPC_GETPLAYLISTFILE 211 - -/* (requires Winamp 2.04+, only usable from plug-ins (not external apps)) -** char *name=SendMessage(hwnd_winamp,WM_WA_IPC,index,IPC_GETPLAYLISTFILE); -** -** IPC_GETPLAYLISTFILE gets the filename of the playlist entry [index]. -** returns a pointer to it. returns NULL on error. -*/ - - -#define IPC_GETPLAYLISTTITLE 212 - -/* (requires Winamp 2.04+, only usable from plug-ins (not external apps)) -** char *name=SendMessage(hwnd_winamp,WM_WA_IPC,index,IPC_GETPLAYLISTTITLE); -** -** IPC_GETPLAYLISTTITLE gets the title of the playlist entry [index]. -** returns a pointer to it. returns NULL on error. -*/ - - #define IPC_GETLISTPOS 125 - /* (requires Winamp 2.05+) ** int pos=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTPOS); -** ** IPC_GETLISTPOS returns the playlist position. A lot like IPC_WRITEPLAYLIST ** only faster since it doesn't have to write out the list. Heh, silly me. */ -#define IPC_GETINFO 126 - +#define IPC_GETINFO 126 /* (requires Winamp 2.05+) ** int inf=SendMessage(hwnd_winamp,WM_WA_IPC,mode,IPC_GETINFO); -** ** IPC_GETINFO returns info about the current playing song. The value ** it returns depends on the value of 'mode'. ** Mode Meaning @@ -228,15 +168,15 @@ ** 0 Samplerate (i.e. 44100) ** 1 Bitrate (i.e. 128) ** 2 Channels (i.e. 2) +** 3 (5+) Video LOWORD=w HIWORD=h +** 4 (5+) > 65536, string (video description) */ -#define IPC_GETEQDATA 127 - +#define IPC_GETEQDATA 127 /* (requires Winamp 2.05+) ** int data=SendMessage(hwnd_winamp,WM_WA_IPC,pos,IPC_GETEQDATA); -** -** IPC_GETEQDATA queries the status of the EQ. +** IPC_GETEQDATA queries the status of the EQ. ** The value returned depends on what 'pos' is set to: ** Value Meaning ** ------------------ @@ -251,68 +191,219 @@ /* (requires Winamp 2.05+) ** SendMessage(hwnd_winamp,WM_WA_IPC,pos,IPC_GETEQDATA); ** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SETEQDATA); -** ** IPC_SETEQDATA sets the value of the last position retrieved -** by IPC_GETEQDATA. +** by IPC_GETEQDATA. This is pretty lame, and we should provide +** an extended version that lets you do a MAKELPARAM(pos,value). +** someday... + + new (2.92+): + if the high byte is set to 0xDB, then the third byte specifies + which band, and the bottom word specifies the value. */ #define IPC_ADDBOOKMARK 129 /* (requires Winamp 2.4+) -** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)file,IPC_ADDBOOKMARK); -** -** IPC_ADDBOOKMARK will add the specified file to the Winamp bookmark list. +** Sent as a WM_COPYDATA, using IPC_ADDBOOKMARK, adds the specified +** file/url to the Winamp bookmark list. */ +/* +In winamp 5+, we use this as a normal WM_WA_IPC and the string: + + "filename\0title\0" + + to notify the library/bookmark editor that a bookmark +was added. Note that using this message in this context does not +actually add the bookmark. +do not use :) +*/ + + +#define IPC_INSTALLPLUGIN 130 +/* not implemented, but if it was you could do a WM_COPYDATA with +** a path to a .wpz, and it would install it. +*/ + #define IPC_RESTARTWINAMP 135 /* (requires Winamp 2.2+) ** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_RESTARTWINAMP); -** ** IPC_RESTARTWINAMP will restart Winamp (isn't that obvious ? :) */ + +#define IPC_ISFULLSTOP 400 +/* (requires winamp 2.7+ I think) +** ret=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISFULLSTOP); +** useful for when you're an output plugin, and you want to see +** if the stop/close is a full stop, or just between tracks. +** returns nonzero if it's full, zero if it's just a new track. +*/ + + +#define IPC_INETAVAILABLE 242 +/* (requires Winamp 2.05+) +** val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_INETAVAILABLE); +** IPC_INETAVAILABLE will return 1 if the Internet connection is available for Winamp. +*/ + + +#define IPC_UPDTITLE 243 +/* (requires Winamp 2.2+) +** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_UPDTITLE); +** IPC_UPDTITLE will ask Winamp to update the informations about the current title. +*/ + + +#define IPC_REFRESHPLCACHE 247 +/* (requires Winamp 2.2+) +** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_REFRESHPLCACHE); +** IPC_REFRESHPLCACHE will flush the playlist cache buffer. +** (send this if you want it to go refetch titles for tracks) +*/ + + +#define IPC_GET_SHUFFLE 250 +/* (requires Winamp 2.4+) +** val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_SHUFFLE); +** +** IPC_GET_SHUFFLE returns the status of the Shuffle option (1 if set) +*/ + + +#define IPC_GET_REPEAT 251 +/* (requires Winamp 2.4+) +** val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_REPEAT); +** +** IPC_GET_REPEAT returns the status of the Repeat option (1 if set) +*/ + + +#define IPC_SET_SHUFFLE 252 +/* (requires Winamp 2.4+) +** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SET_SHUFFLE); +** +** IPC_SET_SHUFFLE sets the status of the Shuffle option (1 to turn it on) +*/ + + +#define IPC_SET_REPEAT 253 +/* (requires Winamp 2.4+) +** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SET_REPEAT); +** +** IPC_SET_REPEAT sets the status of the Repeat option (1 to turn it on) +*/ + + +#define IPC_ENABLEDISABLE_ALL_WINDOWS 259 // 0xdeadbeef to disable +/* (requires Winamp 2.9+) +** SendMessage(hwnd_winamp,WM_WA_IPC,enable?0:0xdeadbeef,IPC_MBOPENREAL); +** sending with 0xdeadbeef as the param disables all winamp windows, +** any other values will enable all winamp windows. +*/ + + +#define IPC_GETWND 260 +/* (requires Winamp 2.9+) +** HWND h=SendMessage(hwnd_winamp,WM_WA_IPC,IPC_GETWND_xxx,IPC_GETWND); +** returns the HWND of the window specified. +*/ + #define IPC_GETWND_EQ 0 // use one of these for the param + #define IPC_GETWND_PE 1 + #define IPC_GETWND_MB 2 + #define IPC_GETWND_VIDEO 3 +#define IPC_ISWNDVISIBLE 261 // same param as IPC_GETWND + + + + +/************************************************************************ +***************** in-process only (WE LOVE PLUGINS) +************************************************************************/ + + +#define IPC_SETSKIN 200 +/* (requires Winamp 2.04+, only usable from plug-ins (not external apps)) +** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)"skinname",IPC_SETSKIN); +** IPC_SETSKIN sets the current skin to "skinname". Note that skinname +** can be the name of a skin, a skin .zip file, with or without path. +** If path isn't specified, the default search path is the winamp skins +** directory. +*/ + + +#define IPC_GETSKIN 201 +/* (requires Winamp 2.04+, only usable from plug-ins (not external apps)) +** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)skinname_buffer,IPC_GETSKIN); +** IPC_GETSKIN puts the directory where skin bitmaps can be found +** into skinname_buffer. +** skinname_buffer must be MAX_PATH characters in length. +** When using a .zip'd skin file, it'll return a temporary directory +** where the ZIP was decompressed. +*/ + + +#define IPC_EXECPLUG 202 +/* (requires Winamp 2.04+, only usable from plug-ins (not external apps)) +** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)"vis_file.dll",IPC_EXECPLUG); +** IPC_EXECPLUG executes a visualization plug-in pointed to by WPARAM. +** the format of this string can be: +** "vis_whatever.dll" +** "vis_whatever.dll,0" // (first mod, file in winamp plug-in dir) +** "C:\\dir\\vis_whatever.dll,1" +*/ + + +#define IPC_GETPLAYLISTFILE 211 +/* (requires Winamp 2.04+, only usable from plug-ins (not external apps)) +** char *name=SendMessage(hwnd_winamp,WM_WA_IPC,index,IPC_GETPLAYLISTFILE); +** IPC_GETPLAYLISTFILE gets the filename of the playlist entry [index]. +** returns a pointer to it. returns NULL on error. +*/ + + +#define IPC_GETPLAYLISTTITLE 212 +/* (requires Winamp 2.04+, only usable from plug-ins (not external apps)) +** char *name=SendMessage(hwnd_winamp,WM_WA_IPC,index,IPC_GETPLAYLISTTITLE); +** +** IPC_GETPLAYLISTTITLE gets the title of the playlist entry [index]. +** returns a pointer to it. returns NULL on error. +*/ + + +#define IPC_GETHTTPGETTER 240 +/* retrieves a function pointer to a HTTP retrieval function. +** if this is unsupported, returns 1 or 0. +** the function should be: +** int (*httpRetrieveFile)(HWND hwnd, char *url, char *file, char *dlgtitle); +** if you call this function, with a parent window, a URL, an output file, and a dialog title, +** it will return 0 on successful download, 1 on error. +*/ + + #define IPC_MBOPEN 241 /* (requires Winamp 2.05+) ** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_MBOPEN); ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)url,IPC_MBOPEN); -** ** IPC_MBOPEN will open a new URL in the minibrowser. if url is NULL, it will open the Minibrowser window. */ -#define IPC_INETAVAILABLE 242 -/* (requires Winamp 2.05+) -** val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_INETAVAILABLE); -** -** IPC_INETAVAILABLE will return 1 if the Internet connection is available for Winamp. -*/ -#define IPC_UPDTITLE 243 -/* (requires Winamp 2.2+) -** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_UPDTITLE); -** -** IPC_UPDTITLE will ask Winamp to update the informations about the current title. -*/ #define IPC_CHANGECURRENTFILE 245 /* (requires Winamp 2.05+) ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)file,IPC_CHANGECURRENTFILE); -** ** IPC_CHANGECURRENTFILE will set the current playlist item. */ + #define IPC_GETMBURL 246 /* (requires Winamp 2.2+) ** char buffer[4096]; // Urls can be VERY long ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)buffer,IPC_GETMBURL); -** ** IPC_GETMBURL will retrieve the current Minibrowser URL into buffer. +** buffer must be at least 4096 bytes long. */ -#define IPC_REFRESHPLCACHE 247 -/* (requires Winamp 2.2+) -** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_REFRESHPLCACHE); -** -** IPC_REFRESHPLCACHE will flush the playlist cache buffer. -*/ #define IPC_MBBLOCK 248 /* (requires Winamp 2.4+) @@ -325,79 +416,560 @@ /* (requires Winamp 2.4+) ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)url,IPC_MBOPENREAL); ** -** IPC_MBOPENREAL works the same as IPC_MBOPEN except that it will works even if +** IPC_MBOPENREAL works the same as IPC_MBOPEN except that it will works even if ** IPC_MBBLOCK has been set to 1 */ -#define IPC_GET_SHUFFLE 250 -/* (requires Winamp 2.4+) -** val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_SHUFFLE); -** -** IPC_GET_SHUFFLE returns the status of the Shuffle option (1 if set) +#define IPC_ADJUST_OPTIONSMENUPOS 280 +/* (requires Winamp 2.9+) +** int newpos=SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)adjust_offset,IPC_ADJUST_OPTIONSMENUPOS); +** moves where winamp expects the Options menu in the main menu. Useful if you wish to insert a +** menu item above the options/skins/vis menus. */ -#define IPC_GET_REPEAT 251 -/* (requires Winamp 2.4+) -** val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_REPEAT); -** -** IPC_GET_REPEAT returns the status of the Repeat option (1 if set) +#define IPC_GET_HMENU 281 +/* (requires Winamp 2.9+) +** HMENU hMenu=SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)0,IPC_GET_HMENU); +** values for data: +** 0 : main popup menu +** 1 : main menubar file menu +** 2 : main menubar options menu +** 3 : main menubar windows menu +** 4 : main menubar help menu +** other values will return NULL. */ -#define IPC_SET_SHUFFLE 252 -/* (requires Winamp 2.4+) -** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SET_SHUFFLE); -** -** IPC_SET_SHUFFLE sets the status of the Shuffle option (1 to turn it on) +#define IPC_GET_EXTENDED_FILE_INFO 290 //pass a pointer to the following struct in wParam +#define IPC_GET_EXTENDED_FILE_INFO_HOOKABLE 296 +/* (requires Winamp 2.9+) +** to use, create an extendedFileInfoStruct, point the values filename and metadata to the +** filename and metadata field you wish to query, and ret to a buffer, with retlen to the +** length of that buffer, and then SendMessage(hwnd_winamp,WM_WA_IPC,&struct,IPC_GET_EXTENDED_FILE_INFO); +** the results should be in the buffer pointed to by ret. +** returns 1 if the decoder supports a getExtendedFileInfo method +*/ +typedef struct { + char *filename; + char *metadata; + char *ret; + int retlen; +} extendedFileInfoStruct; + +#define IPC_GET_BASIC_FILE_INFO 291 //pass a pointer to the following struct in wParam +typedef struct { + char *filename; + + int quickCheck; // set to 0 to always get, 1 for quick, 2 for default (if 2, quickCheck will be set to 0 if quick wasnot used) + + // filled in by winamp + int length; + char *title; + int titlelen; +} basicFileInfoStruct; + +#define IPC_GET_EXTLIST 292 //returns doublenull delimited. GlobalFree() it when done. if data is 0, returns raw extlist, if 1, returns something suitable for getopenfilename + +#define IPC_INFOBOX 293 +typedef struct { + HWND parent; + char *filename; +} infoBoxParam; + +#define IPC_SET_EXTENDED_FILE_INFO 294 //pass a pointer to the a extendedFileInfoStruct in wParam +/* (requires Winamp 2.9+) +** to use, create an extendedFileInfoStruct, point the values filename and metadata to the +** filename and metadata field you wish to write in ret. (retlen is not used). and then +** SendMessage(hwnd_winamp,WM_WA_IPC,&struct,IPC_SET_EXTENDED_FILE_INFO); +** returns 1 if the metadata is supported +** Call IPC_WRITE_EXTENDED_FILE_INFO once you're done setting all the metadata you want to update */ -#define IPC_SET_REPEAT 253 -/* (requires Winamp 2.4+) -** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SET_REPEAT); -** -** IPC_SET_REPEAT sets the status of the Repeat option (1 to turn it on) +#define IPC_WRITE_EXTENDED_FILE_INFO 295 +/* (requires Winamp 2.9+) +** writes all the metadata set thru IPC_SET_EXTENDED_FILE_INFO to the file +** returns 1 if the file has been successfully updated, 0 if error */ +#define IPC_FORMAT_TITLE 297 +typedef struct +{ + char *spec; // NULL=default winamp spec + void *p; + + char *out; + int out_len; + + char * (*TAGFUNC)(char * tag, void * p); //return 0 if not found + void (*TAGFREEFUNC)(char * tag,void * p); +} waFormatTitle; + +#define IPC_GETUNCOMPRESSINTERFACE 331 +/* returns a function pointer to uncompress(). +** int (*uncompress)(unsigned char *dest, unsigned long *destLen, const unsigned char *source, unsigned long sourceLen); +** right out of zlib, useful for decompressing zlibbed data. +** if you pass the parm of 0x10100000, it will return a wa_inflate_struct * to an inflate API. +*/ + +typedef struct { + int (*inflateReset)(void *strm); + int (*inflateInit_)(void *strm,const char *version, int stream_size); + int (*inflate)(void *strm, int flush); + int (*inflateEnd)(void *strm); + unsigned long (*crc32)(unsigned long crc, const unsigned char *buf, unsigned int len); +} wa_inflate_struct; + + +#define IPC_ADD_PREFS_DLG 332 +#define IPC_REMOVE_PREFS_DLG 333 +/* (requires Winamp 2.9+) +** to use, allocate a prefsDlgRec structure (either on the heap or some global +** data, but NOT on the stack), initialze the members: +** hInst to the DLL instance where the resource is located +** dlgID to the ID of the dialog, +** proc to the window procedure for the dialog +** name to the name of the prefs page in the prefs. +** where to 0 (eventually we may add more options) +** then, SendMessage(hwnd_winamp,WM_WA_IPC,&prefsRec,IPC_ADD_PREFS_DLG); +** +** you can also IPC_REMOVE_PREFS_DLG with the address of the same prefsRec, +** but you shouldn't really ever have to. +** +*/ +#define IPC_OPENPREFSTOPAGE 380 // pass an id of a builtin page, or a &prefsDlgRec of prefs page to open + +typedef struct _prefsDlgRec { + HINSTANCE hInst; + int dlgID; + void *proc; + + char *name; + int where; // 0 for options, 1 for plugins, 2 for skins, 3 for bookmarks, 4 for prefs + + + int _id; + struct _prefsDlgRec *next; +} prefsDlgRec; + + +#define IPC_GETINIFILE 334 // returns a pointer to winamp.ini +#define IPC_GETINIDIRECTORY 335 // returns a pointer to the directory to put config files in (if you dont want to use winamp.ini) + +#define IPC_SPAWNBUTTONPOPUP 361 // param = +// 0 = eject +// 1 = previous +// 2 = next +// 3 = pause +// 4 = play +// 5 = stop + +#define IPC_OPENURLBOX 360 // pass a HWND to a parent, returns a HGLOBAL that needs to be freed with GlobalFree(), if successful +#define IPC_OPENFILEBOX 362 // pass a HWND to a parent +#define IPC_OPENDIRBOX 363 // pass a HWND to a parent + +// pass an HWND to a parent. call this if you take over the whole UI so that the dialogs are not appearing on the +// bottom right of the screen since the main winamp window is at 3000x3000, call again with NULL to reset +#define IPC_SETDIALOGBOXPARENT 364 + + + +// pass 0 for a copy of the skin HBITMAP +// pass 1 for name of font to use for playlist editor likeness +// pass 2 for font charset +// pass 3 for font size +#define IPC_GET_GENSKINBITMAP 503 + + +#define IPC_GET_EMBEDIF 505 // pass an embedWindowState +// returns an HWND embedWindow(embedWindowState *); if the data is NULL, otherwise returns the HWND directly +typedef struct +{ + HWND me; //hwnd of the window + + int flags; + + RECT r; + + void *user_ptr; // for application use + + int extra_data[64]; // for internal winamp use +} embedWindowState; + +#define EMBED_FLAGS_NORESIZE 1 // set this bit in embedWindowState.flags to keep window from being resizable +#define EMBED_FLAGS_NOTRANSPARENCY 2 // set this bit in embedWindowState.flags to make gen_ff turn transparency off for this wnd + + +#define IPC_EMBED_ENUM 532 +typedef struct embedEnumStruct +{ + int (*enumProc)(embedWindowState *ws, struct embedEnumStruct *param); // return 1 to abort + int user_data; // or more :) +} embedEnumStruct; + // pass + +#define IPC_EMBED_ISVALID 533 + +#define IPC_CONVERTFILE 506 +/* (requires Winamp 2.92+) +** Converts a given file to a different format (PCM, MP3, etc...) +** To use, pass a pointer to a waFileConvertStruct struct +** This struct can be either on the heap or some global +** data, but NOT on the stack. At least, until the conversion is done. +** +** eg: SendMessage(hwnd_winamp,WM_WA_IPC,&myConvertStruct,IPC_CONVERTFILE); +** +** Return value: +** 0: Can't start the conversion. Look at myConvertStruct->error for details. +** 1: Conversion started. Status messages will be sent to the specified callbackhwnd. +** Be sure to call IPC_CONVERTFILE_END when your callback window receives the +** IPC_CB_CONVERT_DONE message. +*/ +typedef struct +{ + char *sourcefile; // "c:\\source.mp3" + char *destfile; // "c:\\dest.pcm" + int destformat[8]; // like 'PCM ',srate,nch,bps + HWND callbackhwnd; // window that will receive the IPC_CB_CONVERT notification messages + + //filled in by winamp.exe + char *error; //if IPC_CONVERTFILE returns 0, the reason will be here + + int bytes_done; //you can look at both of these values for speed statistics + int bytes_total; + int bytes_out; + + int killswitch; // don't set it manually, use IPC_CONVERTFILE_END + int extra_data[64]; // for internal winamp use +} convertFileStruct; + +#define IPC_CONVERTFILE_END 507 +/* (requires Winamp 2.92+) +** Stop/ends a convert process started from IPC_CONVERTFILE +** You need to call this when you receive the IPC_CB_CONVERTDONE message or when you +** want to abort a conversion process +** +** eg: SendMessage(hwnd_winamp,WM_WA_IPC,&myConvertStruct,IPC_CONVERTFILE_END); +** +** No return value +*/ + +typedef struct { + HWND hwndParent; + int format; + + //filled in by winamp.exe + HWND hwndConfig; + int extra_data[8]; +} convertConfigStruct; +#define IPC_CONVERT_CONFIG 508 +#define IPC_CONVERT_CONFIG_END 509 + +typedef struct +{ + void (*enumProc)(int user_data, const char *desc, int fourcc); + int user_data; +} converterEnumFmtStruct; +#define IPC_CONVERT_CONFIG_ENUMFMTS 510 +/* (requires Winamp 2.92+) +*/ + + +typedef struct +{ + char cdletter; + char *playlist_file; + HWND callback_hwnd; + + //filled in by winamp.exe + char *error; +} burnCDStruct; +#define IPC_BURN_CD 511 +/* (requires Winamp 5.0+) +*/ + +typedef struct +{ + convertFileStruct *cfs; + int priority; +} convertSetPriority; +#define IPC_CONVERT_SET_PRIORITY 512 + +typedef struct +{ + char *filename; + char *title; // 2048 bytes + int length; + int force_useformatting; // can set this to 1 if you want to force a url to use title formatting shit +} waHookTitleStruct; +// return TRUE if you hook this +#define IPC_HOOK_TITLES 850 + +#define IPC_GETSADATAFUNC 800 +// 0: returns a char *export_sa_get() that returns 150 bytes of data +// 1: returns a export_sa_setreq(int want); + +#define IPC_ISMAINWNDVISIBLE 900 + + +#define IPC_SETPLEDITCOLORS 920 +typedef struct +{ + int numElems; + int *elems; + HBITMAP bm; // set if you want to override +} waSetPlColorsStruct; + + +// the following IPC use waSpawnMenuParms as parameter +#define IPC_SPAWNEQPRESETMENU 933 +#define IPC_SPAWNFILEMENU 934 //menubar +#define IPC_SPAWNOPTIONSMENU 935 //menubar +#define IPC_SPAWNWINDOWSMENU 936 //menubar +#define IPC_SPAWNHELPMENU 937 //menubar +#define IPC_SPAWNPLAYMENU 938 //menubar +#define IPC_SPAWNPEFILEMENU 939 //menubar +#define IPC_SPAWNPEPLAYLISTMENU 940 //menubar +#define IPC_SPAWNPESORTMENU 941 //menubar +#define IPC_SPAWNPEHELPMENU 942 //menubar +#define IPC_SPAWNMLFILEMENU 943 //menubar +#define IPC_SPAWNMLVIEWMENU 944 //menubar +#define IPC_SPAWNMLHELPMENU 945 //menubar +#define IPC_SPAWNPELISTOFPLAYLISTS 946 + +typedef struct +{ + HWND wnd; + int xpos; // in screen coordinates + int ypos; +} waSpawnMenuParms; + +// waSpawnMenuParms2 is used by the menubar submenus +typedef struct +{ + HWND wnd; + int xpos; // in screen coordinates + int ypos; + int width; + int height; +} waSpawnMenuParms2; + + +// system tray sends this (you might want to simulate it) +#define WM_WA_SYSTRAY WM_USER+1 + +// input plugins send this when they are done playing back +#define WM_WA_MPEG_EOF WM_USER+2 + + + +//// video stuff + +#define IPC_IS_PLAYING_VIDEO 501 // returns >1 if playing, 0 if not, 1 if old version (so who knows):) +#define IPC_GET_IVIDEOOUTPUT 500 // see below for IVideoOutput interface +#define VIDEO_MAKETYPE(A,B,C,D) ((A) | ((B)<<8) | ((C)<<16) | ((D)<<24)) +#define VIDUSER_SET_INFOSTRING 0x1000 +#define VIDUSER_GET_VIDEOHWND 0x1001 +#define VIDUSER_SET_VFLIP 0x1002 + +#ifndef NO_IVIDEO_DECLARE +#ifdef __cplusplus + +class VideoOutput; +class SubsItem; + +typedef struct { + unsigned char* baseAddr; + long rowBytes; +} YV12_PLANE; + +typedef struct { + YV12_PLANE y; + YV12_PLANE u; + YV12_PLANE v; +} YV12_PLANES; + +class IVideoOutput +{ + public: + virtual ~IVideoOutput() { } + virtual int open(int w, int h, int vflip, double aspectratio, unsigned int fmt)=0; + virtual void setcallback(LRESULT (*msgcallback)(void *token, HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam), void *token) { } + virtual void close()=0; + virtual void draw(void *frame)=0; + virtual void drawSubtitle(SubsItem *item) { } + virtual void showStatusMsg(const char *text) { } + virtual int get_latency() { return 0; } + virtual void notifyBufferState(int bufferstate) { } /* 0-255*/ + + virtual int extended(int param1, int param2, int param3) { return 0; } // Dispatchable, eat this! +}; +#endif //cplusplus +#endif//NO_IVIDEO_DECLARE + +// these messages are callbacks that you can grab by subclassing the winamp window + +// wParam = +#define IPC_CB_WND_EQ 0 // use one of these for the param +#define IPC_CB_WND_PE 1 +#define IPC_CB_WND_MB 2 +#define IPC_CB_WND_VIDEO 3 +#define IPC_CB_WND_MAIN 4 + +#define IPC_CB_ONSHOWWND 600 +#define IPC_CB_ONHIDEWND 601 + +#define IPC_CB_GETTOOLTIP 602 + +#define IPC_CB_MISC 603 + #define IPC_CB_MISC_TITLE 0 + #define IPC_CB_MISC_VOLUME 1 // volume/pan + #define IPC_CB_MISC_STATUS 2 + #define IPC_CB_MISC_EQ 3 + #define IPC_CB_MISC_INFO 4 + #define IPC_CB_MISC_VIDEOINFO 5 + +#define IPC_CB_CONVERT_STATUS 604 // param value goes from 0 to 100 (percent) +#define IPC_CB_CONVERT_DONE 605 + +#define IPC_ADJUST_FFWINDOWSMENUPOS 606 +/* (requires Winamp 2.9+) +** int newpos=SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)adjust_offset,IPC_ADJUST_FFWINDOWSMENUPOS); +** moves where winamp expects the freeform windows in the menubar windows main menu. Useful if you wish to insert a +** menu item above extra freeform windows. +*/ + +#define IPC_ISDOUBLESIZE 608 + +#define IPC_ADJUST_FFOPTIONSMENUPOS 609 +/* (requires Winamp 2.9+) +** int newpos=SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)adjust_offset,IPC_ADJUST_FFOPTIONSMENUPOS); +** moves where winamp expects the freeform preferences item in the menubar windows main menu. Useful if you wish to insert a +** menu item above preferences item. +*/ + +#define IPC_GETTIMEDISPLAYMODE 610 // returns 0 if displaying elapsed time or 1 if displaying remaining time + +#define IPC_SETVISWND 611 // param is hwnd, setting this allows you to receive ID_VIS_NEXT/PREVOUS/RANDOM/FS wm_commands +#define ID_VIS_NEXT 40382 +#define ID_VIS_PREV 40383 +#define ID_VIS_RANDOM 40384 +#define ID_VIS_FS 40389 +#define ID_VIS_CFG 40390 +#define ID_VIS_MENU 40391 + +#define IPC_GETVISWND 612 // returns the vis cmd handler hwnd +#define IPC_ISVISRUNNING 613 +#define IPC_CB_VISRANDOM 628 // param is status of random + +#define IPC_SETIDEALVIDEOSIZE 614 // sent by winamp to winamp, trap it if you need it. width=HIWORD(param), height=LOWORD(param) + +#define IPC_GETSTOPONVIDEOCLOSE 615 +#define IPC_SETSTOPONVIDEOCLOSE 616 + +typedef struct { + HWND hwnd; + int uMsg; + int wParam; + int lParam; +} transAccelStruct; + +#define IPC_TRANSLATEACCELERATOR 617 + +typedef struct { + int cmd; + int x; + int y; + int align; +} windowCommand; // send this as param to an IPC_PLCMD, IPC_MBCMD, IPC_VIDCMD + +#define IPC_CB_ONTOGGLEAOT 618 + +#define IPC_GETPREFSWND 619 + +#define IPC_SET_PE_WIDTHHEIGHT 620 // data is a pointer to a POINT structure that holds width & height + +#define IPC_GETLANGUAGEPACKINSTANCE 621 + +#define IPC_CB_PEINFOTEXT 622 // data is a string, ie: "04:21/45:02" + +#define IPC_CB_OUTPUTCHANGED 623 // output plugin was changed in config + +#define IPC_GETOUTPUTPLUGIN 625 + +#define IPC_SETDRAWBORDERS 626 +#define IPC_DISABLESKINCURSORS 627 +#define IPC_CB_RESETFONT 629 + +#define IPC_IS_FULLSCREEN 630 // returns 1 if video or vis is in fullscreen mode +#define IPC_SET_VIS_FS_FLAG 631 // a vis should send this message with 1/as param to notify winamp that it has gone to or has come back from fullscreen mode + +#define IPC_SHOW_NOTIFICATION 632 + +#define IPC_GETSKININFO 633 + +// >>>>>>>>>>> Next is 634 + +#define IPC_PLCMD 1000 + +#define PLCMD_ADD 0 +#define PLCMD_REM 1 +#define PLCMD_SEL 2 +#define PLCMD_MISC 3 +#define PLCMD_LIST 4 + +#define IPC_MBCMD 1001 + +#define MBCMD_BACK 0 +#define MBCMD_FORWARD 1 +#define MBCMD_STOP 2 +#define MBCMD_RELOAD 3 +#define MBCMD_MISC 4 + +#define IPC_VIDCMD 1002 + +#define VIDCMD_FULLSCREEN 0 +#define VIDCMD_1X 1 +#define VIDCMD_2X 2 +#define VIDCMD_LIB 3 +#define VIDPOPUP_MISC 4 + +#define IPC_MBURL 1003 //sets the URL +#define IPC_MBGETCURURL 1004 //copies the current URL into wParam (have a 4096 buffer ready) +#define IPC_MBGETDESC 1005 //copies the current URL description into wParam (have a 4096 buffer ready) +#define IPC_MBCHECKLOCFILE 1006 //checks that the link file is up to date (otherwise updates it). wParam=parent HWND +#define IPC_MBREFRESH 1007 //refreshes the "now playing" view in the library +#define IPC_MBGETDEFURL 1008 //copies the default URL into wParam (have a 4096 buffer ready) + +#define IPC_STATS_LIBRARY_ITEMCNT 1300 // updates library count status + +// IPC 2000-3000 reserved for freeform messages, see gen_ff/ff_ipc.h +#define IPC_FF_FIRST 2000 +#define IPC_FF_LAST 3000 + +#define IPC_GETDROPTARGET 3001 + +#define IPC_PLAYLIST_MODIFIED 3002 // sent to main wnd whenever the playlist is modified + +#define IPC_PLAYING_FILE 3003 // sent to main wnd with the file as parm whenever a file is played +#define IPC_FILE_TAG_MAY_HAVE_UPDATED 3004 // sent to main wnd with the file as parm whenever a file tag might be updated + + +#define IPC_ALLOW_PLAYTRACKING 3007 +// send nonzero to allow, zero to disallow + +#define IPC_HOOK_OKTOQUIT 3010 // return 0 to abort a quit, nonzero if quit is OK + +#define IPC_WRITECONFIG 3011 // pass 2 to write all, 1 to write playlist + common, 0 to write common+less common + +// pass a string to be the name to register, and returns a value > 65536, which is a unique value you can use +// for custom WM_WA_IPC messages. +#define IPC_REGISTER_WINAMP_IPCMESSAGE 65536 + /**************************************************************************/ /* -** Some API calls tend to require that you send data via WM_COPYDATA -** instead of WM_USER. Such as IPC_PLAYFILE: -*/ - -#define IPC_PLAYFILE 100 - -/* -** COPYDATASTRUCT cds; -** cds.dwData = IPC_PLAYFILE; -** cds.lpData = (void *) "file.mp3"; -** cds.cbData = strlen((char *) cds.lpData)+1; // include space for null char -** SendMessage(hwnd_winamp,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds); -** -** This will play the file "file.mp3". -** -*/ - - -#define IPC_CHDIR 103 - -/* -** COPYDATASTRUCT cds; -** cds.dwData = IPC_CHDIR; -** cds.lpData = (void *) "c:\\download"; -** cds.cbData = strlen((char *) cds.lpData)+1; // include space for null char -** SendMessage(hwnd_winamp,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds); -** -** This will make Winamp change to the directory C:\\download -** -*/ - - -/**************************************************************************/ - -/* -** Finally there are some WM_COMMAND messages that you can use to send +** Finally there are some WM_COMMAND messages that you can use to send ** Winamp misc commands. -** +** ** To send these, use: ** ** SendMessage(hwnd_winamp, WM_COMMAND,command_name,0); @@ -410,7 +982,7 @@ #define WINAMP_FFWD5S 40060 // fast forwards 5 seconds #define WINAMP_REW5S 40061 // rewinds 5 seconds -// the following are the five main control buttons, with optionally shift +// the following are the five main control buttons, with optionally shift // or control pressed // (for the exact functions of each, just try it out) #define WINAMP_BUTTON1 40044 @@ -430,13 +1002,21 @@ #define WINAMP_BUTTON5_CTRL 40158 #define WINAMP_FILE_PLAY 40029 // pops up the load file(s) box +#define WINAMP_FILE_DIR 40187 // pops up the load directory box #define WINAMP_OPTIONS_PREFS 40012 // pops up the preferences #define WINAMP_OPTIONS_AOT 40019 // toggles always on top #define WINAMP_HELP_ABOUT 40041 // pops up the about box :) +#define ID_MAIN_PLAY_AUDIOCD1 40323 // starts playing the audio CD in the first CD reader +#define ID_MAIN_PLAY_AUDIOCD2 40323 // plays the 2nd +#define ID_MAIN_PLAY_AUDIOCD3 40323 // plays the 3nd +#define ID_MAIN_PLAY_AUDIOCD4 40323 // plays the 4nd + +// IDs 42000 to 45000 are reserved for gen_ff +// IDs from 45000 to 57000 are reserved for library + +#endif//_WA_IPC_H_ /* ** EOF.. Enjoy. -*/ - -#endif //_WAFE_H_ +*/ \ No newline at end of file