/* HUMp3 Command Handler Dmitry Borisov This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "stdafx.h" #include "winamp.h" #include "plugin.h" #include "Commands.h" void WinampPlay(const char *arg) { SendMessage(plugin.hwndParent, WM_COMMAND, WINAMP_BUTTON2, 0); } void WinampStop(const char *arg) { SendMessage(plugin.hwndParent, WM_COMMAND, WINAMP_BUTTON4, 0); } void WinampFF(const char *arg) { SendMessage(plugin.hwndParent, WM_COMMAND, WINAMP_FFWD5S, 0); } void WinampRew(const char *arg) { SendMessage(plugin.hwndParent, WM_COMMAND, WINAMP_REW5S, 0); } void WinampNextSong(const char *arg) { SendMessage(plugin.hwndParent, WM_COMMAND, WINAMP_BUTTON5, 0); } void WinampPrevSong(const char *arg) { SendMessage(plugin.hwndParent, WM_COMMAND, WINAMP_BUTTON1, 0); } void WinampPause(const char *arg) { switch (SendMessage(plugin.hwndParent, WM_WA_IPC, 0, IPC_ISPLAYING)) { case 3: SendMessage(plugin.hwndParent, WM_COMMAND, WINAMP_BUTTON2, 0); break; case 1: SendMessage(plugin.hwndParent, WM_COMMAND, WINAMP_BUTTON3, 0); break; } } void WinampSetRepeat(const char *arg) { SendMessage(plugin.hwndParent, WM_WA_IPC, (int)arg, IPC_SET_REPEAT); } void WinampSetShuffle(const char *arg) { SendMessage(plugin.hwndParent, WM_WA_IPC, (int)arg, IPC_SET_SHUFFLE); } // TODO: How to send Shift-V ???v void WinampFade(const char *arg) { SendMessage(plugin.hwndParent, WM_KEYDOWN, VK_SHIFT, 0); SendMessage(plugin.hwndParent, WM_KEYDOWN, 'V', 0); SendMessage(plugin.hwndParent, WM_KEYUP, 'V', 0); SendMessage(plugin.hwndParent, WM_KEYUP, VK_SHIFT, 0); } void WinampPlaylist(const char *arg) { if (!arg) return; COPYDATASTRUCT cds; cds.dwData = IPC_PLAYFILE; cds.lpData = (void *) arg; cds.cbData = strlen((char *) cds.lpData)+1; // include space for null char SendMessage(plugin.hwndParent,WM_WA_IPC,0,IPC_DELETE); SendMessage(plugin.hwndParent,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds); SendMessage(plugin.hwndParent,WM_WA_IPC,0,IPC_STARTPLAY); } int WinampPlaylistLen(const char *arg) { return SendMessage(plugin.hwndParent,WM_WA_IPC,0,IPC_GETLISTLENGTH); } void WinampSetPlaylistPos(const char *arg) { SendMessage(plugin.hwndParent,WM_WA_IPC,(int)arg,IPC_SETPLAYLISTPOS); } int WinampGetPlaylistPos(const char *arg) { return SendMessage(plugin.hwndParent,WM_WA_IPC,0,IPC_GETLISTPOS); } int WinampGetTrackTime(const char *arg) { return SendMessage(plugin.hwndParent,WM_WA_IPC,0,IPC_GETOUTPUTTIME)/ 1000; } void WinampSetTrackTime(const char *arg) { SendMessage(plugin.hwndParent,WM_WA_IPC,(int)arg* 1000,IPC_JUMPTOTIME); } char* WinampGetTrackTitle(const char *arg) { return (char*)SendMessage(plugin.hwndParent,WM_WA_IPC,(int)arg,IPC_GETPLAYLISTTITLE); }