pull vendor

This commit is contained in:
2012-05-28 21:04:04 +02:00
parent a50f873d39
commit fb8741aaf3
506 changed files with 94940 additions and 0 deletions

View File

@@ -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)

View File

@@ -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

View File

@@ -0,0 +1,587 @@
/* meu .h */
#include "WinampController.h"
/* mingw */
#include <windows.h>
#include <w32api.h>
#include <winuser.h>
/* 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;i<percent;i++) {
SendMessageA(hwnd_winamp, WM_COMMAND, WA_VOLUMEUP, WA_NOTHING);
}
return TRUE;
}
return FALSE;
}
JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_decreaseVolumePercent
(JNIEnv *env, jobject obj, jint percent) {
initWinampHandle();
int i = 0;
if (hwnd_winamp != NULL) {
for(i=0;i<percent;i++) {
SendMessageA(hwnd_winamp, WM_COMMAND, WA_VOLUMEDOWN, WA_NOTHING);
}
return TRUE;
}
return FALSE;
}
JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_setVolume
(JNIEnv *env, jobject obj, jint pos) {
initWinampHandle();
if (hwnd_winamp != NULL) {
SendMessageA(hwnd_winamp, WM_USER, pos, WA_SETVOLUME);
return TRUE;
}
return FALSE;
}
JNIEXPORT jint JNICALL Java_com_qotsa_jni_controller_JNIWinamp_getVolume
(JNIEnv *env, jobject obj, jint pos) {
jint curVolume = -1;
initWinampHandle();
if (hwnd_winamp != NULL) {
curVolume = (jint)SendMessageA(hwnd_winamp, WM_USER, -666, WA_SETVOLUME);
}
return curVolume;
}
JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_restart
(JNIEnv *env, jobject obj) {
initWinampHandle();
if (hwnd_winamp != NULL) {
SendMessageA(hwnd_winamp, WM_USER, WA_NOTHING, WA_RESTART);
return TRUE;
}
return FALSE;
}
JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_setPlaylistPosition
(JNIEnv *env, jobject obj, jint pos) {
initWinampHandle();
if (hwnd_winamp != NULL) {
SendMessageA(hwnd_winamp, WM_USER, pos, WA_SETPLAYLISTPOS);
return TRUE;
}
return FALSE;
}
JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_clearPlayList
(JNIEnv *env, jobject obj) {
initWinampHandle();
if (hwnd_winamp != NULL) {
SendMessageA(hwnd_winamp, WM_USER, WA_NOTHING, WA_CLEARPLAYLIST);
return TRUE;
}
return FALSE;
}
JNIEXPORT jboolean JNICALL Java_com_qotsa_jni_controller_JNIWinamp_refreshPlayListCache
(JNIEnv *env, jobject obj) {
initWinampHandle();
if (hwnd_winamp != NULL) {
SendMessageA(hwnd_winamp, WM_USER, WA_NOTHING, WA_REFRESHPLCACHE);
return TRUE;
}
return FALSE;
}
JNIEXPORT jint JNICALL Java_com_qotsa_jni_controller_JNIWinamp_getPlayListLength
(JNIEnv *env, jobject obj) {
jint length = -1;
initWinampHandle();
if (hwnd_winamp != NULL) {
length = (jint)SendMessageA(hwnd_winamp, WM_USER, WA_NOTHING, WA_PLAYLISTLEN);
}
return length;
}
JNIEXPORT jint JNICALL Java_com_qotsa_jni_controller_JNIWinamp_writePlayListToFile
(JNIEnv *env, jobject obj) {
jint length = -1;
initWinampHandle();
if (hwnd_winamp != NULL) {
length = SendMessageA(hwnd_winamp, WM_USER, WA_NOTHING, WA_WRITEPLAYLIST);
}
return length;
}
JNIEXPORT jint JNICALL Java_com_qotsa_jni_controller_JNIWinamp_isShuffleStatusOn
(JNIEnv *env, jobject obj) {
jint status = 0;
initWinampHandle();
if (hwnd_winamp != NULL) {
status = (jint)SendMessageA(hwnd_winamp, WM_USER, WA_NOTHING, WA_GETSHUFFLESTATUS);
} else
return -1;
return status>0?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;
}

View File

@@ -0,0 +1,285 @@
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* 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

1
vendor/JavaWinampApi/1.1/cpp/cpy.bat vendored Normal file
View File

@@ -0,0 +1 @@
copy /y wpcom.dll c:\winnt\system32\

View File

@@ -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

1620
vendor/JavaWinampApi/1.1/cpp/wa_ipc.h vendored Normal file

File diff suppressed because it is too large Load Diff

69
vendor/JavaWinampApi/1.1/cpp/wpcom.dev vendored Normal file
View File

@@ -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=

View File

@@ -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

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -0,0 +1,20 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!--
@(#)package.html 1.60 98/01/27
-->
</head>
<body bgcolor="white">
Package containing the Exception Class used in the WinampController Class.
<h2>Package Specification</h2>
<!-- Put @see and @since tags down here. -->
</body>
</html>

View File

@@ -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<61>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<73>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 <winampdir>\\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<73>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;
}

View File

@@ -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<61>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<61>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<EFBFBD>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<EFBFBD>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<73>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<6F>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<73>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;
}
}

View File

@@ -0,0 +1,20 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!--
@(#)package.html 1.60 98/01/27
-->
</head>
<body bgcolor="white">
Package containing the Controller Class to communicate with Winamp.
<h2>Package Specification</h2>
<!-- Put @see and @since tags down here. -->
</body>
</html>