NowPlayingPlugin: Added SHUFFLE and REPEAT types and accompanying SetShuffle and SetRepeat bangs

This commit is contained in:
Birunthan Mohanathas
2011-09-11 08:22:07 +00:00
parent 6cce1c2233
commit 6b5ca293e8
13 changed files with 271 additions and 65 deletions

View File

@ -573,6 +573,59 @@ void CPlayerITunes::SetVolume(int volume)
m_iTunes->put_SoundVolume((long)volume);
}
/*
** SetShuffle
**
** Handles the SetShuffle bang.
**
*/
void CPlayerITunes::SetShuffle(bool state)
{
IITTrack* track;
HRESULT hr = m_iTunes->get_CurrentTrack(&track);
if (SUCCEEDED(hr))
{
IITPlaylist* playlist;
hr = track->get_Playlist(&playlist);
if (SUCCEEDED(hr))
{
m_Shuffle = state;
VARIANT_BOOL shuffle = m_Shuffle ? VARIANT_TRUE : VARIANT_FALSE;
playlist->put_Shuffle(shuffle);
playlist->Release();
}
track->Release();
}
}
/*
** SetRepeat
**
** Handles the SetRepeat bang.
**
*/
void CPlayerITunes::SetRepeat(bool state)
{
IITTrack* track;
HRESULT hr = m_iTunes->get_CurrentTrack(&track);
if (SUCCEEDED(hr))
{
IITPlaylist* playlist;
hr = track->get_Playlist(&playlist);
if (SUCCEEDED(hr))
{
m_Repeat = state;
playlist->put_SongRepeat((ITPlaylistRepeatMode)m_Repeat);
playlist->Release();
}
track->Release();
}
}
/*
** ClosePlayer
**