PlaylistControl: move code to new method SeekSongOrder()
This commit is contained in:
parent
2406152576
commit
704be54c3a
|
@ -234,6 +234,10 @@ public:
|
||||||
|
|
||||||
void PlayPrevious(PlayerControl &pc);
|
void PlayPrevious(PlayerControl &pc);
|
||||||
|
|
||||||
|
PlaylistResult SeekSongOrder(PlayerControl &pc,
|
||||||
|
unsigned song_order,
|
||||||
|
float seek_time);
|
||||||
|
|
||||||
PlaylistResult SeekSongPosition(PlayerControl &pc,
|
PlaylistResult SeekSongPosition(PlayerControl &pc,
|
||||||
unsigned song_position,
|
unsigned song_position,
|
||||||
float seek_time);
|
float seek_time);
|
||||||
|
|
|
@ -190,17 +190,12 @@ playlist::PlayPrevious(PlayerControl &pc)
|
||||||
}
|
}
|
||||||
|
|
||||||
PlaylistResult
|
PlaylistResult
|
||||||
playlist::SeekSongPosition(PlayerControl &pc, unsigned song, float seek_time)
|
playlist::SeekSongOrder(PlayerControl &pc, unsigned i, float seek_time)
|
||||||
{
|
{
|
||||||
if (!queue.IsValidPosition(song))
|
assert(queue.IsValidOrder(i));
|
||||||
return PlaylistResult::BAD_RANGE;
|
|
||||||
|
|
||||||
const Song *queued_song = GetQueuedSong();
|
const Song *queued_song = GetQueuedSong();
|
||||||
|
|
||||||
unsigned i = queue.random
|
|
||||||
? queue.PositionToOrder(song)
|
|
||||||
: song;
|
|
||||||
|
|
||||||
pc.ClearError();
|
pc.ClearError();
|
||||||
stop_on_error = true;
|
stop_on_error = true;
|
||||||
error_count = 0;
|
error_count = 0;
|
||||||
|
@ -228,6 +223,19 @@ playlist::SeekSongPosition(PlayerControl &pc, unsigned song, float seek_time)
|
||||||
return PlaylistResult::SUCCESS;
|
return PlaylistResult::SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlaylistResult
|
||||||
|
playlist::SeekSongPosition(PlayerControl &pc, unsigned song, float seek_time)
|
||||||
|
{
|
||||||
|
if (!queue.IsValidPosition(song))
|
||||||
|
return PlaylistResult::BAD_RANGE;
|
||||||
|
|
||||||
|
unsigned i = queue.random
|
||||||
|
? queue.PositionToOrder(song)
|
||||||
|
: song;
|
||||||
|
|
||||||
|
return SeekSongOrder(pc, i, seek_time);
|
||||||
|
}
|
||||||
|
|
||||||
PlaylistResult
|
PlaylistResult
|
||||||
playlist::SeekSongId(PlayerControl &pc, unsigned id, float seek_time)
|
playlist::SeekSongId(PlayerControl &pc, unsigned id, float seek_time)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue