1
0

PlayQueue.cpp 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /** (c) Nullsoft, Inc. C O N F I D E N T I A L
  2. ** Filename:
  3. ** Project:
  4. ** Description:
  5. ** Author:
  6. ** Created:
  7. **/
  8. #include "main.h"
  9. #include "resource.h"
  10. extern void ConvertEOF();
  11. int PlayQueue_OnEOF()
  12. {
  13. if (m_converting)
  14. {
  15. ConvertEOF();
  16. return 0;
  17. }
  18. LRESULT nextItem;
  19. g_fullstop = 1;
  20. // for gen_jumpex mainly so it doesn't have to use ugly hacks
  21. nextItem = SendMessageW(hMainWindow, WM_WA_IPC, 0, IPC_GET_NEXT_PLITEM);
  22. if (nextItem != -1) // check to see if anyone has overridden what track we play next
  23. {
  24. PlayList_setposition(nextItem);
  25. PlayList_getcurrent(FileName, FileTitle, FileTitleNum);
  26. StartPlaying();
  27. }
  28. else // nope? just advanced to the next track
  29. {
  30. if (PlayList_getlength() && !g_stopaftercur)
  31. {
  32. if (!config_pladv) // if manual playlist advance is on
  33. {
  34. if (!config_repeat
  35. && !PlayList_current_hidden()) // if this is a "horizontal" playlist, let the tracks play out
  36. goto fullstop;
  37. StartPlaying();
  38. }
  39. else if (!config_shuffle && PlayList_advance(HIDDEN_TRAP) < 0) // -33 is so i can trap playnext
  40. {
  41. if (config_repeat)
  42. {
  43. PlayList_setposition(0);
  44. PlayList_getcurrent(FileName, FileTitle, FileTitleNum);
  45. StartPlaying();
  46. }
  47. else
  48. {
  49. g_fullstop = 2;
  50. StopPlaying(0);
  51. }
  52. }
  53. else
  54. {
  55. if (config_shuffle && !PlayList_current_hidden())
  56. {
  57. int lp = PlayList_getPosition();
  58. if ((PlayList_randpos(1) || PlayList_getlength() == 1) // this isn't really the place for this check
  59. && !config_repeat)
  60. {
  61. g_fullstop = 2;
  62. StopPlaying(0);
  63. g_fullstop = 0;
  64. return 0;
  65. }
  66. if (PlayList_getPosition() == lp && PlayList_getlength() > 1)
  67. {
  68. PlayList_randpos(1);
  69. }
  70. }
  71. else
  72. {
  73. // 5.64 - if pledit is cleared, shuffle is off & we're playing
  74. // then we set playing to go back to the start of the playlist
  75. // as we get complaints it'll go to #2 instead of #1 as shown.
  76. if (plcleared)
  77. {
  78. plcleared = 0;
  79. PlayList_setposition(0);
  80. }
  81. }
  82. PlayList_getcurrent(FileName, FileTitle, FileTitleNum);
  83. StartPlaying();
  84. }
  85. }
  86. else
  87. {
  88. HMENU m;
  89. fullstop:
  90. g_stopaftercur = 0;
  91. CheckMenuItem(main_menu, WINAMP_BUTTON4_CTRL, MF_UNCHECKED);
  92. m = GetSubMenu(top_menu, 3);
  93. CheckMenuItem(m, WINAMP_BUTTON4_CTRL, MF_UNCHECKED);
  94. g_fullstop = 2;
  95. StopPlaying(0);
  96. }
  97. }
  98. g_fullstop = 0;
  99. return 1;
  100. }