1
0

FRONTEND.H 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  1. /*
  2. LICENSE
  3. -------
  4. Copyright 2005 Nullsoft, Inc.
  5. All rights reserved.
  6. Redistribution and use in source and binary forms, with or without modification,
  7. are permitted provided that the following conditions are met:
  8. * Redistributions of source code must retain the above copyright notice,
  9. this list of conditions and the following disclaimer.
  10. * Redistributions in binary form must reproduce the above copyright notice,
  11. this list of conditions and the following disclaimer in the documentation
  12. and/or other materials provided with the distribution.
  13. * Neither the name of Nullsoft nor the names of its contributors may be used to
  14. endorse or promote products derived from this software without specific prior written permission.
  15. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
  16. IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  17. FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
  18. CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  19. DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  20. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  21. IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23. */
  24. #ifndef _WAFE_H_
  25. #define _WAFE_H_
  26. /*
  27. ** Winamp frontend/plug-in control API documentation v1.0.
  28. ** By Justin Frankel.
  29. ** Copyright (C) 1997-1999, Nullsoft Inc.
  30. ** Last updated: JAN.8.1999.
  31. **
  32. ** Introduction
  33. ** -----------------------
  34. ** This file describes a means to easily communicate to Winamp
  35. ** via the classic Win32 Message API.
  36. **
  37. ** These definitions/code assume C/C++. Porting to VB/Delphi shouldn't
  38. ** be too hard.
  39. **
  40. ** First, you find the HWND of the Winamp main window. From a plug-in
  41. ** you can easily extract this from the plug-in structure (hMainWindow,
  42. ** hwndParent, whatever). For external apps, use:
  43. **
  44. ** HWND hwnd_winamp = FindWindow("Winamp v1.x",NULL);
  45. **
  46. ** (note: I know, we're in Winamp 2.x, but it's 1.x for compatibility)
  47. **
  48. ** Once you have the hwnd_winamp, it's a good idea to check the version
  49. ** number. To do this, you send a WM_WA_IPC message to hwnd_winamp.
  50. ** Note that WM_WA_IPC is defined as Win32's WM_USER.
  51. **
  52. ** Note that sometimes you might want to use PostMessage instead of
  53. ** SendMessage.
  54. */
  55. #define WM_WA_IPC WM_USER
  56. /**************************************************************************/
  57. #define IPC_GETVERSION 0
  58. /*
  59. ** int version = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETVERSION);
  60. **
  61. ** Version will be 0x20yx for winamp 2.yx. versions previous to Winamp 2.0
  62. ** typically (but not always) use 0x1zyx for 1.zx versions. Weird, I know.
  63. **
  64. ** The basic format for sending messages to Winamp is:
  65. ** int result=SendMessage(hwnd_winamp,WM_WA_IPC,command_data,command);
  66. ** (for the version check, command_data is 0).
  67. */
  68. #define IPC_DELETE 101
  69. /*
  70. ** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_DELETE);
  71. **
  72. ** You can use IPC_DELETE to clear Winamp's internal playlist.
  73. */
  74. #define IPC_STARTPLAY 102
  75. /*
  76. ** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_STARTPLAY);
  77. **
  78. ** Using IPC_STARTPLAY is like hitting 'Play' in Winamp, mostly.
  79. */
  80. #define IPC_ISPLAYING 104
  81. /*
  82. ** int res = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_ISPLAYING);
  83. **
  84. ** IPC_ISPLAYING returns the status of playback.
  85. ** If it returns 1, it is playing. if it returns 3, it is paused,
  86. ** if it returns 0, it is not playing.
  87. */
  88. #define IPC_GETOUTPUTTIME 105
  89. /*
  90. ** int res = SendMessage(hwnd_winamp,WM_WA_IPC,mode,IPC_GETOUTPUTTIME);
  91. **
  92. ** IPC_GETOUTPUTTIME returns the position in milliseconds of the
  93. ** current song (mode = 0), or the song length, in seconds (mode = 1).
  94. ** Returns -1 if not playing or error.
  95. */
  96. #define IPC_JUMPTOTIME 106
  97. /* (requires Winamp 1.60+)
  98. ** SendMessage(hwnd_winamp,WM_WA_IPC,ms,IPC_JUMPTOTIME);
  99. ** IPC_JUMPTOTIME sets the position in milliseconds of the
  100. ** current song (approximately).
  101. ** Returns -1 if not playing, 1 on eof, or 0 if successful
  102. */
  103. #define IPC_WRITEPLAYLIST 120
  104. /* (requires Winamp 1.666+)
  105. ** SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_WRITEPLAYLIST);
  106. **
  107. ** IPC_WRITEPLAYLIST writes the current playlist to <winampdir>\\Winamp.m3u,
  108. ** and returns the current playlist position.
  109. ** Kinda obsoleted by some of the 2.x new stuff, but still good for when
  110. ** using a front-end (instead of a plug-in)
  111. */
  112. #define IPC_SETPLAYLISTPOS 121
  113. /* (requires Winamp 2.0+)
  114. ** SendMessage(hwnd_winamp,WM_WA_IPC,position,IPC_SETPLAYLISTPOS)
  115. **
  116. ** IPC_SETPLAYLISTPOS sets the playlsit position to 'position'.
  117. */
  118. #define IPC_SETVOLUME 122
  119. /* (requires Winamp 2.0+)
  120. ** SendMessage(hwnd_winamp,WM_WA_IPC,volume,IPC_SETVOLUME);
  121. **
  122. ** IPC_SETVOLUME sets the volume of Winamp (from 0-255).
  123. */
  124. #define IPC_SETPANNING 123
  125. /* (requires Winamp 2.0+)
  126. ** SendMessage(hwnd_winamp,WM_WA_IPC,panning,IPC_SETPANNING);
  127. **
  128. ** IPC_SETPANNING sets the panning of Winamp (from 0 (left) to 255 (right)).
  129. */
  130. #define IPC_GETLISTLENGTH 124
  131. /* (requires Winamp 2.0+)
  132. ** int length = SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTLENGTH);
  133. **
  134. ** IPC_GETLISTLENGTH returns the length of the current playlist, in
  135. ** tracks.
  136. */
  137. #define IPC_SETSKIN 200
  138. /* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
  139. ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)"skinname",IPC_SETSKIN);
  140. **
  141. ** IPC_SETSKIN sets the current skin to "skinname". Note that skinname
  142. ** can be the name of a skin, a skin .zip file, with or without path.
  143. ** If path isn't specified, the default search path is the winamp skins
  144. ** directory.
  145. */
  146. #define IPC_GETSKIN 201
  147. /* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
  148. ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)skinname_buffer,IPC_GETSKIN);
  149. **
  150. ** IPC_GETSKIN puts the directory where skin bitmaps can be found
  151. ** into skinname_buffer.
  152. ** skinname_buffer must be MAX_PATH characters in length.
  153. ** When using a .zip'd skin file, it'll return a temporary directory
  154. ** where the ZIP was decompressed.
  155. */
  156. #define IPC_EXECPLUG 202
  157. /* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
  158. ** SendMessage(hwnd_winamp,WM_WA_IPC,(WPARAM)"vis_file.dll",IPC_EXECPLUG);
  159. **
  160. ** IPC_EXECPLUG executes a visualization plug-in pointed to by WPARAM.
  161. ** the format of this string can be:
  162. ** "vis_whatever.dll"
  163. ** "vis_whatever.dll,0" // (first mod, file in winamp plug-in dir)
  164. ** "C:\\dir\\vis_whatever.dll,1"
  165. */
  166. #define IPC_GETPLAYLISTFILE 211
  167. /* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
  168. ** char *name=SendMessage(hwnd_winamp,WM_WA_IPC,index,IPC_GETPLAYLISTFILE);
  169. **
  170. ** IPC_GETPLAYLISTFILE gets the filename of the playlist entry [index].
  171. ** returns a pointer to it. returns NULL on error.
  172. */
  173. #define IPC_GETPLAYLISTTITLE 212
  174. /* (requires Winamp 2.04+, only usable from plug-ins (not external apps))
  175. ** char *name=SendMessage(hwnd_winamp,WM_WA_IPC,index,IPC_GETPLAYLISTTITLE);
  176. **
  177. ** IPC_GETPLAYLISTTITLE gets the title of the playlist entry [index].
  178. ** returns a pointer to it. returns NULL on error.
  179. */
  180. #define IPC_GETLISTPOS 125
  181. /* (requires Winamp 2.05+)
  182. ** int pos=SendMessage(hwnd_winamp,WM_WA_IPC,0,IPC_GETLISTPOS);
  183. **
  184. ** IPC_GETLISTPOS returns the playlist position. A lot like IPC_WRITEPLAYLIST
  185. ** only faster since it doesn't have to write out the list. Heh, silly me.
  186. */
  187. #define IPC_GETINFO 126
  188. /* (requires Winamp 2.05+)
  189. ** int inf=SendMessage(hwnd_winamp,WM_WA_IPC,mode,IPC_GETINFO);
  190. **
  191. ** IPC_GETINFO returns info about the current playing song. The value
  192. ** it returns depends on the value of 'mode'.
  193. ** Mode Meaning
  194. ** ------------------
  195. ** 0 Samplerate (i.e. 44100)
  196. ** 1 Bitrate (i.e. 128)
  197. ** 2 Channels (i.e. 2)
  198. */
  199. #define IPC_GETEQDATA 127
  200. /* (requires Winamp 2.05+)
  201. ** int data=SendMessage(hwnd_winamp,WM_WA_IPC,pos,IPC_GETEQDATA);
  202. **
  203. ** IPC_GETEQDATA queries the status of the EQ.
  204. ** The value returned depends on what 'pos' is set to:
  205. ** Value Meaning
  206. ** ------------------
  207. ** 0-9 The 10 bands of EQ data. 0-63 (+20db - -20db)
  208. ** 10 The preamp value. 0-63 (+20db - -20db)
  209. ** 11 Enabled. zero if disabled, nonzero if enabled.
  210. ** 12 Autoload. zero if disabled, nonzero if enabled.
  211. */
  212. #define IPC_SETEQDATA 128
  213. /* (requires Winamp 2.05+)
  214. ** SendMessage(hwnd_winamp,WM_WA_IPC,pos,IPC_GETEQDATA);
  215. ** SendMessage(hwnd_winamp,WM_WA_IPC,value,IPC_SETEQDATA);
  216. **
  217. ** IPC_SETEQDATA sets the value of the last position retrieved
  218. ** by IPC_GETEQDATA.
  219. */
  220. /**************************************************************************/
  221. /*
  222. ** Some API calls tend to require that you send data via WM_COPYDATA
  223. ** instead of WM_USER. Such as IPC_PLAYFILE:
  224. */
  225. #define IPC_PLAYFILE 100
  226. /*
  227. ** COPYDATASTRUCT cds;
  228. ** cds.dwData = IPC_PLAYFILE;
  229. ** cds.lpData = (void *) "file.mp3";
  230. ** cds.cbData = strlen((char *) cds.lpData)+1; // include space for null char
  231. ** SendMessage(hwnd_winamp,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds);
  232. **
  233. ** This will play the file "file.mp3".
  234. **
  235. */
  236. #define IPC_CHDIR 103
  237. /*
  238. ** COPYDATASTRUCT cds;
  239. ** cds.dwData = IPC_CHDIR;
  240. ** cds.lpData = (void *) "c:\\download";
  241. ** cds.cbData = strlen((char *) cds.lpData)+1; // include space for null char
  242. ** SendMessage(hwnd_winamp,WM_COPYDATA,(WPARAM)NULL,(LPARAM)&cds);
  243. **
  244. ** This will make Winamp change to the directory C:\\download
  245. **
  246. */
  247. /**************************************************************************/
  248. /*
  249. ** Finally there are some WM_COMMAND messages that you can use to send
  250. ** Winamp misc commands.
  251. **
  252. ** To send these, use:
  253. **
  254. ** SendMessage(hwnd_winamp, WM_COMMAND,command_name,0);
  255. */
  256. #define WINAMP_OPTIONS_EQ 40036 // toggles the EQ window
  257. #define WINAMP_OPTIONS_PLEDIT 40040 // toggles the playlist window
  258. #define WINAMP_VOLUMEUP 40058 // turns the volume up a little
  259. #define WINAMP_VOLUMEDOWN 40059 // turns the volume down a little
  260. #define WINAMP_FFWD5S 40060 // fast forwards 5 seconds
  261. #define WINAMP_REW5S 40061 // rewinds 5 seconds
  262. // the following are the five main control buttons, with optionally shift
  263. // or control pressed
  264. // (for the exact functions of each, just try it out)
  265. #define WINAMP_BUTTON1 40044
  266. #define WINAMP_BUTTON2 40045
  267. #define WINAMP_BUTTON3 40046
  268. #define WINAMP_BUTTON4 40047
  269. #define WINAMP_BUTTON5 40048
  270. #define WINAMP_BUTTON1_SHIFT 40144
  271. #define WINAMP_BUTTON2_SHIFT 40145
  272. #define WINAMP_BUTTON3_SHIFT 40146
  273. #define WINAMP_BUTTON4_SHIFT 40147
  274. #define WINAMP_BUTTON5_SHIFT 40148
  275. #define WINAMP_BUTTON1_CTRL 40154
  276. #define WINAMP_BUTTON2_CTRL 40155
  277. #define WINAMP_BUTTON3_CTRL 40156
  278. #define WINAMP_BUTTON4_CTRL 40157
  279. #define WINAMP_BUTTON5_CTRL 40158
  280. #define WINAMP_FILE_PLAY 40029 // pops up the load file(s) box
  281. #define WINAMP_OPTIONS_PREFS 40012 // pops up the preferences
  282. #define WINAMP_OPTIONS_AOT 40019 // toggles always on top
  283. #define WINAMP_HELP_ABOUT 40041 // pops up the about box :)
  284. /*
  285. ** EOF.. Enjoy.
  286. */
  287. #endif