diff --git a/Plugins/PluginNowPlaying/PlayerFoobar.cpp b/Plugins/PluginNowPlaying/PlayerFoobar.cpp index 7018d3da..8e5df7f2 100644 --- a/Plugins/PluginNowPlaying/PlayerFoobar.cpp +++ b/Plugins/PluginNowPlaying/PlayerFoobar.cpp @@ -273,6 +273,26 @@ LRESULT CALLBACK CPlayerFoobar::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR player->FindLyrics(); } } + token = wcstok(NULL, L"\t"); + if (token) + { + switch (_wtoi(token)) + { + case 0: + player->m_Shuffle = player->m_Repeat = false; + break; + + case 1: + player->m_Shuffle = true; + player->m_Repeat = false; + break; + + case 2: + player->m_Shuffle = false; + player->m_Repeat = true; + break; + } + } } } return 0; @@ -358,6 +378,32 @@ void CPlayerFoobar::SetPosition(int position) SendMessage(m_FooWindow, WM_USER, position, FOO_SETPOSITION); } +/* +** SetShuffle +** +** Handles the SetShuffle bang. +** +*/ +void CPlayerFoobar::SetShuffle(bool state) +{ + m_Shuffle = state; + m_Repeat = state ? !m_Shuffle : m_Shuffle; + SendMessage(m_FooWindow, WM_USER, state ? 1 : 0, FOO_SETORDER); +} + +/* +** SetRepeat +** +** Handles the SetRepeat bang. +** +*/ +void CPlayerFoobar::SetRepeat(bool state) +{ + m_Repeat = state; + m_Shuffle = state ? !m_Repeat : m_Repeat; + SendMessage(m_FooWindow, WM_USER, state ? 2 : 0, FOO_SETORDER); +} + /* ** SetVolume ** diff --git a/Plugins/PluginNowPlaying/PlayerFoobar.h b/Plugins/PluginNowPlaying/PlayerFoobar.h index 7a3bd4d7..b5be9012 100644 --- a/Plugins/PluginNowPlaying/PlayerFoobar.h +++ b/Plugins/PluginNowPlaying/PlayerFoobar.h @@ -38,6 +38,8 @@ public: virtual void SetPosition(int position); virtual void SetRating(int rating) {} virtual void SetVolume(int volume); + virtual void SetShuffle(bool state); + virtual void SetRepeat(bool state); virtual void ClosePlayer(); virtual void OpenPlayer(std::wstring& path); @@ -70,7 +72,8 @@ private: FOO_QUITPLAYER, FOO_SETCALLBACK, FOO_REMOVECALLBACK, - FOO_SETPOSITION + FOO_SETPOSITION, + FOO_SETORDER }; void Initialize();