wa5vis.txt 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. Winamp 5 VIS Drawer API
  2. -----------------------
  3. Here are the steps to get your visualization plugin in the Winamp 5 drawer :
  4. 1) Create an embedded window to serve as a parent for your vis Wnd using the Winamp 5 Embedded Window SDK :
  5. HWND parent = NULL;
  6. HWND (*e)(embedWindowState *v);
  7. *(void**)&e = (void *)SendMessage(this_mod->hwndParent,WM_WA_IPC,(LPARAM)0,IPC_GET_EMBEDIF);
  8. if (e) parent = e(&myWindowState);
  9. 2) Create your vis window (say, g_hwnd) for your vis plugin, using the embedded window as a parent.
  10. 3) BEFORE showing your parent window, notify Winamp that you are a VIS window :
  11. SendMessage(this_mod->hwndParent, WM_WA_IPC, (int)g_hwnd, IPC_SETVISWND);
  12. ShowWindow(parent, SW_SHOWNA);
  13. 4) When your plugin is asked to terminate, notify winamp that the VIS has gone away :
  14. SendMessage(g_mod->hwndParent, WM_WA_IPC, NULL, IPC_SETVISWND);
  15. 5) From now on, your vis is going to be automatically inserted in the drawer, and your window (the one you sent to winamp
  16. using SETVISWND) is going to receive commands when the user clicks in the vis buttons (ie, next/previous/random, etc). You
  17. should implement these commands by trapping WM_COMMAND:
  18. case WM_COMMAND: {
  19. int id = LOWORD(wParam);
  20. switch (id) {
  21. // user clicked on 'next' preset button
  22. case ID_VIS_NEXT: next_preset(); break;
  23. // user clicked on 'previous' preset button
  24. case ID_VIS_PREV: previous_preset(); break;
  25. // user clicked on 'random' togglebutton
  26. case ID_VIS_RANDOM: {
  27. // determine if we're switching random on or off or if Winamp is asking us about the state of our random flag
  28. int v = HIWORD(wParam) ? 1 : 0;
  29. // are we being asked about the state of our random flag ?
  30. if (wParam >> 16 == 0xFFFF) {
  31. // tell winamp about our state
  32. SendMessage(g_mod->hwndParent,WM_WA_IPC,random_presets_flag,IPC_CB_VISRANDOM);
  33. break;
  34. }
  35. // changes random_preset_flag
  36. set_random(v);
  37. // if we are turning random on, we should switch to a new random preset right away
  38. if (v) load_random_preset();
  39. break;
  40. }
  41. case ID_VIS_FS: go_fullscreen(); break;
  42. case ID_VIS_CFG: open_configuration(); break;
  43. case ID_VIS_MENU: open_popup_menu(); break;
  44. }
  45. break;
  46. }
  47. 6) Before turning fullscreen on, you should check wether video is already fullscreen or not :
  48. if (SendMessage(g_mod->hwndParent,WM_WA_IPC,0,IPC_IS_PLAYING_VIDEO)>1)
  49. {
  50. cant_go_fullscreen_dlg();
  51. }
  52. 7) You're almost done, the last thing to do is to notify Winamp when you go fullscreen :
  53. go_fullscreen()
  54. {
  55. if (SendMessage(g_mod->hwndParent,WM_WA_IPC,0,IPC_IS_PLAYING_VIDEO)>1)
  56. {
  57. cant_go_fullscreen_dlg();
  58. }
  59. else
  60. {
  61. SendMessage(g_mod->hwndParent,WM_WA_IPC,1,IPC_SET_VIS_FS_FLAG);
  62. ... now do the work of actually going fullscreen ...
  63. }
  64. }
  65. go_windowed()
  66. {
  67. SendMessage(g_mod->hwndParent,WM_WA_IPC,0,IPC_SET_VIS_FS_FLAG);
  68. ... now do the work of going back to windowed mode ...
  69. }
  70. That should be all. Feel free to send your questions to [email protected]