diff --git a/cpp/JavaWinampApi/Makefile.win b/cpp/JavaWinampApi/Makefile.win new file mode 100644 index 0000000..1620722 --- /dev/null +++ b/cpp/JavaWinampApi/Makefile.win @@ -0,0 +1,34 @@ +# Project: wpcom +# Makefile created by Dev-C++ 4.9.9.2 + +CPP = g++.exe +CC = gcc.exe +WINDRES = windres.exe +RES = +OBJ = WinampController.o $(RES) +LINKOBJ = WinampController.o $(RES) +LIBS = -L"E:/java/Dev-Cpp/lib" --no-export-all-symbols --add-stdcall-alias +INCS = -I"E:/java/Dev-Cpp/include" -I"E:/Program Files/Java/jdk1.6.0_11/include" -I"E:/Program Files/Java/jdk1.6.0_11/include/win32" +CXXINCS = -I"E:/java/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"E:/java/Dev-Cpp/include/c++/3.4.2/backward" -I"E:/java/Dev-Cpp/include/c++/3.4.2/mingw32" -I"E:/java/Dev-Cpp/include/c++/3.4.2" -I"E:/java/Dev-Cpp/include" -I"E:/Program Files/Java/jdk1.6.0_11/include" -I"E:/Program Files/Java/jdk1.6.0_11/include/win32" +BIN = ../../wpcom.dll +CXXFLAGS = $(CXXINCS) -DBUILDING_DLL=1 +CFLAGS = $(INCS) -DBUILDING_DLL=1 +RM = rm -f + +.PHONY: all all-before all-after clean clean-custom + +all: all-before ../../wpcom.dll all-after + + +clean: clean-custom + ${RM} $(OBJ) $(BIN) + +DLLWRAP=dllwrap.exe +DEFFILE=../../libwpcom.def +STATICLIB=../../libwpcom.a + +$(BIN): $(LINKOBJ) + $(DLLWRAP) --output-def $(DEFFILE) --implib $(STATICLIB) $(LINKOBJ) $(LIBS) -o $(BIN) + +WinampController.o: WinampController.c + $(CC) -c WinampController.c -o WinampController.o $(CFLAGS) diff --git a/cpp/JavaWinampApi/WINAMPCMD.H b/cpp/JavaWinampApi/WINAMPCMD.H new file mode 100644 index 0000000..9ba5de3 --- /dev/null +++ b/cpp/JavaWinampApi/WINAMPCMD.H @@ -0,0 +1,62 @@ +#define WINAMP_FILE_QUIT 40001 +#define WINAMP_OPTIONS_PREFS 40012 +#define WINAMP_OPTIONS_AOT 40019 +#define WINAMP_FILE_REPEAT 40022 +#define WINAMP_FILE_SHUFFLE 40023 +#define WINAMP_HIGH_PRIORITY 40025 +#define WINAMP_FILE_PLAY 40029 +#define WINAMP_OPTIONS_EQ 40036 +#define WINAMP_OPTIONS_ELAPSED 40037 +#define WINAMP_OPTIONS_REMAINING 40038 +#define WINAMP_OPTIONS_PLEDIT 40040 +#define WINAMP_HELP_ABOUT 40041 +#define WINAMP_MAINMENU 40043 +#define WINAMP_BUTTON1 40044 +#define WINAMP_BUTTON2 40045 +#define WINAMP_BUTTON3 40046 +#define WINAMP_BUTTON4 40047 +#define WINAMP_BUTTON5 40048 +#define WINAMP_VOLUMEUP 40058 +#define WINAMP_VOLUMEDOWN 40059 +#define WINAMP_FFWD5S 40060 +#define WINAMP_REW5S 40061 +#define WINAMP_NEXT_WINDOW 40063 +#define WINAMP_OPTIONS_WINDOWSHADE 40064 +#define WINAMP_BUTTON1_SHIFT 40144 +#define WINAMP_BUTTON2_SHIFT 40145 +#define WINAMP_BUTTON3_SHIFT 40146 +#define WINAMP_BUTTON4_SHIFT 40147 +#define WINAMP_BUTTON5_SHIFT 40148 +#define WINAMP_BUTTON1_CTRL 40154 +#define WINAMP_BUTTON2_CTRL 40155 +#define WINAMP_BUTTON3_CTRL 40156 +#define WINAMP_BUTTON4_CTRL 40157 +#define WINAMP_BUTTON5_CTRL 40158 +#define WINAMP_OPTIONS_DSIZE 40165 +#define IDC_SORT_FILENAME 40166 +#define IDC_SORT_FILETITLE 40167 +#define IDC_SORT_ENTIREFILENAME 40168 +#define IDC_SELECTALL 40169 +#define IDC_SELECTNONE 40170 +#define IDC_SELECTINV 40171 +#define IDM_EQ_LOADPRE 40172 +#define IDM_EQ_LOADMP3 40173 +#define IDM_EQ_LOADDEFAULT 40174 +#define IDM_EQ_SAVEPRE 40175 +#define IDM_EQ_SAVEMP3 40176 +#define IDM_EQ_SAVEDEFAULT 40177 +#define IDM_EQ_DELPRE 40178 +#define IDM_EQ_DELMP3 40180 +#define IDC_PLAYLIST_PLAY 40184 +#define WINAMP_FILE_LOC 40185 +#define WINAMP_OPTIONS_EASYMOVE 40186 +#define WINAMP_FILE_DIR 40187 +#define WINAMP_EDIT_ID3 40188 +#define WINAMP_TOGGLE_AUTOSCROLL 40189 +#define WINAMP_VISSETUP 40190 +#define WINAMP_PLGSETUP 40191 +#define WINAMP_VISPLUGIN 40192 +#define WINAMP_JUMP 40193 +#define WINAMP_JUMPFILE 40194 +#define WINAMP_JUMP10FWD 40195 +#define WINAMP_JUMP10BACK 40197 diff --git a/cpp/JavaWinampApi/WinampController.c b/cpp/JavaWinampApi/WinampController.c new file mode 100644 index 0000000..84b0db8 --- /dev/null +++ b/cpp/JavaWinampApi/WinampController.c @@ -0,0 +1,587 @@ +/* meu .h */ +#include "WinampController.h" + +/* mingw */ +#include +#include +#include + +/* winamp sdk */ +#include "wa_ipc.h" +#include "WINAMPCMD.H" + +const int WA_CLOSE = 40001 ; +const int WA_PLAY = WINAMP_BUTTON2; +const int WA_STOP = WINAMP_BUTTON4; +const int WA_PAUSE = WINAMP_BUTTON3; +const int WA_PREVTRACK = WINAMP_BUTTON1; +const int WA_NEXTTRACK = WINAMP_BUTTON5; +const int WA_FWD5SECS = WINAMP_FFWD5S; +const int WA_REW5SECS = WINAMP_REW5S; + +const int WA_PLAYLISTLEN = IPC_GETLISTLENGTH; +const int WA_SETVOLUME = IPC_SETVOLUME; +const int WA_SETPLAYLISTPOS = IPC_SETPLAYLISTPOS; +const int WA_WRITEPLAYLIST = IPC_WRITEPLAYLIST; +const int WA_ENQUEUEFILE = IPC_ENQUEUEFILE; + +const int WA_VOLUMEUP = WINAMP_VOLUMEUP; +const int WA_VOLUMEDOWN = WINAMP_VOLUMEDOWN; + +const int WA_CLEARPLAYLIST = IPC_DELETE; +const int WA_NOTHING = 0; +const int WA_TRACK_LENGTH = 1; + +const int WA_RESTART = IPC_RESTARTWINAMP; +const int WA_REFRESHPLCACHE = IPC_REFRESHPLCACHE; +const int WA_GETSHUFFLESTATUS = IPC_GET_SHUFFLE; +const int WA_GETREPEATSTATUS = IPC_GET_REPEAT; +const int WA_SETSHUFFLESTATUS = IPC_SET_SHUFFLE; +const int WA_SETREPEATSTATUS = IPC_SET_REPEAT; + +const int WA_GETSTATUS = IPC_ISPLAYING; + +const int WA_GETLISTPOS = IPC_GETLISTPOS; +const int WA_GETTITLE = IPC_GETPLAYLISTTITLE; + +const int WA_VERSION = IPC_GETVERSION; +const int WA_FILENAMEINLIST = IPC_GETPLAYLISTFILE; +const int WA_GETFILEINFO = IPC_GET_EXTENDED_FILE_INFO; + +HWND hwnd_winamp = NULL; +INT position = 0; +STARTUPINFO si; +PROCESS_INFORMATION pi; +char messageReturn[255]; +wchar_t* wMessageReturn; + +LPDWORD temp; + +void initWinampHandle() { + hwnd_winamp = NULL; + if (hwnd_winamp == NULL) { + hwnd_winamp = FindWindow("Winamp v1.x", NULL); + } + if (hwnd_winamp == NULL) { + hwnd_winamp = FindWindow("Winamp v2.x", NULL); + } + if (hwnd_winamp == NULL) { + hwnd_winamp = FindWindow("Winamp v3.x", NULL); + } +} + +jboolean runWinamp(unsigned char* pathWinamp) { + + /* STARTUPINFO si; + PROCESS_INFORMATION pi;*/ + + ZeroMemory( &si, sizeof(si) ); + si.cb = sizeof(si); + ZeroMemory( &pi, sizeof(pi) ); + + + // Start the child process. + if(!CreateProcess(pathWinamp, + NULL, + 0, + 0, + FALSE, + CREATE_NEW_CONSOLE, + 0, + 0, + &si, + &pi)) + { + return FALSE; + } + + DWORD dwResult = WaitForInputIdle(pi.hProcess,INFINITE); + if (dwResult != 0) return FALSE; + + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + + return TRUE; + + +} + +int getListPos() { + + initWinampHandle(); + if (hwnd_winamp != NULL) { + + return SendMessage(hwnd_winamp,WM_USER,WA_NOTHING,WA_GETLISTPOS); + + } + return -1; + +} + +void getPluginMessage(int param, int sendMessage) +{ + + LPCVOID message = (LPCVOID)SendMessageW(hwnd_winamp, WM_USER, param, sendMessage); + ZeroMemory( &pi, sizeof(pi)); + GetWindowThreadProcessId(hwnd_winamp, &pi.dwThreadId); + pi.hProcess = OpenProcess(PROCESS_ALL_ACCESS,FALSE,pi.dwThreadId); + ReadProcessMemory(pi.hProcess, message, messageReturn,2056,temp); + free(temp); + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + +} + +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_run + (JNIEnv *env, jobject obj) { + + initWinampHandle(); + + if ( hwnd_winamp == NULL ) { + + unsigned char path[MAX_PATH]=""; + DWORD size = MAX_PATH; + + HKEY key; + DWORD tipo; + + if (!RegOpenKey(HKEY_LOCAL_MACHINE,"Software\\Clients\\Media\\Winamp\\shell\\open\\command",&key)==ERROR_SUCCESS) + { + + printf("0"); + return FALSE; + + } + + if (!(RegQueryValueEx(key,"",NULL,&tipo,path,&size))==ERROR_SUCCESS) + { + + RegCloseKey(key); + return FALSE; + + } + + if (!runWinamp(path)) + { + + RegCloseKey(key); + return FALSE; + + } + return TRUE; + + } + + int version = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVERSION); + return TRUE; + +} + +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_exit + (JNIEnv *env, jobject obj) { + + initWinampHandle(); + if (hwnd_winamp != NULL) { + SendMessageA(hwnd_winamp, WM_COMMAND, WA_CLOSE, WA_NOTHING); + return TRUE; + } + + return FALSE; + + +} + +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_play + (JNIEnv *env, jobject obj) { + initWinampHandle(); + if (hwnd_winamp != NULL) { + + SendMessageA(hwnd_winamp, WM_COMMAND, WA_PLAY, WA_NOTHING); + return TRUE; + + } + + return FALSE; +} + + +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_stop + (JNIEnv *env, jobject obj) +{ + initWinampHandle(); + if (hwnd_winamp != NULL) { + SendMessageA(hwnd_winamp, WM_COMMAND, WA_STOP, WA_NOTHING); + return TRUE; + } + + return FALSE; +} + + +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_resume + (JNIEnv *env, jobject obj) { + initWinampHandle(); + if (hwnd_winamp != NULL) { + SendMessageA(hwnd_winamp, WM_COMMAND, WA_PAUSE, WA_NOTHING); + return TRUE; + } + + return FALSE; +} + + +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_pause + (JNIEnv *env, jobject obj) { + initWinampHandle(); + if (hwnd_winamp != NULL) { + SendMessageA(hwnd_winamp, WM_COMMAND, WA_PAUSE, WA_NOTHING); + return TRUE; + } + + return FALSE; +} + +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_previousTrack + (JNIEnv *env, jobject obj) { + initWinampHandle(); + if (hwnd_winamp != NULL) { + SendMessageA(hwnd_winamp, WM_COMMAND, WA_PREVTRACK, WA_NOTHING); + return TRUE; + } + + return FALSE; + +} + +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_nextTrack + (JNIEnv *env, jobject obj) { + initWinampHandle(); + if (hwnd_winamp != NULL) { + SendMessageA(hwnd_winamp, WM_COMMAND, WA_NEXTTRACK, WA_NOTHING); + return TRUE; + } + + return FALSE; +} + +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_fwd5Secs + (JNIEnv *env, jobject obj) { + initWinampHandle(); + if (hwnd_winamp != NULL) { + SendMessageA(hwnd_winamp, WM_COMMAND, WA_FWD5SECS, WA_NOTHING); + return TRUE; + } + + return FALSE; +} + +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_rew5Secs + (JNIEnv *env, jobject obj) { + initWinampHandle(); + if (hwnd_winamp != NULL) { + SendMessageA(hwnd_winamp, WM_COMMAND, WA_REW5SECS, WA_NOTHING); + return TRUE; + } + + return FALSE; +} + +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_increaseVolume + (JNIEnv *env, jobject obj) { + initWinampHandle(); + if (hwnd_winamp != NULL) { + SendMessageA(hwnd_winamp, WM_COMMAND, WA_VOLUMEUP, WA_NOTHING); + return TRUE; + } + + return FALSE; + +} + +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_decreaseVolume + (JNIEnv *env, jobject obj) { + initWinampHandle(); + if (hwnd_winamp != NULL) { + SendMessageA(hwnd_winamp, WM_COMMAND, WA_VOLUMEDOWN, WA_NOTHING); + return TRUE; + } + + return FALSE; + +} + +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_increaseVolumePercent + (JNIEnv *env, jobject obj, jint percent) { + initWinampHandle(); + int i = 0; + if (hwnd_winamp != NULL) { + for(i=0;i0?1:0; +} + +JNIEXPORT jint JNICALL Java_com_qotsa_jni_controller_JNIWinamp_isRepeatStatusOn + (JNIEnv *env, jobject obj) { + jint status = 0; + initWinampHandle(); + if (hwnd_winamp != NULL) { + status = (jint)SendMessageA(hwnd_winamp, WM_USER, WA_NOTHING, WA_GETREPEATSTATUS); + } else + return -1; + + return status>0?1:0; +} + +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_setRepeatStatusOn + (JNIEnv *env, jobject obj, jboolean status) { + initWinampHandle(); + if (hwnd_winamp != NULL) { + SendMessageA(hwnd_winamp, WM_USER, status, WA_SETREPEATSTATUS); + return TRUE; + } + + return FALSE; +} + +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_setShuffleStatusOn + (JNIEnv *env, jobject obj, jboolean status) { + initWinampHandle(); + if (hwnd_winamp != NULL) { + SendMessageA(hwnd_winamp, WM_USER, status, WA_SETSHUFFLESTATUS); + return TRUE; + } + + return FALSE; +} + +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_appendToPlayList + (JNIEnv *env, jobject obj, jstring mp3filename) { + initWinampHandle(); + jboolean iscopy; + if (hwnd_winamp != NULL) { + wMessageReturn = (wchar_t*)(*env)->GetStringChars(env, mp3filename, &iscopy); + int length = wcslen(wMessageReturn); + COPYDATASTRUCT cds; + cds.dwData = IPC_PLAYFILEW; + cds.lpData = (void*)wMessageReturn; + cds.cbData = length * 2 + 2 ; // it sums white space + + SendMessageW(hwnd_winamp, WM_COPYDATA, WA_NOTHING, (LPARAM)&cds); + return TRUE; + } + + return FALSE; + +} + +JNIEXPORT jint JNICALL Java_com_qotsa_jni_controller_JNIWinamp_getStatus + (JNIEnv *env, jobject obj) { + jint status = -1; + initWinampHandle(); + if (hwnd_winamp != NULL) { + status = SendMessageA(hwnd_winamp, WM_USER, WA_NOTHING, WA_GETSTATUS); + } + + return status; + + +} + +JNIEXPORT jint JNICALL Java_com_qotsa_jni_controller_JNIWinamp_getListPos + (JNIEnv *env, jobject obj) { + + return getListPos(); + +} + +JNIEXPORT jstring JNICALL Java_com_qotsa_jni_controller_JNIWinamp_getTitle + (JNIEnv *env, jobject obj) { + + initWinampHandle(); + if (hwnd_winamp != NULL) { + + char title[500] = ""; + GetWindowText(hwnd_winamp,title,500); + return (*env)->NewStringUTF(env,title); + + + } + + return NULL; + +} + +JNIEXPORT jint JNICALL Java_com_qotsa_jni_controller_JNIWinamp_getTime + (JNIEnv *env, jobject obj, jint mode) { + + initWinampHandle(); + if (hwnd_winamp != NULL) { + + return SendMessage(hwnd_winamp,WM_USER,mode,IPC_GETOUTPUTTIME); + + } + + return -2; + +} + +JNIEXPORT jstring JNICALL Java_com_qotsa_jni_controller_JNIWinamp_getFileNameInList + (JNIEnv *env, jobject obj, jint index) +{ + + initWinampHandle(); + + if (hwnd_winamp != NULL) { + + getPluginMessage(index, WA_FILENAMEINLIST); + char* filePath = messageReturn; + jstring strReturn = (*env)->NewStringUTF(env,filePath); + return strReturn; + + } + + return NULL; + +} + +JNIEXPORT jstring JNICALL Java_com_qotsa_jni_controller_JNIWinamp_getFileNamePlaying + (JNIEnv *env, jobject obj) +{ + + initWinampHandle(); + + if (hwnd_winamp != NULL) { + + getPluginMessage(WA_NOTHING, IPC_GET_PLAYING_FILENAME); + wchar_t* fileName = (wchar_t*)messageReturn; + int length = wcslen(fileName); + jstring strReturn = (*env)->NewString(env,fileName,length); + return strReturn; + + } + + return NULL; + +} diff --git a/cpp/JavaWinampApi/WinampController.h b/cpp/JavaWinampApi/WinampController.h new file mode 100644 index 0000000..b9ec6be --- /dev/null +++ b/cpp/JavaWinampApi/WinampController.h @@ -0,0 +1,285 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class WinampController */ + + +#ifndef _Included_WinampController +#define _Included_WinampController +#ifdef __cplusplus +extern "C" { +#endif + +void initWinampHandle(); + +jboolean runWinamp(unsigned char* pathWinamp); + +int getListPos(); + +void getPluginMessage(int param, int sendMessage); + +/* + * Class: WinampController + * Method: run + * Signature: ()V + */ +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_run + (JNIEnv *, jclass); +/* + * Class: WinampController + * Method: exit + * Signature: ()V + */ +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_exit + (JNIEnv *, jclass); +/* + * Class: WinampController + * Method: play + * Signature: ()V + */ +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_play + (JNIEnv *, jclass); + +/* + * Class: WinampController + * Method: stop + * Signature: ()V + */ +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_stop + (JNIEnv *, jclass); + +/* + * Class: WinampController + * Method: resume + * Signature: ()V + */ +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_resume + (JNIEnv *, jclass); + +/* + * Class: WinampController + * Method: pause + * Signature: ()V + */ +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_pause + (JNIEnv *, jclass); + +/* + * Class: WinampController + * Method: previousTrack + * Signature: ()V + */ +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_previousTrack + (JNIEnv *, jclass); + +/* + * Class: WinampController + * Method: nextTrack + * Signature: ()V + */ +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_nextTrack + (JNIEnv *, jclass); + +/* + * Class: WinampController + * Method: fwd5Secs + * Signature: ()V + */ +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_fwd5Secs + (JNIEnv *, jclass); + +/* + * Class: WinampController + * Method: fwd5Secs + * Signature: ()V + */ +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_rew5Secs + (JNIEnv *, jclass); + +/* + * Class: WinampController + * Method: increaseVolume + * Signature: ()V + */ +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_increaseVolume + (JNIEnv *, jclass); + +/* + * Class: WinampController + * Method: decreaseVolume + * Signature: ()V + */ +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_decreaseVolume + (JNIEnv *, jclass); + +/* + * Class: WinampController + * Method: increaseVolumePercent + * Signature: (I)V + */ +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_increaseVolumePercent + (JNIEnv *, jclass, jint); + +/* + * Class: WinampController + * Method: decreaseVolumePercent + * Signature: (I)V + */ +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_decreaseVolumePercent + (JNIEnv *, jclass, jint); + +/* + * Class: WinampController + * Method: setVolume + * Signature: (I)V + */ +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_setVolume + (JNIEnv *, jclass, jint); + +/* + * Class: WinampController + * Method: setVolume + * Signature: (I)V + */ +JNIEXPORT jint JNICALL Java_com_qotsa_jni_controller_JNIWinamp_getVolume + (JNIEnv *, jclass, jint); + +/* + * Class: WinampController + * Method: restart + * Signature: ()V + */ +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_restart + (JNIEnv *, jclass); + +/* + * Class: WinampController + * Method: setPlaylistPosition + * Signature: (I)V + */ +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_setPlaylistPosition + (JNIEnv *, jclass, jint); + +/* + * Class: WinampController + * Method: clearPlayList + * Signature: ()V + */ +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_clearPlayList + (JNIEnv *, jclass); + +/* + * Class: WinampController + * Method: refreshPlayListCache + * Signature: ()V + */ +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_refreshPlayListCache + (JNIEnv *, jclass); + +/* + * Class: WinampController + * Method: getPlayListLength + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_qotsa_jni_controller_JNIWinamp_getPlayListLength + (JNIEnv *, jclass); + +/* + * Class: WinampController + * Method: writePlayListToFile + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_qotsa_jni_controller_JNIWinamp_writePlayListToFile + (JNIEnv *, jclass); + +/* + * Class: WinampController + * Method: isShuffleStatusOn + * Signature: ()Z + */ +JNIEXPORT jint JNICALL Java_com_qotsa_jni_controller_JNIWinamp_isShuffleStatusOn + (JNIEnv *, jclass); + +/* + * Class: WinampController + * Method: isRepeatStatusOn + * Signature: ()Z + */ +JNIEXPORT jint JNICALL Java_com_qotsa_jni_controller_JNIWinamp_isRepeatStatusOn + (JNIEnv *, jclass); + +/* + * Class: WinampController + * Method: setRepeatStatusOn + * Signature: (Z)V + */ +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_setRepeatStatusOn + (JNIEnv *, jclass, jboolean); + +/* + * Class: WinampController + * Method: setShuffleStatusOn + * Signature: (Z)V + */ +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_setShuffleStatusOn + (JNIEnv *, jclass, jboolean); + +/* + * Class: WinampController + * Method: appendToPlayList + * Signature: (Ljava/lang/String;)V + */ +JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_appendToPlayList + (JNIEnv *, jclass, jstring); + +/* + * Class: WinampController + * Method: getStatus + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_qotsa_jni_controller_JNIWinamp_getStatus + (JNIEnv *, jclass); + +/* + * Class: WinampController + * Method: getListPos + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_qotsa_jni_controller_JNIWinamp_getListPos + (JNIEnv *, jclass); + +/* + * Class: WinampController + * Method: getTitle + * Signature: ()I + */ +JNIEXPORT jstring JNICALL Java_com_qotsa_jni_controller_JNIWinamp_getTitle + (JNIEnv *, jclass); + +/* + * Class: WinampController + * Method: getTime + * Signature: ()I + */ +JNIEXPORT jint JNICALL Java_com_qotsa_jni_controller_JNIWinamp_getTime + (JNIEnv *, jclass, jint); + +/* + * Class: WinampController + * Method: getFileNameInList + * Signature: ()I + */ +JNIEXPORT jstring JNICALL Java_com_qotsa_jni_controller_JNIWinamp_getFileNameInList + (JNIEnv *, jclass, jint); + +/* + * Class: WinampController + * Method: getFileNamePlaying + * Signature: ()I + */ +JNIEXPORT jstring JNICALL Java_com_qotsa_jni_controller_JNIWinamp_getFileNamePlaying + (JNIEnv *, jobject); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/cpp/JavaWinampApi/cpy.bat b/cpp/JavaWinampApi/cpy.bat new file mode 100644 index 0000000..2abdf4a --- /dev/null +++ b/cpp/JavaWinampApi/cpy.bat @@ -0,0 +1 @@ +copy /y wpcom.dll c:\winnt\system32\ \ No newline at end of file diff --git a/cpp/JavaWinampApi/libwpcom.def b/cpp/JavaWinampApi/libwpcom.def new file mode 100644 index 0000000..8a95977 --- /dev/null +++ b/cpp/JavaWinampApi/libwpcom.def @@ -0,0 +1,58 @@ +; dlltool --base-file C:\DOCUME~1\FRANCI~1\CONFIG~1\Temp/cca03628.base --output-exp wpcom.exp --dllname wpcom.dll --output-def libwpcom.def --no-export-all-symbols --add-stdcall-alias --exclude-symbol=DllMainCRTStartup@12 --def C:\DOCUME~1\FRANCI~1\CONFIG~1\Temp/cca03628.def --output-lib libwpcom.a +EXPORTS + Java_controller_JNIWinampController_appendToPlayList = Java_controller_JNIWinampController_appendToPlayList@12 @ 1 + Java_controller_JNIWinampController_appendToPlayList@12 @ 2 + Java_controller_JNIWinampController_clearPlayList = Java_controller_JNIWinampController_clearPlayList@8 @ 3 + Java_controller_JNIWinampController_clearPlayList@8 @ 4 + Java_controller_JNIWinampController_clearPlayListCache = Java_controller_JNIWinampController_clearPlayListCache@8 @ 5 + Java_controller_JNIWinampController_clearPlayListCache@8 @ 6 + Java_controller_JNIWinampController_decreaseVolume = Java_controller_JNIWinampController_decreaseVolume@8 @ 7 + Java_controller_JNIWinampController_decreaseVolume@8 @ 8 + Java_controller_JNIWinampController_decreaseVolumePercent = Java_controller_JNIWinampController_decreaseVolumePercent@12 @ 9 + Java_controller_JNIWinampController_decreaseVolumePercent@12 @ 10 + Java_controller_JNIWinampController_exit = Java_controller_JNIWinampController_exit@8 @ 11 + Java_controller_JNIWinampController_exit@8 @ 12 + Java_controller_JNIWinampController_getListPos = Java_controller_JNIWinampController_getListPos@8 @ 13 + Java_controller_JNIWinampController_getListPos@8 @ 14 + Java_controller_JNIWinampController_getPlayListLength = Java_controller_JNIWinampController_getPlayListLength@8 @ 15 + Java_controller_JNIWinampController_getPlayListLength@8 @ 16 + Java_controller_JNIWinampController_getSeconds = Java_controller_JNIWinampController_getSeconds@8 @ 17 + Java_controller_JNIWinampController_getSeconds@8 @ 18 + Java_controller_JNIWinampController_getStatus = Java_controller_JNIWinampController_getStatus@8 @ 19 + Java_controller_JNIWinampController_getStatus@8 @ 20 + Java_controller_JNIWinampController_getTitle = Java_controller_JNIWinampController_getTitle@8 @ 21 + Java_controller_JNIWinampController_getTitle@8 @ 22 + Java_controller_JNIWinampController_increaseVolume = Java_controller_JNIWinampController_increaseVolume@8 @ 23 + Java_controller_JNIWinampController_increaseVolume@8 @ 24 + Java_controller_JNIWinampController_increaseVolumePercent = Java_controller_JNIWinampController_increaseVolumePercent@12 @ 25 + Java_controller_JNIWinampController_increaseVolumePercent@12 @ 26 + Java_controller_JNIWinampController_isRepeatStatusOn = Java_controller_JNIWinampController_isRepeatStatusOn@8 @ 27 + Java_controller_JNIWinampController_isRepeatStatusOn@8 @ 28 + Java_controller_JNIWinampController_isShuffleStatusOn = Java_controller_JNIWinampController_isShuffleStatusOn@8 @ 29 + Java_controller_JNIWinampController_isShuffleStatusOn@8 @ 30 + Java_controller_JNIWinampController_nextTrack = Java_controller_JNIWinampController_nextTrack@8 @ 31 + Java_controller_JNIWinampController_nextTrack@8 @ 32 + Java_controller_JNIWinampController_pause = Java_controller_JNIWinampController_pause@8 @ 33 + Java_controller_JNIWinampController_pause@8 @ 34 + Java_controller_JNIWinampController_play = Java_controller_JNIWinampController_play@8 @ 35 + Java_controller_JNIWinampController_play@8 @ 36 + Java_controller_JNIWinampController_previousTrack = Java_controller_JNIWinampController_previousTrack@8 @ 37 + Java_controller_JNIWinampController_previousTrack@8 @ 38 + Java_controller_JNIWinampController_restart = Java_controller_JNIWinampController_restart@8 @ 39 + Java_controller_JNIWinampController_restart@8 @ 40 + Java_controller_JNIWinampController_resume = Java_controller_JNIWinampController_resume@8 @ 41 + Java_controller_JNIWinampController_resume@8 @ 42 + Java_controller_JNIWinampController_run = Java_controller_JNIWinampController_run@8 @ 43 + Java_controller_JNIWinampController_run@8 @ 44 + Java_controller_JNIWinampController_setPlaylistPosition = Java_controller_JNIWinampController_setPlaylistPosition@12 @ 45 + Java_controller_JNIWinampController_setPlaylistPosition@12 @ 46 + Java_controller_JNIWinampController_setRepeatStatusOn = Java_controller_JNIWinampController_setRepeatStatusOn@12 @ 47 + Java_controller_JNIWinampController_setRepeatStatusOn@12 @ 48 + Java_controller_JNIWinampController_setShuffleStatusOn = Java_controller_JNIWinampController_setShuffleStatusOn@12 @ 49 + Java_controller_JNIWinampController_setShuffleStatusOn@12 @ 50 + Java_controller_JNIWinampController_setVolume = Java_controller_JNIWinampController_setVolume@12 @ 51 + Java_controller_JNIWinampController_setVolume@12 @ 52 + Java_controller_JNIWinampController_stop = Java_controller_JNIWinampController_stop@8 @ 53 + Java_controller_JNIWinampController_stop@8 @ 54 + Java_controller_JNIWinampController_writePlayListToFile = Java_controller_JNIWinampController_writePlayListToFile@8 @ 55 + Java_controller_JNIWinampController_writePlayListToFile@8 @ 56 diff --git a/cpp/JavaWinampApi/wa_ipc.h b/cpp/JavaWinampApi/wa_ipc.h new file mode 100644 index 0000000..2ff4275 --- /dev/null +++ b/cpp/JavaWinampApi/wa_ipc.h @@ -0,0 +1,1620 @@ +/* +** Copyright (C) 2006 Nullsoft, Inc. +** +** 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. +** +** 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: +** +** 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. +** +** 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. +** +*/ + +#ifndef _WA_IPC_H_ +#define _WA_IPC_H_ + +#include +#include +#if (_MSC_VER <= 1200) +typedef int intptr_t; +#endif +/* +** 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_*); +** +** When you use SendMessage(hwnd_winamp,WM_WA_IPC,(parameter),IPC_*) and specify a IPC_* +** which is not currently implemented/supported by the Winamp version being used then it +** will return 1 for 'result'. This is a good way of helping to check if an api being +** used which returns a function pointer, etc is even going to be valid. +*/ +#define WM_WA_IPC WM_USER +/* but some of them use WM_COPYDATA. be afraid. +*/ + +#define WINAMP_VERSION_MAJOR(winampVersion) ((winampVersion & 0x0000FF00) >> 12) +#define WINAMP_VERSION_MINOR(winampVersion) (winampVersion & 0x000000FF) // returns, i.e. 0x12 for 5.12 and 0x10 for 5.1... + +#define IPC_GETVERSION 0 +/* int version = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVERSION); +** +** The version returned will be 0x20yx for Winamp 2.yx. +** Versions previous to Winamp 2.0 typically (but not always) use 0x1zyx for 1.zx. +** Just a bit weird but that's the way it goes. +** +** For Winamp 5.x it uses the format 0x50yx for Winamp 5.yx +** e.g. 5.01 -> 0x5001 +** 5.09 -> 0x5009 +** 5.1 -> 0x5010 +** +** Notes: For 5.02 this api will return the same value as for a 5.01 build. +** For 5.07 this api will return the same value as for a 5.06 build. +*/ +#define IPC_GETVERSIONSTRING 1 + +#define IPC_GETREGISTEREDVERSION 770 + + +typedef struct { + const char *filename; + const 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) + +typedef struct { + const wchar_t *filename; + const wchar_t *title; + int length; +} enqueueFileWithMetaStructW; + +#define IPC_PLAYFILE 100 // dont be fooled, this is really the same as enqueufile +#define IPC_ENQUEUEFILE 100 +#define IPC_PLAYFILEW 1100 +/* This is sent as a WM_COPYDATA with IPC_PLAYFILE as the dwData member and the string +** of the file / playlist to be enqueued into the playlist editor as the lpData member. +** This will just enqueue the file or files since you can use this to enqueue a playlist. +** It will not clear the current playlist or change the playback state. +** +** COPYDATASTRUCT cds = {0}; +** cds.dwData = IPC_ENQUEUEFILE; +** cds.lpData = (void*)"c:\\test\\folder\\test.mp3"; +** cds.cbData = lstrlen((char*)cds.lpData)+1; // include space for null char +** SendMessage(hwnd_winamp,WM_COPYDATA,0,(LPARAM)&cds); +** +** +** With 2.9+ and all of the 5.x versions you can send this as a normal WM_WA_IPC +** (non WM_COPYDATA) with an enqueueFileWithMetaStruct as the param. +** If the title member is null then it is treated as a "thing" otherwise it will be +** assumed to be a file (for speed). +** +** enqueueFileWithMetaStruct eFWMS = {0}; +** eFWMS.filename = "c:\\test\\folder\\test.mp3"; +** eFWMS.title = "Whipping Good"; +** eFWMS.length = 300; // this is the number of seconds for the track +** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)&eFWMS,IPC_ENQUEUEFILE); +*/ + + +#define IPC_DELETE 101 +#define IPC_DELETE_INT 1101 +/* SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_DELETE); +** Use this api to clear Winamp's internal playlist. +** You should not need to use IPC_DELETE_INT since it is used internally by Winamp when +** it is dealing with some lame Windows Explorer issues (hard to believe that!). +*/ + + +#define IPC_STARTPLAY 102 +#define IPC_STARTPLAY_INT 1102 +/* SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_STARTPLAY); +** Sending this will start playback and is almost the same as hitting the play button. +** The IPC_STARTPLAY_INT version is used internally and you should not need to use it +** since it won't be any fun. +*/ + +#define IPC_CHDIR 103 +/* This is sent as a WM_COPYDATA type message with IPC_CHDIR as the dwData value and the +** directory you want to change to as the lpData member. +** +** COPYDATASTRUCT cds = {0}; +** cds.dwData = IPC_CHDIR; +** cds.lpData = (void*)"c:\\download"; +** cds.cbData = lstrlen((char*)cds.lpData)+1; // include space for null char +** SendMessage(hwnd_winamp,WM_COPYDATA,0,(LPARAM)&cds); +** +** The above example will make Winamp change to the directory 'C:\download'. +*/ + + +#define IPC_ISPLAYING 104 +/* int res = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISPLAYING); +** This is sent to retrieve the current playback state of Winamp. +** If it returns 1, Winamp is playing. +** If it returns 3, Winamp is paused. +** If it returns 0, Winamp is not playing. +*/ + + +#define IPC_GETOUTPUTTIME 105 +/* int res = SendMessage(hwnd_winamp,WM_WA_IPC,mode,IPC_GETOUTPUTTIME); +** This api can return two different sets of information about current playback status. +** +** If mode = 0 then it will return the position (in ms) of the currently playing track. +** Will return -1 if Winamp is not playing. +** +** If mode = 1 then it will return the current track length (in seconds). +** Will return -1 if there are no tracks (or possibly if Winamp cannot get the length). +*/ + + + +#define IPC_JUMPTOTIME 106 +/* (requires Winamp 1.60+) +** SendMessage(hwnd_winamp,WM_WA_IPC,ms,IPC_JUMPTOTIME); +** This api sets the current position (in milliseconds) for the currently playing song. +** The resulting playback position may only be an approximate time since some playback +** formats do not provide exact seeking e.g. mp3 +** This returns -1 if Winamp is not playing, 1 on end of file, or 0 if it was 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+) +** int cur = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_WRITEPLAYLIST); +** +** IPC_WRITEPLAYLIST will write the current playlist to '\\Winamp.m3u' and +** will also return the current playlist position (see IPC_GETLISTPOS). +** +** This is kinda obsoleted by some of the newer 2.x api items but it still is good for +** use with a front-end program (instead of a plug-in) and you want to see what is in the +** current playlist. +** +** This api will only save out extended file information in the #EXTINF entry if Winamp +** has already read the data such as if the file was played of scrolled into view. If +** Winamp has not read the data then you will only find the file with its filepath entry +** (as is the base requirements for a m3u playlist). +*/ + + +#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'. +*/ + + +#define IPC_SETVOLUME 122 +/* (requires Winamp 2.0+) +** SendMessage(hwnd_winamp,WM_WA_IPC,volume,IPC_SETVOLUME); +** IPC_SETVOLUME sets the volume of Winamp (between the range of 0 to 255). +** +** If you pass 'volume' as -666 then the message will return the current volume. +** int curvol = SendMessage(hwnd_winamp,WM_WA_IPC,-666,IPC_SETVOLUME); +*/ + + +#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). +** +** At least in 5.x+ this works from -127 (left) to 127 (right). +** +** If you pass 'panning' as -666 to this api then it will return the current panning. +** int curpan = SendMessage(hwnd_winamp,WM_WA_IPC,-666,IPC_SETPANNING); +*/ + + +#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 as the number of tracks. +*/ + + +#define IPC_GETLISTPOS 125 +/* (requires Winamp 2.05+) +** int pos=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTPOS); +** IPC_GETLISTPOS returns the current playlist position (which is shown in the playlist +** editor as a differently coloured text entry e.g is yellow for the classic skin). +** +** This api is a lot like IPC_WRITEPLAYLIST but a lot faster since it does not have to +** write out the whole of the current playlist first. +*/ + + +#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 +** ------------------ +** 0 Samplerate, in kilohertz (i.e. 44) +** 1 Bitrate (i.e. 128) +** 2 Channels (i.e. 2) +** 3 (5+) Video LOWORD=w HIWORD=h +** 4 (5+) > 65536, string (video description) +** 5 (5.25+) Samplerate, in hertz (i.e. 44100) +*/ + + +#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. +** The value returned depends on what 'pos' is set to: +** Value Meaning +** ------------------ +** 0-9 The 10 bands of EQ data. 0-63 (+20db - -20db) +** 10 The preamp value. 0-63 (+20db - -20db) +** 11 Enabled. zero if disabled, nonzero if enabled. +** 12 Autoload. zero if disabled, nonzero if enabled. +*/ + + +#define IPC_SETEQDATA 128 +/* (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. 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 +#define IPC_ADDBOOKMARKW 131 +/* (requires Winamp 2.4+) +** This is sent as a WM_COPYDATA using IPC_ADDBOOKMARK as the dwData value and the +** directory you want to change to as the lpData member. This will add the specified +** file / url to the Winamp bookmark list. +** +** COPYDATASTRUCT cds = {0}; +** cds.dwData = IPC_ADDBOOKMARK; +** cds.lpData = (void*)"http://www.blah.com/listen.pls"; +** cds.cbData = lstrlen((char*)cds.lpData)+1; // include space for null char +** SendMessage(hwnd_winamp,WM_COPYDATA,0,(LPARAM)&cds); +** +** +** In Winamp 5.0+ we use this as a normal WM_WA_IPC and the string is null separated as +** the filename and then the title of the entry. +** +** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)(char*)"filename\0title\0",IPC_ADDBOOKMARK); +** +** This will 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, it is essentially just a notification type message :) +*/ + + +#define IPC_INSTALLPLUGIN 130 +/* This is not implemented (and is very unlikely to be done due to safety concerns). +** If it was then you could do a WM_COPYDATA with a path to a .wpz and it would then +** install the plugin for you. +** +** COPYDATASTRUCT cds = {0}; +** cds.dwData = IPC_INSTALLPLUGIN; +** cds.lpData = (void*)"c:\\path\\to\\file.wpz"; +** cds.cbData = lstrlen((char*)cds.lpData)+1; // include space for null char +** SendMessage(hwnd_winamp,WM_COPYDATA,0,(LPARAM)&cds); +*/ + + +#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 ? :) ) +** If this fails to make Winamp start after closing then there is a good chance one (or +** more) of the currently installed plugins caused Winamp to crash on exit (either as a +** silent crash or a full crash log report before it could call itself start again. +*/ + + +#define IPC_ISFULLSTOP 400 +/* (requires winamp 2.7+ I think) +** int ret=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISFULLSTOP); +** This is useful for when you're an output plugin and you want to see if the stop/close +** happening is a full stop or if you are just between tracks. This returns non zero if +** it is a full stop or zero if it is just a new track. +*/ + + +#define IPC_INETAVAILABLE 242 +/* (requires Winamp 2.05+) +** int val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_INETAVAILABLE); +** IPC_INETAVAILABLE will return 1 if an Internet connection is available for Winamp and +** relates to the internet connection type setting on the main general preferences page +** in the Winamp preferences. +*/ + + +#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 information about the current title and +** causes GetFileInfo(..) in the input plugin associated with the current playlist entry +** to be called. This can be called such as when an input plugin is buffering a file so +** that it can cause the buffer percentage to appear in the playlist. +*/ + + +#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 and you send this if you want +** Winamp to go refetch the titles for all of the entries in the current playlist. + +5.3+: pass a wchar_t * string in wParam, and it'll do a strnicmp() before clearing the cache +*/ + + +#define IPC_GET_SHUFFLE 250 +/* (requires Winamp 2.4+) +** int val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_SHUFFLE); +** IPC_GET_SHUFFLE returns the status of the shuffle option. +** If set then it will return 1 and if not set then it will return 0. +*/ + + +#define IPC_GET_REPEAT 251 +/* (requires Winamp 2.4+) +** int val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_REPEAT); +** IPC_GET_REPEAT returns the status of the repeat option. +** If set then it will return 1 and if not set then it will return 0. +*/ + + +#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. +** If 'value' is 1 then shuffle is turned on. +** If 'value' is 0 then shuffle is turned off. +*/ + + +#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. +** If 'value' is 1 then shuffle is turned on. +** If 'value' is 0 then shuffle is turned off. +*/ + + +#define IPC_ENABLEDISABLE_ALL_WINDOWS 259 // 0xdeadbeef to disable +/* (requires Winamp 2.9+) +** SendMessage(hwnd_winamp,WM_WA_IPC,(enable?0:0xdeadbeef),IPC_ENABLEDISABLE_ALL_WINDOWS); +** Sending this message with 0xdeadbeef as the param will disable all winamp windows and +** any other values will enable all of the Winamp windows again. When disabled you won't +** get any response on clicking or trying to do anything to the Winamp windows. If the +** taskbar icon is shown then you may still have control ;) +*/ + + +#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_SETSKINW 199 +#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 +#define IPC_GETPLAYLISTFILEW 214 +/* (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 +#define IPC_GETPLAYLISTTITLEW 213 +/* (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_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_CHANGECURRENTFILEW 1245 +/* (requires Winamp 2.05+) +** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)file,IPC_CHANGECURRENTFILEW); +** IPC_CHANGECURRENTFILEW 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_MBBLOCK 248 +/* (requires Winamp 2.4+) +** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_MBBLOCK); +** +** IPC_MBBLOCK will block the Minibrowser from updates if value is set to 1 +*/ + +#define IPC_MBOPENREAL 249 +/* (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_MBBLOCK has been set to 1 +*/ + +#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_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_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 { + const char *filename; + const char *metadata; + char *ret; + size_t retlen; +} extendedFileInfoStruct; + + +#define IPC_GET_BASIC_FILE_INFO 291 //pass a pointer to the following struct in wParam +typedef struct { + const 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_BASIC_FILE_INFOW 1291 //pass a pointer to the following struct in wParam +typedef struct { + const wchar_t *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; + wchar_t *title; + int titlelen; +} basicFileInfoStructW; + + +#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_GET_EXTLISTW 1292 // wide char version of above + +#define IPC_INFOBOX 293 +typedef struct { + HWND parent; + char *filename; +} infoBoxParam; + +#define IPC_INFOBOXW 1293 +typedef struct { + HWND parent; + const wchar_t *filename; +} infoBoxParamW; + +#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_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)(const char * tag, void * p); //return 0 if not found + void (*TAGFREEFUNC)(char * tag,void * p); +} waFormatTitle; + +#define IPC_FORMAT_TITLE_EXTENDED 298 // similiar to IPC_FORMAT_TITLE, but falls back to Winamp's %tags% if your passed tag function doesn't handle it +typedef struct +{ + const wchar_t *filename; + int useExtendedInfo; // set to 1 if you want the Title Formatter to query the input plugins for any tags that your tag function fails on + const wchar_t *spec; // NULL=default winamp spec + void *p; + + wchar_t *out; + int out_len; + + wchar_t * (*TAGFUNC)(const wchar_t * tag, void * p); //return 0 if not found, -1 for empty tag + void (*TAGFREEFUNC)(wchar_t *tag, void *p); +} waFormatTitleExtended; + +#define IPC_COPY_EXTENDED_FILE_INFO 299 +typedef struct +{ + const char *source; + const char *dest; +} copyFileInfoStruct; + +#define IPC_COPY_EXTENDED_FILE_INFOW 1299 +typedef struct +{ + const wchar_t *source; + const wchar_t *dest; +} copyFileInfoStructW; + + +#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; + intptr_t where; // 0 for options, 1 for plugins, 2 for skins, 3 for bookmarks, 4 for prefs + + intptr_t _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_GETPLUGINDIRECTORY 336 +#define IPC_GETM3UDIRECTORY 337 // returns a char pointer to the directory where winamp.m3u is stored in. +#define IPC_GETM3UDIRECTORYW 338 // returns a wchar_t pointer to the directory where winamp.m3u is stored in. + +#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 + + + +#define IPC_DRO_MIN 401 // reserved for DrO +#define IPC_SET_JTF_COMPARATOR 409 +/* pass me an int (__cdecl *)(const char *, const char *) in wParam */ +#define IPC_SET_JTF_COMPARATOR_W 410 +/* pass me an int (__cdecl *)(const wchar_t *, const wchar_t *) in wParam ... maybe someday :) */ +#define IPC_SET_JTF_DRAWTEXT 416 + +#define IPC_DRO_MAX 499 + + +// 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 + + intptr_t extra_data[64]; // for internal winamp use +} embedWindowState; + +#define EMBED_FLAGS_NORESIZE 0x1 // set this bit in embedWindowState.flags to keep window from being resizable +#define EMBED_FLAGS_NOTRANSPARENCY 0x2 // set this bit in embedWindowState.flags to make gen_ff turn transparency off for this wnd +#define EMBED_FLAGS_NOWINDOWMENU 0x4 // set this bit to prevent gen_ff from automatically adding your window to the right-click menu +#define EMBED_FLAGS_GUID 0x8 // call SET_EMBED_GUID(yourEmbedWindowStateStruct, GUID) to define a GUID for this window + +#define SET_EMBED_GUID(windowState, windowGUID) { windowState->flags |= EMBED_FLAGS_GUID; *((GUID *)&windowState->extra_data[4])=windowGUID; } +#define GET_EMBED_GUID(windowState) (*((GUID *)&windowState->extra_data[4])) + +#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. + //hack alert! you can set destformat[6]=mmioFOURCC('I','N','I',' '); and destformat[7]=(int)my_ini_file; (where my_ini_file is a char*) + 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 + intptr_t 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]; + //hack alert! you can set extra_data[6]=mmioFOURCC('I','N','I',' '); and extra_data[7]=(int)my_ini_file; (where my_ini_file is a char*) +} convertConfigStruct; +#define IPC_CONVERT_CONFIG 508 +#define IPC_CONVERT_CONFIG_END 509 + +typedef struct +{ + void (*enumProc)(intptr_t user_data, const char *desc, int fourcc); + intptr_t 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 +{ + unsigned int format; //fourcc value + char *item; // config item, eg "bitrate" + char *data; // buffer to recieve, or buffer that contains the data + int len; // length of the data buffer (only used when getting a config item) + char *configfile; // config file to read from +} convertConfigItem; + +#define IPC_CONVERT_CONFIG_SET_ITEM 513 // returns TRUE if successful +#define IPC_CONVERT_CONFIG_GET_ITEM 514 // returns TRUE if successful + +typedef struct +{ + const 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 + +typedef struct +{ + const wchar_t *filename; + wchar_t *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 +} waHookTitleStructW; +// return TRUE if you hook this +#define IPC_HOOK_TITLESW 851 + +#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_GETVUDATAFUNC 801 +// 0: returns a int export_vu_get(int channel) that returns 0-255 (or -1 for bad channel) + +#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 +#define VIDUSER_SET_TRACKSELINTERFACE 0x1003 // give your ITrackSelector interface as param2 +#define VIDUSER_OPENVIDEORENDERER 0x1004 +#define VIDUSER_CLOSEVIDEORENDERER 0x1005 +#define VIDUSER_GETPOPUPMENU 0x1006 + +typedef struct +{ + int w; + int h; + int vflip; + double aspectratio; + unsigned int fmt; +} VideoOpenStruct; + +#ifndef NO_IVIDEO_DECLARE +#ifdef __cplusplus + +class VideoOutput; +class SubsItem; + +#ifndef _NSV_DEC_IF_H_ +typedef struct { + unsigned char* baseAddr; + long rowBytes; +} YV12_PLANE; + +typedef struct { + YV12_PLANE y; + YV12_PLANE u; + YV12_PLANE v; +} YV12_PLANES; +#endif + +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) { (void)token; (void)msgcallback; /* to eliminate warning C4100 */ } + 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_PTR extended(INT_PTR param1, INT_PTR param2, INT_PTR param3) { return 0; } // Dispatchable, eat this! +}; + +class ITrackSelector +{ + public: + virtual int getNumAudioTracks()=0; + virtual void enumAudioTrackName(int n, const char *buf, int size)=0; + virtual int getCurAudioTrack()=0; + virtual int getNumVideoTracks()=0; + virtual void enumVideoTrackName(int n, const char *buf, int size)=0; + virtual int getCurVideoTrack()=0; + + virtual void setAudioTrack(int n)=0; + virtual void setVideoTrack(int n)=0; +}; + +#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; + WPARAM wParam; + LPARAM 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 + +#define IPC_GET_MANUALPLADVANCE 634 +/* (requires Winamp 5.03+) +** val=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_MANUALPLADVANCE); +** +** IPC_GET_MANUALPLADVANCE returns the status of the Manual Playlist Advance (1 if set) +*/ + +#define IPC_SET_MANUALPLADVANCE 635 +/* (requires Winamp 5.03+) +** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SET_MANUALPLADVANCE); +** +** IPC_SET_MANUALPLADVANCE sets the status of the Manual Playlist Advance option (1 to turn it on) +*/ + +#define IPC_GET_NEXT_PLITEM 636 +/* (requires Winamp 5.04+) +** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_EOF_GET_NEXT_PLITEM); +** +** Sent to Winamp's main window when an item has just finished playback or the next button has been pressed and +** requesting the new playlist item number to go to. +** Mainly used by gen_jumpex. Subclass this message in your application to return the new item number. +** -1 for normal winamp operation (default) or the new item number in the playlist to play. +*/ + +#define IPC_GET_PREVIOUS_PLITEM 637 +/* (requires Winamp 5.04+) +** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_EOF_GET_PREVIOUS_PLITEM); +** +** Sent to Winamp's main window when the previous button has been pressed and Winamp is requesting the new playlist item number to go to. +** Mainly used by gen_jumpex. Subclass this message in your application to return the new item number. +** -1 for normal winamp operation (default) or the new item number in the playlist to play. +*/ + +#define IPC_IS_WNDSHADE 638 +/* (requires Winamp 5.04+) +** SendMessage(hwnd_winamp,WM_WA_IPC,wnd,IPC_IS_WNDSHADE); +** +** 'wnd' is window id as defined for IPC_GETWND, or -1 for main window +** Returns 1 if wnd is set to winshade mode, or 0 if it is not +*/ + +#define IPC_SETRATING 639 +/* (requires Winamp 5.04+ with ML) +** SendMessage(hwnd_winamp,WM_WA_IPC,rating,IPC_SETRATING); +** 'rating' is an int value from 0 (no rating) to 5 +*/ + +#define IPC_GETRATING 640 +/* (requires Winamp 5.04+ with ML) +** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETRATING); +** returns the current item's rating +*/ + +#define IPC_GETNUMAUDIOTRACKS 641 +/* (requires Winamp 5.04+) +** int n = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETNUMAUDIOTRACKS); +** returns the number of audio tracks for the currently playing item +*/ + +#define IPC_GETNUMVIDEOTRACKS 642 +/* (requires Winamp 5.04+) +** int n = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETNUMVIDEOTRACKS); +** returns the number of video tracks for the currently playing item +*/ + +#define IPC_GETAUDIOTRACK 643 +/* (requires Winamp 5.04+) +** int cur = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETAUDIOTRACK); +** returns the id of the current audio track for the currently playing item +*/ + +#define IPC_GETVIDEOTRACK 644 +/* (requires Winamp 5.04+) +** int cur = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVIDEOTRACK); +** returns the id of the current video track for the currently playing item +*/ + +#define IPC_SETAUDIOTRACK 645 +/* (requires Winamp 5.04+) +** SendMessage(hwnd_winamp,WM_WA_IPC,track,IPC_SETAUDIOTRACK); +** switch the currently playing item to a new audio track +*/ + +#define IPC_SETVIDEOTRACK 646 +/* (requires Winamp 5.04+) +** SendMessage(hwnd_winamp,WM_WA_IPC,track,IPC_SETVIDEOTRACK); +** switch the currently playing item to a new video track +*/ + +#define IPC_PUSH_DISABLE_EXIT 647 +/* (requires Winamp 5.04+) +** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_PUSH_DISABLE_EXIT ); +** lets you disable or re-enable the UI exit functions (close button, +** context menu, alt-f4). +** call IPC_POP_DISABLE_EXIT when you are done doing whatever required +** preventing exit +*/ + +#define IPC_POP_DISABLE_EXIT 648 +/* (requires Winamp 5.04+) +** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_POP_DISABLE_EXIT ); +** see IPC_PUSH_DISABLE_EXIT +*/ + +#define IPC_IS_EXIT_ENABLED 649 +/* (requires Winamp 5.04+) +** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_IS_EXIT_ENABLED); +** returns 0 if exit is disabled, 1 otherwise +*/ + +#define IPC_IS_AOT 650 +/* (requires Winamp 5.04+) +** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_IS_AOT); +** returns status of always on top flag. note: this may not match the actual +** TOPMOST window flag while another fullscreen application is focused +*/ + +#define IPC_USES_RECYCLEBIN 651 +/* +** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_USES_RECYCLEBIN); +** returns 1 if deleted files should be sent to the recycle bin. +** returns 0 if deleted files should be deleted permanently. +** +** You should check for this option if your plugin deletes files +** so that your setting matches the winamp setting +*/ + +#define IPC_FLUSHAUDITS 652 +/* +** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_FLUSHAUDITS); +** +** Will flush any pending audits in the global audits que +** +*/ + +#define IPC_GETPLAYITEM_START 653 +#define IPC_GETPLAYITEM_END 654 + + +#define IPC_GETVIDEORESIZE 655 +#define IPC_SETVIDEORESIZE 656 + +// >>>>>>>>>>> Next is 657 + +#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 + + +/* +** General IPC messages in Winamp +** +** All notification messages appear in the lParam of the main window message proceedure. +*/ + + +#define IPC_GETDROPTARGET 3001 +/* (requires Winamp 5.0+) +** IDropTarget* IDrop = (IDropTarget*)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETDROPTARGET); +** +** You call this to retrieve a copy of the IDropTarget interface which Winamp created for +** handling external drag and drop operations on to it's Windows. This is only really +** useful if you're providing an alternate interface and want your Windows to provide the +** same drag and drop support as Winamp normally provides the user. Check out MSDN or +** your prefered search facility for more information about the IDropTarget interface and +** what's needed to handle it in your own instance. +*/ + +#define IPC_PLAYLIST_MODIFIED 3002 +/* (requires Winamp 5.0+) +** This is a notification message sent to the main Winamp window whenever the playlist is +** modified in any way e.g. the addition/removal of a playlist entry. +** +** It is not a good idea to do large amounts of processing in this notification since it +** will slow down Winamp as playlist entries are modified (especially when you're adding +** in a large playlist). +** +** if(uMsg == WM_WA_IPC && lParam == IPC_PLAYLIST_MODIFIED){ +** // do what you need to do here +** } +*/ + +#define IPC_PLAYING_FILE 3003 +/* (requires Winamp 5.0+) +** This is a notification message sent to the main Winamp window when playback begins for +** a file. This passes the full filepath in the wParam of the message received. +** +** if(uMsg == WM_WA_IPC && lParam == IPC_PLAYING_FILE){ +** // do what you need to do here, e.g. +** process_file((char*)wParam); +** } +*/ + +#define IPC_PLAYING_FILEW 13003 +/* (requires Winamp 5.0+) +** This is a notification message sent to the main Winamp window when playback begins for +** a file. This passes the full filepath in the wParam of the message received. +** +** if(uMsg == WM_WA_IPC && lParam == IPC_PLAYING_FILEW){ +** // do what you need to do here, e.g. +** process_file((wchar_t*)wParam); +** } +*/ + +#define IPC_FILE_TAG_MAY_HAVE_UPDATED 3004 // sent to main wnd with the file as parm (char *) whenever a file tag might be updated +#define IPC_FILE_TAG_MAY_HAVE_UPDATEDW 3005 // sent to main wnd with the file as parm (wchar_t *) whenever a file tag might be updated +/* (requires Winamp 5.0+) +** This is a notification message sent to the main Winamp window when a file's tag +** (e.g. id3) may have been updated. This appears to be sent when the InfoBox(..) function +** of the associated input plugin returns a 1 (which is the file information dialog/editor +** call normally). +** +** if(uMsg == WM_WA_IPC && lParam == IPC_FILE_TAG_MAY_HAVE_UPDATED){ +** // do what you need to do here, e.g. +** update_info_on_file_update((char*)wParam); +** } +*/ + +#define IPC_ALLOW_PLAYTRACKING 3007 +/* (requires Winamp 5.0+) +** SendMessage(hwnd_winamp,WM_WA_IPC,allow,IPC_ALLOW_PLAYTRACKING); +** Send allow as nonzero to allow play tracking and zero to disable the mode. +*/ + +#define IPC_HOOK_OKTOQUIT 3010 +/* (requires Winamp 5.0+) +** This is a notification message sent to the main Winamp window asking if it's okay to +** close or not. Return zero to prevent Winamp from closing or return anything non-zero +** to allow Winamp to close. +** +** The best implementation of this option is to let the message pass through to the +** original window proceedure since another plugin may want to have a say in the matter +** with regards to Winamp closing. +** +** if(uMsg == WM_WA_IPC && lParam == IPC_HOOK_OKTOQUIT){ +** // do what you need to do here, e.g. +** if(no_shut_down()){ +** return 1; +** } +** } +*/ + +#define IPC_WRITECONFIG 3011 +/* (requires Winamp 5.0+) +** SendMessage(hwnd_winamp,WM_WA_IPC,write_type,IPC_WRITECONFIG); +** +** Send write_type as 2 to write all config settings and the current playlist. +** +** Send write_type as 1 to write the playlist and common settings. +** This won't save the following ini settings:: +** +** defext, titlefmt, proxy, visplugin_name, dspplugin_name, check_ft_startup, +** visplugin_num, pe_fontsize, visplugin_priority, visplugin_autoexec, dspplugin_num, +** sticon, splash, taskbar, dropaotfs, ascb_new, ttips, riol, minst, whichicon, +** whichicon2, addtolist, snap, snaplen, parent, hilite, disvis, rofiob, shownumsinpl, +** keeponscreen, eqdsize, usecursors, fixtitles, priority, shuffle_morph_rate, +** useexttitles, bifont, inet_mode, ospb, embedwnd_freesize, no_visseh +** (the above was valid for 5.1) +** +** Send write_type as 0 to write the common and less common settings and no playlist. +*/ + +#define IPC_UPDATE_URL 3012 // pass the URL (char *) in lparam, will be free()'d on done. + +// 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_GET_RANDFUNC 3015 // returns a function to get a random number +/* (requires Winamp 5.1+) +** int (*randfunc)(void) = (int(*)(void))SendMessage(plugin.hwndParent,WM_WA_IPC,0,IPC_GET_RANDFUNC); +** if(randfunc && randfunc != 1){ +** randfunc(); +** } +** +** This will return a positive 32-bit number (essentially 31-bit). +** The check for a returned value of 1 is because that's the default return value from +** SendMessage(..) when it is not handled so is good to check for it in this situation. +*/ + +#define IPC_METADATA_CHANGED 3017 +/* (requires Winamp 5.1+) +** int changed=SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)(char*)field,IPC_METADATA_CHANGED); +** a plugin can SendMessage this to winamp if internal metadata has changes. +** wParam should be a char * of what field changed +** +** Currently used for internal actions (and very few at that) the intent of this api is +** to allow a plugin to call it when metadata has changed in the current playlist entry +** e.g.a new id3v2 tag was found in a stream +** +** The wparam value can either be NULL or a pointer to an ansi string for the metadata +** which has changed. This can be thought of as an advanced version of IPC_UPDTITLE and +** could be used to allow for update of the current title when a specific tag changed. +** +** Not recommended to be used since there is not the complete handling implemented in +** Winamp for it at the moment. +*/ + +#define IPC_SKIN_CHANGED 3018 +/* (requires Winamp 5.1+) +** This is a notification message sent to the main Winamp window by itself whenever +** the skin in use is changed. There is no information sent by the wParam for this. +** +** if(message == WM_WA_IPC && lparam == IPC_SKIN_CHANGED){ +** // do what you need to do to handle skin changes, e.g. call WADlg_init(hwnd_winamp); +** } +*/ + +#define IPC_REGISTER_LOWORD_COMMAND 3019 +/* (requires Winamp 5.1+) +** WORD id = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_REGISTER_LOWORD_COMMAND); +** This will assign you a unique id for making your own commands such as for extra menu +** entries. The starting value returned by this message will potentially change as and +** when the main resource file of Winamp is updated with extra data so assumptions cannot +** be made on what will be returned and plugin loading order will affect things as well. + +** 5.33+ +** If you want to reserve more than one id, you can pass the number of ids required in wParam +*/ + +#define IPC_GET_DISPATCH_OBJECT 3020 // gets winamp main IDispatch * (for embedded webpages) +#define IPC_GET_UNIQUE_DISPATCH_ID 3021 // gives you a unique dispatch ID that won't conflict with anything in winamp's IDispatch * + +#define IPC_ADD_DISPATCH_OBJECT 3022 // add your own dispatch object into winamp's. This lets embedded webpages access your functions +// pass a pointer to DispatchInfo (see below). Winamp makes a copy of all this data so you can safely delete it later +typedef struct +{ + wchar_t *name; // filled in by plugin, make sure it's a unicode string!! (i.e. L"myObject" instead of "myObject). + struct IDispatch *dispatch; // filled in by plugin + DWORD id; // filled in by winamp on return +} DispatchInfo; + +#define IPC_GET_PROXY_STRING 3023 +/* (requires Winamp 5.11+) +** char* proxy_string=(char*)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_PROXY_STRING); +** This will return the same string as is shown on the General Preferences page. +*/ + +#define IPC_USE_REGISTRY 3024 +/* (requires Winamp 5.11+) +** int reg_enabled=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_USE_REGISTRY); +** This will return 0 if you should leave your grubby hands off the registry (i.e. for +** lockdown mode). This is useful if Winamp is run from a USB drive and you can't alter +** system settings, etc. +*/ + +#define IPC_GET_API_SERVICE 3025 +/* (requires Winamp 5.12+) +** api_service* api_service = (api_service)SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GET_API_SERVICE); +** This api will return Winamp's api_service pointer (which is what Winamp3 used, heh). +** If this api is not supported in the Winamp version that is being used at the time then +** the returned value from this api will be 1 which is a good version check. +** +** As of 5.12 there is support for .w5s plugins which reside in %WinampDir%\System and +** are intended for common code that can be shared amongst other plugins e.g. jnetlib.w5s +** which contains jnetlib in one instance instead of being duplicated multiple times in +** all of the plugins which need internet access. +** +** Details on the .w5s specifications will come at some stage (possibly). +*/ + + + +typedef struct { + const wchar_t *filename; + const wchar_t *metadata; + wchar_t *ret; + size_t retlen; +} extendedFileInfoStructW; + +#define IPC_GET_EXTENDED_FILE_INFOW 3026 +/* (requires Winamp 5.13+) +** Pass a pointer to the above struct in wParam +*/ +#define IPC_GET_EXTENDED_FILE_INFOW_HOOKABLE 3027 +#define IPC_SET_EXTENDED_FILE_INFOW 3028 +/* (requires Winamp 5.13+) +** Pass a pointer to the above struct in wParam +*/ + +#define IPC_PLAYLIST_GET_NEXT_SELECTED 3029 +/* (requires 5.2+) +** int pl_item = SendMessage(hwnd_winamp,WM_WA_IPC,start,IPC_PLAYLIST_GET_NEXT_SELECTED); +** +** This works just like the ListView_GetNextItem(..) macro for ListView controls. +** 'start' is the index of the playlist item that you want to begin the search after or +** set this as -1 for the search to begin with the first item of the current playlist. +** +** This will return the index of the selected playlist according to the 'start' value or +** it returns -1 if there is no selection or no more selected items according to 'start'. +** +** Quick example: +** +** int sel = -1; +** // keep incrementing the start of the search so we get all of the selected entries +** while((sel = SendMessage(hwnd_winamp,WM_WA_IPC,sel,IPC_PLAYLIST_GET_NEXT_SELECTED))!=-1){ +** // show the playlist file entry of the selected item(s) if there were any +** MessageBox(hwnd_winamp,(char*)SendMessage(hwnd_winamp,WM_WA_IPC,sel,IPC_GETPLAYLISTFILE),0,0); +** } +*/ + +#define IPC_PLAYLIST_GET_SELECTED_COUNT 3030 +/* (requires 5.2+) +** int selcnt = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_PLAYLIST_GET_SELECTED_COUNT); +** This will return the number of selected playlist entries. +*/ + +#define IPC_GET_PLAYING_FILENAME 3031 // returns wchar_t * of the currently playing filename + +#define IPC_OPEN_URL 3032 // send either ANSI or Unicode string (it'll figure it out, but it MUST start with "h"!, so don't send ftp:// or anything funny) + +#define IPC_REGISTER_WINAMP_IPCMESSAGE 65536 +/* (requires Winamp 5.0+) +** DWORD id = SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)name,IPC_REGISTER_WINAMP_IPCMESSAGE); +** The value 'id' returned is > 65536 and is incremented on subsequent calls for unique +** 'name' values passed to it. By using the same 'name' in different plugins will allow a +** common runtime api to be provided for the currently running instance of Winamp +** e.g. +** PostMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)my_param,registered_ipc); +** Have a look at wa_hotkeys.h for an example on how this api is used in practice for a +** custom WM_WA_IPC message. +** +** if(uMsg == WM_WA_IPC && lParam == id_from_register_winamp_ipcmessage){ +** // do things +** } +*/ + +#endif//_WA_IPC_H_ diff --git a/cpp/JavaWinampApi/wpcom.dev b/cpp/JavaWinampApi/wpcom.dev new file mode 100644 index 0000000..eddc3c2 --- /dev/null +++ b/cpp/JavaWinampApi/wpcom.dev @@ -0,0 +1,69 @@ +[Project] +FileName=wpcom.dev +Name=wpcom +UnitCount=2 +Type=3 +Ver=1 +ObjFiles= +Includes="E:\Program Files\Java\jdk1.6.0_11\include";"E:\Program Files\Java\jdk1.6.0_11\include\win32" +Libs= +PrivateResource= +ResourceIncludes= +MakeIncludes= +Compiler=-DBUILDING_DLL=1_@@_ +CppCompiler=-DBUILDING_DLL=1_@@_ +Linker=--no-export-all-symbols --add-stdcall-alias_@@_ +IsCpp=0 +Icon= +ExeOutput=..\..\..\JavaWinampAPI +ObjectOutput= +OverrideOutput=1 +OverrideOutputName=wpcom.dll +HostApplication= +Folders= +CommandLine= +UseCustomMakefile=0 +CustomMakefile= +IncludeVersionInfo=0 +SupportXPThemes=0 +CompilerSet=0 +CompilerSettings=0000000000000000000000 + +[Unit1] +FileName=WinampController.c +CompileCpp=0 +Folder=wacon +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd=$(CC) -c WinampController.c -o WinampController.o $(CFLAGS) + +[VersionInfo] +Major=0 +Minor=1 +Release=1 +Build=1 +LanguageID=1033 +CharsetID=1252 +CompanyName= +FileVersion= +FileDescription=Developed using the Dev-C++ IDE +InternalName= +LegalCopyright= +LegalTrademarks= +OriginalFilename= +ProductName= +ProductVersion= +AutoIncBuildNr=0 + +[Unit2] +FileName=WinampController.h +CompileCpp=0 +Folder=wacon +Compile=1 +Link=1 +Priority=1000 +OverrideBuildCmd=0 +BuildCmd= + diff --git a/cpp/JavaWinampApi/wpcom.layout b/cpp/JavaWinampApi/wpcom.layout new file mode 100644 index 0000000..4beaa20 --- /dev/null +++ b/cpp/JavaWinampApi/wpcom.layout @@ -0,0 +1,17 @@ +[Editor_0] +CursorCol=32 +CursorRow=359 +TopLine=338 +LeftChar=1 +Open=1 +Top=1 +[Editors] +Focused=0 +Order=1,0 +[Editor_1] +Open=1 +Top=0 +CursorCol=73 +CursorRow=143 +TopLine=127 +LeftChar=1 diff --git a/c/jacob/ComThread.cpp b/cpp/jacob/ComThread.cpp similarity index 100% rename from c/jacob/ComThread.cpp rename to cpp/jacob/ComThread.cpp diff --git a/c/jacob/ComThread.h b/cpp/jacob/ComThread.h similarity index 100% rename from c/jacob/ComThread.h rename to cpp/jacob/ComThread.h diff --git a/c/jacob/Dispatch.cpp b/cpp/jacob/Dispatch.cpp similarity index 100% rename from c/jacob/Dispatch.cpp rename to cpp/jacob/Dispatch.cpp diff --git a/c/jacob/Dispatch.h b/cpp/jacob/Dispatch.h similarity index 100% rename from c/jacob/Dispatch.h rename to cpp/jacob/Dispatch.h diff --git a/c/jacob/DispatchEvents.cpp b/cpp/jacob/DispatchEvents.cpp similarity index 100% rename from c/jacob/DispatchEvents.cpp rename to cpp/jacob/DispatchEvents.cpp diff --git a/c/jacob/DispatchEvents.h b/cpp/jacob/DispatchEvents.h similarity index 100% rename from c/jacob/DispatchEvents.h rename to cpp/jacob/DispatchEvents.h diff --git a/c/jacob/DispatchProxy.cpp b/cpp/jacob/DispatchProxy.cpp similarity index 100% rename from c/jacob/DispatchProxy.cpp rename to cpp/jacob/DispatchProxy.cpp diff --git a/c/jacob/DispatchProxy.h b/cpp/jacob/DispatchProxy.h similarity index 100% rename from c/jacob/DispatchProxy.h rename to cpp/jacob/DispatchProxy.h diff --git a/c/jacob/EnumVariant.cpp b/cpp/jacob/EnumVariant.cpp similarity index 100% rename from c/jacob/EnumVariant.cpp rename to cpp/jacob/EnumVariant.cpp diff --git a/c/jacob/EnumVariant.h b/cpp/jacob/EnumVariant.h similarity index 100% rename from c/jacob/EnumVariant.h rename to cpp/jacob/EnumVariant.h diff --git a/c/jacob/EventProxy.cpp b/cpp/jacob/EventProxy.cpp similarity index 100% rename from c/jacob/EventProxy.cpp rename to cpp/jacob/EventProxy.cpp diff --git a/c/jacob/EventProxy.h b/cpp/jacob/EventProxy.h similarity index 100% rename from c/jacob/EventProxy.h rename to cpp/jacob/EventProxy.h diff --git a/c/jacob/STA.cpp b/cpp/jacob/STA.cpp similarity index 100% rename from c/jacob/STA.cpp rename to cpp/jacob/STA.cpp diff --git a/c/jacob/STA.h b/cpp/jacob/STA.h similarity index 100% rename from c/jacob/STA.h rename to cpp/jacob/STA.h diff --git a/c/jacob/SafeArray.cpp b/cpp/jacob/SafeArray.cpp similarity index 100% rename from c/jacob/SafeArray.cpp rename to cpp/jacob/SafeArray.cpp diff --git a/c/jacob/SafeArray.h b/cpp/jacob/SafeArray.h similarity index 100% rename from c/jacob/SafeArray.h rename to cpp/jacob/SafeArray.h diff --git a/c/jacob/StdAfx.h b/cpp/jacob/StdAfx.h similarity index 100% rename from c/jacob/StdAfx.h rename to cpp/jacob/StdAfx.h diff --git a/c/jacob/Variant.cpp b/cpp/jacob/Variant.cpp similarity index 100% rename from c/jacob/Variant.cpp rename to cpp/jacob/Variant.cpp diff --git a/c/jacob/Variant.h b/cpp/jacob/Variant.h similarity index 100% rename from c/jacob/Variant.h rename to cpp/jacob/Variant.h diff --git a/c/jacob/include/atlalloc.h b/cpp/jacob/include/atlalloc.h similarity index 100% rename from c/jacob/include/atlalloc.h rename to cpp/jacob/include/atlalloc.h diff --git a/c/jacob/include/atlbase.h b/cpp/jacob/include/atlbase.h similarity index 100% rename from c/jacob/include/atlbase.h rename to cpp/jacob/include/atlbase.h diff --git a/c/jacob/include/atlbase.inl b/cpp/jacob/include/atlbase.inl similarity index 100% rename from c/jacob/include/atlbase.inl rename to cpp/jacob/include/atlbase.inl diff --git a/c/jacob/include/atlchecked.h b/cpp/jacob/include/atlchecked.h similarity index 100% rename from c/jacob/include/atlchecked.h rename to cpp/jacob/include/atlchecked.h diff --git a/c/jacob/include/atlcomcli.h b/cpp/jacob/include/atlcomcli.h similarity index 100% rename from c/jacob/include/atlcomcli.h rename to cpp/jacob/include/atlcomcli.h diff --git a/c/jacob/include/atlconv.h b/cpp/jacob/include/atlconv.h similarity index 100% rename from c/jacob/include/atlconv.h rename to cpp/jacob/include/atlconv.h diff --git a/c/jacob/include/atlcore.h b/cpp/jacob/include/atlcore.h similarity index 100% rename from c/jacob/include/atlcore.h rename to cpp/jacob/include/atlcore.h diff --git a/c/jacob/include/atldef.h b/cpp/jacob/include/atldef.h similarity index 100% rename from c/jacob/include/atldef.h rename to cpp/jacob/include/atldef.h diff --git a/c/jacob/include/atlexcept.h b/cpp/jacob/include/atlexcept.h similarity index 100% rename from c/jacob/include/atlexcept.h rename to cpp/jacob/include/atlexcept.h diff --git a/c/jacob/include/atliface.h b/cpp/jacob/include/atliface.h similarity index 100% rename from c/jacob/include/atliface.h rename to cpp/jacob/include/atliface.h diff --git a/c/jacob/include/atlrc.h b/cpp/jacob/include/atlrc.h similarity index 100% rename from c/jacob/include/atlrc.h rename to cpp/jacob/include/atlrc.h diff --git a/c/jacob/include/atlsimpcoll.h b/cpp/jacob/include/atlsimpcoll.h similarity index 100% rename from c/jacob/include/atlsimpcoll.h rename to cpp/jacob/include/atlsimpcoll.h diff --git a/c/jacob/include/atltrace.h b/cpp/jacob/include/atltrace.h similarity index 100% rename from c/jacob/include/atltrace.h rename to cpp/jacob/include/atltrace.h diff --git a/c/jacob/include/statreg.h b/cpp/jacob/include/statreg.h similarity index 100% rename from c/jacob/include/statreg.h rename to cpp/jacob/include/statreg.h diff --git a/c/jacob/lib/atls.lib b/cpp/jacob/lib/atls.lib similarity index 100% rename from c/jacob/lib/atls.lib rename to cpp/jacob/lib/atls.lib diff --git a/c/jacob/msvc/copy.bat b/cpp/jacob/msvc/copy.bat similarity index 100% rename from c/jacob/msvc/copy.bat rename to cpp/jacob/msvc/copy.bat diff --git a/c/jacob/msvc/jacob.sln b/cpp/jacob/msvc/jacob.sln similarity index 100% rename from c/jacob/msvc/jacob.sln rename to cpp/jacob/msvc/jacob.sln diff --git a/c/jacob/msvc/jacob.suo b/cpp/jacob/msvc/jacob.suo similarity index 100% rename from c/jacob/msvc/jacob.suo rename to cpp/jacob/msvc/jacob.suo diff --git a/c/jacob/msvc/jacob.vcxproj b/cpp/jacob/msvc/jacob.vcxproj similarity index 100% rename from c/jacob/msvc/jacob.vcxproj rename to cpp/jacob/msvc/jacob.vcxproj diff --git a/c/jacob/msvc/jacob.vcxproj.filters b/cpp/jacob/msvc/jacob.vcxproj.filters similarity index 100% rename from c/jacob/msvc/jacob.vcxproj.filters rename to cpp/jacob/msvc/jacob.vcxproj.filters diff --git a/c/jacob/msvc/jacob.vcxproj.user b/cpp/jacob/msvc/jacob.vcxproj.user similarity index 100% rename from c/jacob/msvc/jacob.vcxproj.user rename to cpp/jacob/msvc/jacob.vcxproj.user diff --git a/c/jacob/util.cpp b/cpp/jacob/util.cpp similarity index 100% rename from c/jacob/util.cpp rename to cpp/jacob/util.cpp diff --git a/c/jacob/util.h b/cpp/jacob/util.h similarity index 100% rename from c/jacob/util.h rename to cpp/jacob/util.h diff --git a/c/jintellitype/JIntellitype.cpp b/cpp/jintellitype/JIntellitype.cpp similarity index 100% rename from c/jintellitype/JIntellitype.cpp rename to cpp/jintellitype/JIntellitype.cpp diff --git a/c/jintellitype/JIntellitypeHandler.cpp b/cpp/jintellitype/JIntellitypeHandler.cpp similarity index 100% rename from c/jintellitype/JIntellitypeHandler.cpp rename to cpp/jintellitype/JIntellitypeHandler.cpp diff --git a/c/jintellitype/JIntellitypeHandler.h b/cpp/jintellitype/JIntellitypeHandler.h similarity index 100% rename from c/jintellitype/JIntellitypeHandler.h rename to cpp/jintellitype/JIntellitypeHandler.h diff --git a/c/jintellitype/JIntellitypeThread.cpp b/cpp/jintellitype/JIntellitypeThread.cpp similarity index 100% rename from c/jintellitype/JIntellitypeThread.cpp rename to cpp/jintellitype/JIntellitypeThread.cpp diff --git a/c/jintellitype/JIntellitypeThread.h b/cpp/jintellitype/JIntellitypeThread.h similarity index 100% rename from c/jintellitype/JIntellitypeThread.h rename to cpp/jintellitype/JIntellitypeThread.h diff --git a/c/jintellitype/JIntellitype_private.h b/cpp/jintellitype/JIntellitype_private.h similarity index 100% rename from c/jintellitype/JIntellitype_private.h rename to cpp/jintellitype/JIntellitype_private.h diff --git a/c/jintellitype/StdAfx.cpp b/cpp/jintellitype/StdAfx.cpp similarity index 100% rename from c/jintellitype/StdAfx.cpp rename to cpp/jintellitype/StdAfx.cpp diff --git a/c/jintellitype/StdAfx.h b/cpp/jintellitype/StdAfx.h similarity index 100% rename from c/jintellitype/StdAfx.h rename to cpp/jintellitype/StdAfx.h diff --git a/c/jintellitype/com_melloware_jintellitype_JIntellitype.h b/cpp/jintellitype/com_melloware_jintellitype_JIntellitype.h similarity index 100% rename from c/jintellitype/com_melloware_jintellitype_JIntellitype.h rename to cpp/jintellitype/com_melloware_jintellitype_JIntellitype.h diff --git a/c/jintellitype/msvc/copy.bat b/cpp/jintellitype/msvc/copy.bat similarity index 100% rename from c/jintellitype/msvc/copy.bat rename to cpp/jintellitype/msvc/copy.bat diff --git a/c/jintellitype/msvc/jintellitype.sln b/cpp/jintellitype/msvc/jintellitype.sln similarity index 100% rename from c/jintellitype/msvc/jintellitype.sln rename to cpp/jintellitype/msvc/jintellitype.sln diff --git a/c/jintellitype/msvc/jintellitype.suo b/cpp/jintellitype/msvc/jintellitype.suo similarity index 100% rename from c/jintellitype/msvc/jintellitype.suo rename to cpp/jintellitype/msvc/jintellitype.suo diff --git a/c/jintellitype/msvc/jintellitype.vcxproj b/cpp/jintellitype/msvc/jintellitype.vcxproj similarity index 100% rename from c/jintellitype/msvc/jintellitype.vcxproj rename to cpp/jintellitype/msvc/jintellitype.vcxproj diff --git a/c/jintellitype/msvc/jintellitype.vcxproj.filters b/cpp/jintellitype/msvc/jintellitype.vcxproj.filters similarity index 100% rename from c/jintellitype/msvc/jintellitype.vcxproj.filters rename to cpp/jintellitype/msvc/jintellitype.vcxproj.filters diff --git a/c/jintellitype/msvc/jintellitype.vcxproj.user b/cpp/jintellitype/msvc/jintellitype.vcxproj.user similarity index 100% rename from c/jintellitype/msvc/jintellitype.vcxproj.user rename to cpp/jintellitype/msvc/jintellitype.vcxproj.user diff --git a/c/wiiuse/classic.c b/cpp/wiiuse/classic.c similarity index 100% rename from c/wiiuse/classic.c rename to cpp/wiiuse/classic.c diff --git a/c/wiiuse/classic.h b/cpp/wiiuse/classic.h similarity index 100% rename from c/wiiuse/classic.h rename to cpp/wiiuse/classic.h diff --git a/c/wiiuse/definitions.h b/cpp/wiiuse/definitions.h similarity index 100% rename from c/wiiuse/definitions.h rename to cpp/wiiuse/definitions.h diff --git a/c/wiiuse/dynamics.c b/cpp/wiiuse/dynamics.c similarity index 100% rename from c/wiiuse/dynamics.c rename to cpp/wiiuse/dynamics.c diff --git a/c/wiiuse/dynamics.h b/cpp/wiiuse/dynamics.h similarity index 100% rename from c/wiiuse/dynamics.h rename to cpp/wiiuse/dynamics.h diff --git a/c/wiiuse/events.c b/cpp/wiiuse/events.c similarity index 100% rename from c/wiiuse/events.c rename to cpp/wiiuse/events.c diff --git a/c/wiiuse/events.h b/cpp/wiiuse/events.h similarity index 100% rename from c/wiiuse/events.h rename to cpp/wiiuse/events.h diff --git a/c/wiiuse/guitar_hero_3.c b/cpp/wiiuse/guitar_hero_3.c similarity index 100% rename from c/wiiuse/guitar_hero_3.c rename to cpp/wiiuse/guitar_hero_3.c diff --git a/c/wiiuse/guitar_hero_3.h b/cpp/wiiuse/guitar_hero_3.h similarity index 100% rename from c/wiiuse/guitar_hero_3.h rename to cpp/wiiuse/guitar_hero_3.h diff --git a/c/wiiuse/include/hidpi.h b/cpp/wiiuse/include/hidpi.h similarity index 100% rename from c/wiiuse/include/hidpi.h rename to cpp/wiiuse/include/hidpi.h diff --git a/c/wiiuse/include/hidsdi.h b/cpp/wiiuse/include/hidsdi.h similarity index 100% rename from c/wiiuse/include/hidsdi.h rename to cpp/wiiuse/include/hidsdi.h diff --git a/c/wiiuse/include/hidusage.h b/cpp/wiiuse/include/hidusage.h similarity index 100% rename from c/wiiuse/include/hidusage.h rename to cpp/wiiuse/include/hidusage.h diff --git a/c/wiiuse/io.c b/cpp/wiiuse/io.c similarity index 100% rename from c/wiiuse/io.c rename to cpp/wiiuse/io.c diff --git a/c/wiiuse/io.h b/cpp/wiiuse/io.h similarity index 100% rename from c/wiiuse/io.h rename to cpp/wiiuse/io.h diff --git a/c/wiiuse/io_nix.c b/cpp/wiiuse/io_nix.c similarity index 100% rename from c/wiiuse/io_nix.c rename to cpp/wiiuse/io_nix.c diff --git a/c/wiiuse/io_win.c b/cpp/wiiuse/io_win.c similarity index 100% rename from c/wiiuse/io_win.c rename to cpp/wiiuse/io_win.c diff --git a/c/wiiuse/ir.c b/cpp/wiiuse/ir.c similarity index 100% rename from c/wiiuse/ir.c rename to cpp/wiiuse/ir.c diff --git a/c/wiiuse/ir.h b/cpp/wiiuse/ir.h similarity index 100% rename from c/wiiuse/ir.h rename to cpp/wiiuse/ir.h diff --git a/c/wiiuse/lib/hid.lib b/cpp/wiiuse/lib/hid.lib similarity index 100% rename from c/wiiuse/lib/hid.lib rename to cpp/wiiuse/lib/hid.lib diff --git a/c/wiiuse/msvc/copy.bat b/cpp/wiiuse/msvc/copy.bat similarity index 100% rename from c/wiiuse/msvc/copy.bat rename to cpp/wiiuse/msvc/copy.bat diff --git a/c/wiiuse/msvc/wiiuse.sln b/cpp/wiiuse/msvc/wiiuse.sln similarity index 100% rename from c/wiiuse/msvc/wiiuse.sln rename to cpp/wiiuse/msvc/wiiuse.sln diff --git a/c/wiiuse/msvc/wiiuse.suo b/cpp/wiiuse/msvc/wiiuse.suo similarity index 100% rename from c/wiiuse/msvc/wiiuse.suo rename to cpp/wiiuse/msvc/wiiuse.suo diff --git a/c/wiiuse/msvc/wiiuse.vcxproj b/cpp/wiiuse/msvc/wiiuse.vcxproj similarity index 100% rename from c/wiiuse/msvc/wiiuse.vcxproj rename to cpp/wiiuse/msvc/wiiuse.vcxproj diff --git a/c/wiiuse/msvc/wiiuse.vcxproj.filters b/cpp/wiiuse/msvc/wiiuse.vcxproj.filters similarity index 100% rename from c/wiiuse/msvc/wiiuse.vcxproj.filters rename to cpp/wiiuse/msvc/wiiuse.vcxproj.filters diff --git a/c/wiiuse/msvc/wiiuse.vcxproj.user b/cpp/wiiuse/msvc/wiiuse.vcxproj.user similarity index 100% rename from c/wiiuse/msvc/wiiuse.vcxproj.user rename to cpp/wiiuse/msvc/wiiuse.vcxproj.user diff --git a/c/wiiuse/nunchuk.c b/cpp/wiiuse/nunchuk.c similarity index 100% rename from c/wiiuse/nunchuk.c rename to cpp/wiiuse/nunchuk.c diff --git a/c/wiiuse/nunchuk.h b/cpp/wiiuse/nunchuk.h similarity index 100% rename from c/wiiuse/nunchuk.h rename to cpp/wiiuse/nunchuk.h diff --git a/c/wiiuse/os.h b/cpp/wiiuse/os.h similarity index 100% rename from c/wiiuse/os.h rename to cpp/wiiuse/os.h diff --git a/c/wiiuse/speaker.c b/cpp/wiiuse/speaker.c similarity index 100% rename from c/wiiuse/speaker.c rename to cpp/wiiuse/speaker.c diff --git a/c/wiiuse/speaker.h b/cpp/wiiuse/speaker.h similarity index 100% rename from c/wiiuse/speaker.h rename to cpp/wiiuse/speaker.h diff --git a/c/wiiuse/wiiuse.c b/cpp/wiiuse/wiiuse.c similarity index 100% rename from c/wiiuse/wiiuse.c rename to cpp/wiiuse/wiiuse.c diff --git a/c/wiiuse/wiiuse.h b/cpp/wiiuse/wiiuse.h similarity index 100% rename from c/wiiuse/wiiuse.h rename to cpp/wiiuse/wiiuse.h diff --git a/c/wiiuse/wiiuse_internal.h b/cpp/wiiuse/wiiuse_internal.h similarity index 100% rename from c/wiiuse/wiiuse_internal.h rename to cpp/wiiuse/wiiuse_internal.h diff --git a/c/wiiusej/lib/wiiuse.lib b/cpp/wiiusej/lib/wiiuse.lib similarity index 100% rename from c/wiiusej/lib/wiiuse.lib rename to cpp/wiiusej/lib/wiiuse.lib diff --git a/c/wiiusej/msvc/WiiUseJ.sln b/cpp/wiiusej/msvc/WiiUseJ.sln similarity index 100% rename from c/wiiusej/msvc/WiiUseJ.sln rename to cpp/wiiusej/msvc/WiiUseJ.sln diff --git a/c/wiiusej/msvc/WiiUseJ.suo b/cpp/wiiusej/msvc/WiiUseJ.suo similarity index 100% rename from c/wiiusej/msvc/WiiUseJ.suo rename to cpp/wiiusej/msvc/WiiUseJ.suo diff --git a/c/wiiusej/msvc/WiiUseJ.vcxproj b/cpp/wiiusej/msvc/WiiUseJ.vcxproj similarity index 100% rename from c/wiiusej/msvc/WiiUseJ.vcxproj rename to cpp/wiiusej/msvc/WiiUseJ.vcxproj diff --git a/c/wiiusej/msvc/WiiUseJ.vcxproj.filters b/cpp/wiiusej/msvc/WiiUseJ.vcxproj.filters similarity index 100% rename from c/wiiusej/msvc/WiiUseJ.vcxproj.filters rename to cpp/wiiusej/msvc/WiiUseJ.vcxproj.filters diff --git a/c/wiiusej/msvc/WiiUseJ.vcxproj.user b/cpp/wiiusej/msvc/WiiUseJ.vcxproj.user similarity index 100% rename from c/wiiusej/msvc/WiiUseJ.vcxproj.user rename to cpp/wiiusej/msvc/WiiUseJ.vcxproj.user diff --git a/c/wiiusej/msvc/copy.bat b/cpp/wiiusej/msvc/copy.bat similarity index 100% rename from c/wiiusej/msvc/copy.bat rename to cpp/wiiusej/msvc/copy.bat diff --git a/c/wiiusej/speaker.h b/cpp/wiiusej/speaker.h similarity index 100% rename from c/wiiusej/speaker.h rename to cpp/wiiusej/speaker.h diff --git a/c/wiiusej/wiiuse.h b/cpp/wiiusej/wiiuse.h similarity index 100% rename from c/wiiusej/wiiuse.h rename to cpp/wiiusej/wiiuse.h diff --git a/c/wiiusej/wiiusej_Speaker.c b/cpp/wiiusej/wiiusej_Speaker.c similarity index 100% rename from c/wiiusej/wiiusej_Speaker.c rename to cpp/wiiusej/wiiusej_Speaker.c diff --git a/c/wiiusej/wiiusej_Speaker.h b/cpp/wiiusej/wiiusej_Speaker.h similarity index 100% rename from c/wiiusej/wiiusej_Speaker.h rename to cpp/wiiusej/wiiusej_Speaker.h diff --git a/c/wiiusej/wiiusej_WiiUseApi.c b/cpp/wiiusej/wiiusej_WiiUseApi.c similarity index 100% rename from c/wiiusej/wiiusej_WiiUseApi.c rename to cpp/wiiusej/wiiusej_WiiUseApi.c diff --git a/c/wiiusej/wiiusej_WiiUseApi.def b/cpp/wiiusej/wiiusej_WiiUseApi.def similarity index 100% rename from c/wiiusej/wiiusej_WiiUseApi.def rename to cpp/wiiusej/wiiusej_WiiUseApi.def diff --git a/c/wiiusej/wiiusej_WiiUseApi.h b/cpp/wiiusej/wiiusej_WiiUseApi.h similarity index 100% rename from c/wiiusej/wiiusej_WiiUseApi.h rename to cpp/wiiusej/wiiusej_WiiUseApi.h diff --git a/java/src/com/qotsa/exception/InvalidHandle.java b/java/src/com/qotsa/exception/InvalidHandle.java new file mode 100644 index 0000000..dc965f1 --- /dev/null +++ b/java/src/com/qotsa/exception/InvalidHandle.java @@ -0,0 +1,40 @@ +/* + * InvalidHandle.java + * + * Created on 9 de Outubro de 2007, 14:18 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package com.qotsa.exception; + +/** + * Exception to throw when Winamp Handle Fails. + * + * @author Francisco + */ +public class InvalidHandle extends Exception{ + + private static final String defaultMessage = "Invalid Handle. Please Verify if Winamp is running."; + + /** + * Creates a new instance of InvalidHandle + * @param message Message to print in the stack. + */ + public InvalidHandle(String message) { + + super(message); + + } + + /** + * Creates a new instance of InvalidHandle with the default message + */ + public InvalidHandle() { + + super(defaultMessage); + + } + +} diff --git a/java/src/com/qotsa/exception/InvalidParameter.java b/java/src/com/qotsa/exception/InvalidParameter.java new file mode 100644 index 0000000..0a45a13 --- /dev/null +++ b/java/src/com/qotsa/exception/InvalidParameter.java @@ -0,0 +1,40 @@ +/* + * InvalidParameter.java + * + * Created on 11 de Outubro de 2007, 10:53 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package com.qotsa.exception; + +/** + * Exception to throw when any parameter is invalid. + * + * @author Francisco + */ +public class InvalidParameter extends Exception { + + private static final String defaultMessage = "Invalid Parameter"; + + /** + * Creates a new instance of NegativeValueException + * @param message Message to print in the stack. + */ + public InvalidParameter(String message) { + + super(message); + + } + + /** + * Creates a new instance of NegativeValueException with the default message + */ + public InvalidParameter() { + + super(defaultMessage); + + } + +} diff --git a/java/src/com/qotsa/exception/package.html b/java/src/com/qotsa/exception/package.html new file mode 100644 index 0000000..07b6ce6 --- /dev/null +++ b/java/src/com/qotsa/exception/package.html @@ -0,0 +1,20 @@ + + + + + + + +Package containing the Exception Class used in the WinampController Class. + + +

Package Specification

+ + + + + diff --git a/java/src/com/qotsa/jni/controller/JNIWinamp.java b/java/src/com/qotsa/jni/controller/JNIWinamp.java new file mode 100644 index 0000000..f40c50e --- /dev/null +++ b/java/src/com/qotsa/jni/controller/JNIWinamp.java @@ -0,0 +1,227 @@ +/* + * JNIWinamp.java + * + * Created on 23 de Abril de 2007, 20:41 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +package com.qotsa.jni.controller; + +import java.io.IOException; + +/** + * + * @author Francisco Guimarães + */ +final class JNIWinamp { + + static { + System.loadLibrary("wpcom"); + } + + /** + * Verify if Winamp is started + * and if not started, starts it + * @return True - if successful run Winamp + * False - if not successful run Winamp + */ + + protected static native boolean run() throws UnsatisfiedLinkError; + + /* + * Exit Winamp + * @return True - if successful exit + * False - if not successful exit + */ + protected static native boolean exit() throws UnsatisfiedLinkError; + + /** + * Play Winamp. + * + */ + protected static native boolean play() throws UnsatisfiedLinkError; + + /** + * Stop Winamp. + * + */ + protected static native boolean stop() throws UnsatisfiedLinkError; + + /** + * Resume Winamp. + * + */ + protected static native boolean resume() throws UnsatisfiedLinkError; + + /** + * Pause Winamp. + * + */ + protected static native boolean pause() throws UnsatisfiedLinkError; + + /** + * Go to Previous Track. + * + */ + protected static native boolean previousTrack() throws UnsatisfiedLinkError; + + /** + * Go to Next Track. + * + */ + protected static native boolean nextTrack() throws UnsatisfiedLinkError; + + /** + * Fowards 5 seconds on the current song. + * + */ + protected static native boolean fwd5Secs() throws UnsatisfiedLinkError; + + /** + * Rewinds 5 seconds on the current song. + * + */ + protected static native boolean rew5Secs() throws UnsatisfiedLinkError; + + /** + * Increase Volume. + * + */ + protected static native boolean increaseVolume() throws UnsatisfiedLinkError; + + /** + * Decrease Volume. + * + */ + protected static native boolean decreaseVolume() throws UnsatisfiedLinkError; + + /** + * Increase Volume. + * @param percent Percent to Increase. + */ + protected static native boolean increaseVolumePercent(int percent) throws UnsatisfiedLinkError; + + /** + * Decrease Volume. + * @param percent Percent to Decrease. + */ + protected static native boolean decreaseVolumePercent(int percent) throws UnsatisfiedLinkError; + + /** + * Adjust Volume + * @param pos Position to Set Volume between 0 and 99. + */ + protected static native boolean setVolume(int pos) throws UnsatisfiedLinkError; + + /** + * Get Volume. + * @return volume. + */ + protected static native int getVolume() throws UnsatisfiedLinkError; + + /** + * Go to a Specified Position in the List. + * @param pos Position. + */ + protected static native boolean setPlaylistPosition(int pos) throws UnsatisfiedLinkError; + + /** + * Clear List. + * + */ + protected static native boolean clearPlayList() throws UnsatisfiedLinkError; + + /** + * Refresh List´s Cache. + * + */ + protected static native boolean refreshPlayListCache() throws UnsatisfiedLinkError; + + /** + * Return the PlayListLength. + * @return List Length. + */ + protected static native int getPlayListLength() throws UnsatisfiedLinkError; + + /** + * Write a Playlist in \\Winamp.m3u. + * @return List Position. + */ + protected static native int writePlayListToFile() throws UnsatisfiedLinkError; + + /** + * Verify if Shuffle is On. + * @return True - On throws UnsatisfiedLinkError; False - Off. + */ + protected static native int isShuffleStatusOn() throws UnsatisfiedLinkError; + + /** + * Verify if Repeat is On. + * @return True - On throws UnsatisfiedLinkError; False - Off. + */ + protected static native int isRepeatStatusOn() throws UnsatisfiedLinkError; + + /** + * Turn on Repeat. + * @param True - Turn on Repeat throws UnsatisfiedLinkError; False - Turn off Repeat. + */ + protected static native boolean setRepeatStatusOn(boolean mode) throws UnsatisfiedLinkError; + + /** + * Turn on Shuffle. + * @param True - Turn on Shuffle throws UnsatisfiedLinkError; False - Turn off Shuffle. + */ + protected static native boolean setShuffleStatusOn(boolean mode) throws UnsatisfiedLinkError; + + /** + * Append a File in the List + * @param filename FileName to Append. + */ + protected static native boolean appendToPlayList(String filename) throws UnsatisfiedLinkError; + + /** + * Get Winamp Status. + * @return STOPPED - Stop + * PLAYING - play + * PAUSED - Paused + */ + protected static native int getStatus() throws UnsatisfiedLinkError; + + /** + * Get Current List Pos. + * @return Current List Position. + */ + protected static native int getListPos() throws UnsatisfiedLinkError; + + /** + * Get Current Track Title + * @return Current Track Title + */ + protected static native String getTitle() throws UnsatisfiedLinkError; + + /** + * Get Track FileName in List´s index. + * @param index Track Index in the Current PlayList + * @return Current Track FileName + */ + protected static native String getFileNameInList(int index) throws UnsatisfiedLinkError; + + /** + * Get Song Time + * @param mode CURRENTTIME - Currently Time in Milliseconds + * TIMELENGHT - Song Time Length in seconds + * @return Song Time in Seconds + */ + protected static native int getTime(int mode) throws UnsatisfiedLinkError; + + /** + * Get File Name Playing In Winamp. + * + * @return Current File Name. + */ + protected static native String getFileNamePlaying() throws UnsatisfiedLinkError; + +} + diff --git a/java/src/com/qotsa/jni/controller/WinampController.java b/java/src/com/qotsa/jni/controller/WinampController.java new file mode 100644 index 0000000..0f1aa60 --- /dev/null +++ b/java/src/com/qotsa/jni/controller/WinampController.java @@ -0,0 +1,592 @@ +/* + * WinampController.java + * + * Created on 9 de Outubro de 2007, 14:06 + * + * To change this template, choose Tools | Template Manager + * and open the template in the editor. + */ + +/** + * Package containing the Controller Class to communicate with Winamp. + * + * @author Francisco Guimarães + */ +package com.qotsa.jni.controller; + +import com.qotsa.exception.InvalidHandle; +import com.qotsa.exception.InvalidParameter; +import java.io.File; + +/** + * This class is a wrapper to call JNI functions + * to send Message to Winamp Window. + * + * @author Francisco Guimarães + * + * + */ +public class WinampController { + + /** + * Constant used as return in getTime() + * Value = -1 + */ + public static final int ISNOTPLAYING = -1; + + /** + * Constant used as parameter in getTime() method + * Value = 0 + */ + public static final int CURRENTTIME = 0; + + /** + * Constant used as parameter in getTime() method + * Value = 1 + */ + public static final int TIMELENGTH = 1; + + /** + * Constant used as return in getStatus() method + * Value = 0 + */ + public static final int STOPPED = 0; + + /** + * Constant used as return in getStatus() method + * Value = 1 + */ + public static final int PLAYING = 1; + + /** + * Constant used as return in getStatus() method + * Value = 3 + */ + public static final int PAUSED = 3; + + + /** + * Verify if Winamp is started + * and if not started, starts it. + * + * @throws java.lang.Exception When the key HKEY_LOCAL_MACHINE\Software\Clients\Media\Winamp\shell\open\command + * is not found in the register. This key is used to find Winamp Directory installation to execute it. + */ + + public static void run() throws Exception{ + + if (!JNIWinamp.run()) + throw new Exception("Unable to run Winamp. Verify if it is properly installed"); + + } + + /** + * Exit Winamp. + * + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + */ + public static void exit() throws InvalidHandle { + + if (!JNIWinamp.exit()) + throw new InvalidHandle(); + + + } + + /** + * Play current file in Winamp. + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + */ + public static void play() throws InvalidHandle { + + if (!JNIWinamp.play()) + throw new InvalidHandle(); + + } + + /** + * Stop current file in Winamp. + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + */ + public static void stop() throws InvalidHandle { + + if (!JNIWinamp.stop()) + throw new InvalidHandle(); + + } + + /** + * Resume current file in Winamp. + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + */ + public static void resume() throws InvalidHandle { + + if (!JNIWinamp.resume()) + throw new InvalidHandle(); + + } + + /** + * Pause Winamp. + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + */ + public static void pause() throws InvalidHandle { + + if (!JNIWinamp.pause()) + throw new InvalidHandle(); + + } + + /** + * + * Go to Previous Track in the play list. + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + */ + public static void previousTrack() throws InvalidHandle { + + if (!JNIWinamp.previousTrack()) + throw new InvalidHandle(); + + } + + /** + * Go to Next Track in the play list. + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + */ + public static void nextTrack() throws InvalidHandle { + + if (!JNIWinamp.nextTrack()) + throw new InvalidHandle(); + + } + + /** + * Fowards 5 seconds on the current song. + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + */ + public static void fwd5Secs() throws InvalidHandle { + + if (!JNIWinamp.fwd5Secs()) + throw new InvalidHandle(); + + } + + /** + * Rewinds 5 seconds on the current song. + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + */ + public static void rew5Secs() throws InvalidHandle { + + if (!JNIWinamp.rew5Secs()) + throw new InvalidHandle(); + + } + + /** + * Increase Volume a little bit. + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + */ + public static void increaseVolume() throws InvalidHandle { + + if (!JNIWinamp.increaseVolume()) + throw new InvalidHandle(); + + } + + /** + * Decrease Volume a little bit. + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + */ + public static void decreaseVolume() throws InvalidHandle { + + if (!JNIWinamp.decreaseVolume()) + throw new InvalidHandle(); + + } + + /** + * Increase Volume. + * + * @param percent Percent to Increase Volume. + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + * @throws com.qotsa.exception.InvalidParameter If percent not between 0 and 100 + */ + public static void increaseVolumePercent (int percent) throws InvalidHandle, InvalidParameter { + + if ( (percent < 0) || (percent > 100) ) + throw new InvalidParameter("percent´s value must be between 0 and 100"); + + if (!JNIWinamp.increaseVolumePercent(percent)) + throw new InvalidHandle(); + + } + + /** + * Decrease Volume. + * + * @param percent Percent to Decrease Volume. + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + * @throws com.qotsa.exception.InvalidParameter If percent not between 0 and 100 + */ + public static void decreaseVolumePercent(int percent) throws InvalidHandle, InvalidParameter { + + if ( (percent < 0) || (percent > 100) ) + throw new InvalidParameter("percent´s value must be between 0 and 100"); + if (!JNIWinamp.decreaseVolumePercent(percent)) + throw new InvalidHandle(); + + } + + /** + * Adjust Volume. + * Note that the pos must be between 0(0%) and 255 (100%). + * + * @param pos Position to Set Volume. + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + * @throws com.qotsa.exception.InvalidParameter If pos not between 0 and 255 + */ + public static void setVolume(int pos) throws InvalidHandle, InvalidParameter { + + if ( (pos < 0) || (pos > 255) ) + throw new InvalidParameter("pos value must be between 0 and 255"); + if (!JNIWinamp.setVolume(pos)) + throw new InvalidHandle(); + + } + + /** + * Get Volume. + * @return The volume which is a number between 0 (0%) and 255(100%) + * @throws com.qotsa.exception.InvalidHandle + */ + public static int getVolume() throws InvalidHandle { + int volume = JNIWinamp.getVolume(); + if (volume == -1) + throw new InvalidHandle(); + return volume; + } + + /** + * Get Volume Percent. + * @return Volume percent. + * @throws com.qotsa.exception.InvalidHandle + */ + public static int getVolumePercent() throws InvalidHandle { + + int volume = getVolume(); + int percent = (volume * 100) / 255; + return percent; + } + + /** + * Restarts Winamp. + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + * @throws java.lang.Exception When failed to restart Winamp. + */ + public static void restart() throws InvalidHandle, Exception { + + exit(); + run(); + + } + + /** + * Go to a Specified Position in the List. This method doesn´t play. + * Just set list position. If you wanna play call play() after set position. + * Parameter pos is Zero-based index. + * @param pos Position. + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + * @throws com.qotsa.exception.InvalidParameter If pos is negative or greater than List Length. + */ + public static void setPlaylistPosition(int pos) throws InvalidHandle, InvalidParameter { + + int listLength = getPlayListLength(); + if ( (pos < 0) || ( (pos + 1) > listLength) ) + throw new InvalidParameter("Position is invalid in the list."); + if (!JNIWinamp.setPlaylistPosition(pos)) + throw new InvalidHandle(); + + } + + /** + * Clear Winamp's internal playlist. + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + */ + public static void clearPlayList() throws InvalidHandle { + + if (!JNIWinamp.clearPlayList()) + throw new InvalidHandle(); + + } + + /** + * Flush the playlist cache buffer. + * Call this if you want it to go refetch titles for tracks in the list. + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + */ + public static void refreshPlayListCache() throws InvalidHandle{ + + if (!JNIWinamp.refreshPlayListCache()) + throw new InvalidHandle(); + + } + + /** + * Return the PlayListLength. + * + * @return List Length. + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + */ + public static int getPlayListLength() throws InvalidHandle { + + int length = JNIWinamp.getPlayListLength(); + if (length == -1) + throw new InvalidHandle(); + return length; + + } + + /** + * Write a Playlist in winampDirInstallation\\Winamp.m3u. + * This is default Winamp IPC Default. If you wanna change this, + * just rename the file you´ve created. + * + * @return Current List Position. + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + */ + public static int writePlayListToFile() throws InvalidHandle { + + int playListPos = JNIWinamp.writePlayListToFile(); + if (playListPos == -1) + throw new InvalidHandle(); + return playListPos; + + } + + /** + * Verify if Shuffle is On. + * + * @return True - On ; False - Off. + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + */ + public static boolean isShuffleStatusOn() throws InvalidHandle { + + int status = JNIWinamp.isShuffleStatusOn(); + if (status == -1) + throw new InvalidHandle(); + return (status == 1 ? true : false); + + } + + /** + * Verify if Repeat is On. + * + * @return True - On ; False - Off. + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + */ + public static boolean isRepeatStatusOn() throws InvalidHandle { + + int status = JNIWinamp.isRepeatStatusOn(); + if (status == -1) + throw new InvalidHandle(); + return (status == 1 ? true : false); + + } + + /** + * Turn on Repeat. + * + * @param mode True - Turn on Repeat ; False - Turn off Repeat. + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + */ + public static void setRepeatStatusOn(boolean mode) throws InvalidHandle { + + if (!JNIWinamp.setRepeatStatusOn(mode)) + throw new InvalidHandle(); + + } + + /** + * Turn on Shuffle. + * + * @param mode True - Turn on Shuffle ; False - Turn off Shuffle. + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + */ + public static void setShuffleStatusOn(boolean mode) throws InvalidHandle { + + if (!JNIWinamp.setShuffleStatusOn(mode)) + throw new InvalidHandle(); + + } + + /** + * Append a File into the List. + * + * @param filename FileName to Append in the list. + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + * @throws com.qotsa.exception.InvalidParameter If the filename is an invalid path. + */ + public static void appendToPlayList(String filename) throws InvalidHandle, InvalidParameter { + + File file = new File(filename); + if (!file.exists()) + throw new InvalidParameter("File doesn´t exists."); + if (!JNIWinamp.appendToPlayList(filename)) + throw new InvalidHandle(); + + } + + /** + * Get Winamp Status. + * + * @return STOPPED - Stop + * PLAYING - play + * PAUSED - Paused + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + */ + public static int getStatus() throws InvalidHandle { + + int status = JNIWinamp.getStatus(); + if (status == -1) + throw new InvalidHandle(); + return status; + + } + + /** + * Get Current List Pos. + * + * @return Current List Position. + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + */ + public static int getListPos() throws InvalidHandle { + + int pos = JNIWinamp.getListPos(); + if (pos == -1) + throw new InvalidHandle(); + return pos; + + } + + /** + * Get Current Track Title. + * + * @return Current Track Title + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + */ + public static String getTitle() throws InvalidHandle { + + String title = JNIWinamp.getTitle(); + if (title == null) + throw new InvalidHandle(); + return title; + + } + + /** + * Get Current Track FileName. + * Parameter pos is Zero-based index. + * + * @return Current Track FileName + * @param pos Track Position in the Current PlayList + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + * @throws com.qotsa.exception.InvalidParameter If pos is negative or greater than List Length + */ + public static String getFileNameInList(int pos) throws InvalidHandle, InvalidParameter { + + int listLength = getPlayListLength(); + if ( (pos < 0) || (pos > listLength) ) + throw new InvalidParameter("Position is invalid in the list."); + String filename = JNIWinamp.getFileNameInList(pos); + if (filename == null) + throw new InvalidHandle(); + return filename; + + } + + /** + * Get Song Time. + * + * @return Time Song (depends on Param mode) or + * ISNOTPLAYING if there is no info about time because it not starts to play. + * @param mode CURRENTTIME - Currently Time in Milliseconds + * TIMELENGHT - Song Time Length in seconds + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + * @throws com.qotsa.exception.InvalidParameter if parameter is not CURRENTTIME or TIMELENGTH. + */ + public static int getTime(int mode) throws InvalidHandle, InvalidParameter { + + if (mode != CURRENTTIME && mode != TIMELENGTH) + throw new InvalidParameter(); + int time = JNIWinamp.getTime(mode); + if (time == -2) + throw new InvalidHandle(); + return time; + + } + + /** + * Fowards n Tracks in Play List. + * + * @param n Number of Tracks to Foward + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + * @throws com.qotsa.exception.InvalidParameter if n is negative or Zero. + */ + public static void fwdTracks(int n) throws InvalidParameter, InvalidHandle { + + if (n <= 0) + throw new InvalidParameter("Value must be Positive"); + int pos = getListPos(); + int lengthList = getPlayListLength(); + int newPos = pos + n; + if (newPos > lengthList ) { + setPlaylistPosition(lengthList); + play(); + } + else { + setPlaylistPosition(newPos); + play(); + } + + } + + /** + * Rewinds n Tracks in Play List. + * + * @param n Number of Tracks to Rewind + * @throws com.qotsa.exception.InvalidHandle When the Winamp Windows is not handle(in most case, it means that winamp is not running) + * @throws com.qotsa.exception.InvalidParameter if n is negative or Zero. + */ + public static void rewTracks(int n) throws InvalidParameter, InvalidHandle { + + if (n <= 0) + throw new InvalidParameter("Value must be Positive"); + int pos = getListPos(); + int lengthList = getPlayListLength(); + int newPos = pos - n; + if (newPos < 0 ) { + setPlaylistPosition(0); + play(); + } + else { + setPlaylistPosition(newPos); + play(); + } + + } + + /** + * Get File Name Playing In Winamp. + * + * @return Current File Name. + */ + public static String getFileNamePlaying() throws InvalidHandle { + + String fileName = JNIWinamp.getFileNamePlaying(); + if (fileName == null) + throw new InvalidHandle(); + return fileName; + + } + +} diff --git a/java/src/com/qotsa/jni/controller/package.html b/java/src/com/qotsa/jni/controller/package.html new file mode 100644 index 0000000..28739eb --- /dev/null +++ b/java/src/com/qotsa/jni/controller/package.html @@ -0,0 +1,20 @@ + + + + + + + +Package containing the Controller Class to communicate with Winamp. + + +

Package Specification

+ + + + +