NowPlayingPlugin: Added SHUFFLE/REPEAT support to foobar2000.

This commit is contained in:
Birunthan Mohanathas 2011-09-11 10:34:06 +00:00
parent 6b5ca293e8
commit 75c8f52aa0
2 changed files with 50 additions and 1 deletions

View File

@ -273,6 +273,26 @@ LRESULT CALLBACK CPlayerFoobar::WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
player->FindLyrics(); 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; return 0;
@ -358,6 +378,32 @@ void CPlayerFoobar::SetPosition(int position)
SendMessage(m_FooWindow, WM_USER, position, FOO_SETPOSITION); 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 ** SetVolume
** **

View File

@ -38,6 +38,8 @@ public:
virtual void SetPosition(int position); virtual void SetPosition(int position);
virtual void SetRating(int rating) {} virtual void SetRating(int rating) {}
virtual void SetVolume(int volume); virtual void SetVolume(int volume);
virtual void SetShuffle(bool state);
virtual void SetRepeat(bool state);
virtual void ClosePlayer(); virtual void ClosePlayer();
virtual void OpenPlayer(std::wstring& path); virtual void OpenPlayer(std::wstring& path);
@ -70,7 +72,8 @@ private:
FOO_QUITPLAYER, FOO_QUITPLAYER,
FOO_SETCALLBACK, FOO_SETCALLBACK,
FOO_REMOVECALLBACK, FOO_REMOVECALLBACK,
FOO_SETPOSITION FOO_SETPOSITION,
FOO_SETORDER
}; };
void Initialize(); void Initialize();