2009-03-13 18:43:16 +01:00
|
|
|
/*
|
2013-01-04 20:50:00 +01:00
|
|
|
* Copyright (C) 2003-2013 The Music Player Daemon Project
|
2009-03-13 18:43:16 +01:00
|
|
|
* http://www.musicpd.org
|
2004-02-24 00:41:20 +01:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
2009-03-13 18:43:16 +01:00
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2004-02-24 00:41:20 +01:00
|
|
|
*/
|
|
|
|
|
2009-11-12 09:12:38 +01:00
|
|
|
#include "config.h"
|
2013-01-07 10:55:05 +01:00
|
|
|
#include "Playlist.hxx"
|
2013-09-27 22:31:24 +02:00
|
|
|
#include "PlaylistError.hxx"
|
2013-01-04 22:31:53 +01:00
|
|
|
#include "PlayerControl.hxx"
|
2013-07-28 13:25:12 +02:00
|
|
|
#include "Song.hxx"
|
2013-10-21 23:22:16 +02:00
|
|
|
#include "tag/Tag.hxx"
|
2013-01-09 08:36:52 +01:00
|
|
|
#include "Idle.hxx"
|
2013-09-27 22:31:24 +02:00
|
|
|
#include "Log.hxx"
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2008-12-29 17:28:32 +01:00
|
|
|
#include <assert.h>
|
2004-06-05 03:14:37 +02:00
|
|
|
|
2009-02-04 18:56:41 +01:00
|
|
|
void
|
2013-10-21 23:22:16 +02:00
|
|
|
playlist::TagModified(Song &&song)
|
2009-01-20 22:49:19 +01:00
|
|
|
{
|
2013-10-21 23:22:16 +02:00
|
|
|
if (!playing || song.tag == nullptr)
|
2009-01-20 22:49:19 +01:00
|
|
|
return;
|
|
|
|
|
2013-01-07 10:55:05 +01:00
|
|
|
assert(current >= 0);
|
2009-01-23 00:09:26 +01:00
|
|
|
|
2013-10-21 23:22:16 +02:00
|
|
|
Song ¤t_song = queue.GetOrder(current);
|
|
|
|
if (SongEquals(song, current_song))
|
|
|
|
current_song.ReplaceTag(std::move(*song.tag));
|
|
|
|
|
2013-01-07 10:55:05 +01:00
|
|
|
queue.ModifyAtOrder(current);
|
2013-10-22 00:38:10 +02:00
|
|
|
queue.IncrementVersion();
|
2009-01-22 23:40:11 +01:00
|
|
|
idle_add(IDLE_PLAYLIST);
|
2009-01-20 22:49:19 +01:00
|
|
|
}
|
|
|
|
|
2009-01-23 07:33:15 +01:00
|
|
|
/**
|
|
|
|
* Queue a song, addressed by its order number.
|
|
|
|
*/
|
2009-01-23 00:06:54 +01:00
|
|
|
static void
|
2013-10-28 10:12:21 +01:00
|
|
|
playlist_queue_song_order(playlist &playlist, PlayerControl &pc,
|
2009-11-03 21:08:48 +01:00
|
|
|
unsigned order)
|
2006-07-20 18:02:40 +02:00
|
|
|
{
|
2013-10-19 18:48:38 +02:00
|
|
|
assert(playlist.queue.IsValidOrder(order));
|
2009-01-04 19:09:34 +01:00
|
|
|
|
2013-10-19 18:48:38 +02:00
|
|
|
playlist.queued = order;
|
2009-01-04 19:09:34 +01:00
|
|
|
|
2013-10-19 18:48:38 +02:00
|
|
|
Song *song = playlist.queue.GetOrder(order).DupDetached();
|
2012-08-09 22:19:39 +02:00
|
|
|
|
2013-10-17 01:01:15 +02:00
|
|
|
{
|
|
|
|
const auto uri = song->GetURI();
|
|
|
|
FormatDebug(playlist_domain, "queue song %i:\"%s\"",
|
2013-10-19 18:48:38 +02:00
|
|
|
playlist.queued, uri.c_str());
|
2013-10-17 01:01:15 +02:00
|
|
|
}
|
2009-01-23 00:06:54 +01:00
|
|
|
|
2013-10-19 18:48:38 +02:00
|
|
|
pc.EnqueueSong(song);
|
2009-01-23 00:06:54 +01:00
|
|
|
}
|
2009-01-04 19:09:34 +01:00
|
|
|
|
2009-01-23 07:33:15 +01:00
|
|
|
/**
|
2010-06-19 13:33:32 +02:00
|
|
|
* Called if the player thread has started playing the "queued" song.
|
2009-01-23 07:33:15 +01:00
|
|
|
*/
|
2009-07-29 00:07:01 +02:00
|
|
|
static void
|
2013-10-28 10:12:21 +01:00
|
|
|
playlist_song_started(playlist &playlist, PlayerControl &pc)
|
2006-07-20 18:02:40 +02:00
|
|
|
{
|
2013-10-19 18:48:38 +02:00
|
|
|
assert(pc.next_song == nullptr);
|
|
|
|
assert(playlist.queued >= -1);
|
2009-01-23 07:33:15 +01:00
|
|
|
|
2010-06-19 13:33:32 +02:00
|
|
|
/* queued song has started: copy queued to current,
|
|
|
|
and notify the clients */
|
2010-06-01 09:59:46 +02:00
|
|
|
|
2013-10-19 18:48:38 +02:00
|
|
|
int current = playlist.current;
|
|
|
|
playlist.current = playlist.queued;
|
|
|
|
playlist.queued = -1;
|
2010-05-31 23:32:11 +02:00
|
|
|
|
2013-10-19 18:48:38 +02:00
|
|
|
if(playlist.queue.consume)
|
|
|
|
playlist.DeleteOrder(pc, current);
|
2010-06-19 13:33:32 +02:00
|
|
|
|
|
|
|
idle_add(IDLE_PLAYER);
|
2004-02-24 00:41:20 +01:00
|
|
|
}
|
|
|
|
|
2013-07-28 13:25:12 +02:00
|
|
|
const Song *
|
2013-01-07 10:55:05 +01:00
|
|
|
playlist::GetQueuedSong() const
|
2006-07-20 18:02:40 +02:00
|
|
|
{
|
2013-01-07 10:55:05 +01:00
|
|
|
return playing && queued >= 0
|
2013-10-19 18:48:38 +02:00
|
|
|
? &queue.GetOrder(queued)
|
2013-01-07 10:55:05 +01:00
|
|
|
: nullptr;
|
2009-02-04 18:52:37 +01:00
|
|
|
}
|
|
|
|
|
2009-02-04 20:31:22 +01:00
|
|
|
void
|
2013-10-28 10:12:21 +01:00
|
|
|
playlist::UpdateQueuedSong(PlayerControl &pc, const Song *prev)
|
2009-02-04 18:52:37 +01:00
|
|
|
{
|
2013-01-07 10:55:05 +01:00
|
|
|
if (!playing)
|
2009-02-04 18:52:37 +01:00
|
|
|
return;
|
|
|
|
|
2013-01-07 10:55:05 +01:00
|
|
|
assert(!queue.IsEmpty());
|
2013-10-02 08:13:28 +02:00
|
|
|
assert((queued < 0) == (prev == nullptr));
|
2009-02-04 18:52:37 +01:00
|
|
|
|
2013-01-07 10:55:05 +01:00
|
|
|
const int next_order = current >= 0
|
|
|
|
? queue.GetNextOrder(current)
|
2009-02-04 18:52:37 +01:00
|
|
|
: 0;
|
|
|
|
|
2013-01-07 10:55:05 +01:00
|
|
|
if (next_order == 0 && queue.random && !queue.single) {
|
2009-02-04 18:52:37 +01:00
|
|
|
/* shuffle the song order again, so we get a different
|
|
|
|
order each time the playlist is played
|
|
|
|
completely */
|
2013-01-07 10:55:05 +01:00
|
|
|
const unsigned current_position =
|
|
|
|
queue.OrderToPosition(current);
|
2009-02-04 18:52:37 +01:00
|
|
|
|
2013-01-07 10:55:05 +01:00
|
|
|
queue.ShuffleOrder();
|
2009-02-04 18:52:37 +01:00
|
|
|
|
2013-01-07 10:55:05 +01:00
|
|
|
/* make sure that the current still points to
|
2009-02-04 18:52:37 +01:00
|
|
|
the current song, after the song order has been
|
|
|
|
shuffled */
|
2013-01-07 10:55:05 +01:00
|
|
|
current = queue.PositionToOrder(current_position);
|
2009-02-04 18:52:37 +01:00
|
|
|
}
|
|
|
|
|
2013-07-28 13:25:12 +02:00
|
|
|
const Song *const next_song = next_order >= 0
|
2013-10-19 18:48:38 +02:00
|
|
|
? &queue.GetOrder(next_order)
|
2013-01-07 10:55:05 +01:00
|
|
|
: nullptr;
|
2009-02-04 18:52:37 +01:00
|
|
|
|
2013-10-02 08:13:28 +02:00
|
|
|
if (prev != nullptr && next_song != prev) {
|
2009-02-04 18:52:37 +01:00
|
|
|
/* clear the currently queued song */
|
2013-01-20 17:48:23 +01:00
|
|
|
pc.Cancel();
|
2013-01-07 10:55:05 +01:00
|
|
|
queued = -1;
|
2009-02-04 18:52:37 +01:00
|
|
|
}
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2009-02-04 18:52:37 +01:00
|
|
|
if (next_order >= 0) {
|
|
|
|
if (next_song != prev)
|
2013-10-19 18:48:38 +02:00
|
|
|
playlist_queue_song_order(*this, pc, next_order);
|
2009-02-04 18:52:37 +01:00
|
|
|
else
|
2013-01-07 10:55:05 +01:00
|
|
|
queued = next_order;
|
2009-02-04 18:52:37 +01:00
|
|
|
}
|
2008-04-12 06:11:56 +02:00
|
|
|
}
|
|
|
|
|
2009-02-04 20:31:22 +01:00
|
|
|
void
|
2013-10-28 10:12:21 +01:00
|
|
|
playlist::PlayOrder(PlayerControl &pc, int order)
|
2006-07-20 18:02:40 +02:00
|
|
|
{
|
2013-01-07 10:55:05 +01:00
|
|
|
playing = true;
|
|
|
|
queued = -1;
|
2007-12-28 03:56:25 +01:00
|
|
|
|
2013-10-19 18:48:38 +02:00
|
|
|
Song *song = queue.GetOrder(order).DupDetached();
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2013-10-17 01:01:15 +02:00
|
|
|
{
|
|
|
|
const auto uri = song->GetURI();
|
|
|
|
FormatDebug(playlist_domain, "play %i:\"%s\"",
|
|
|
|
order, uri.c_str());
|
|
|
|
}
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2013-01-20 17:48:23 +01:00
|
|
|
pc.Play(song);
|
2013-01-07 10:55:05 +01:00
|
|
|
current = order;
|
2004-02-24 00:41:20 +01:00
|
|
|
}
|
|
|
|
|
2009-02-04 18:56:41 +01:00
|
|
|
static void
|
2013-10-28 10:12:21 +01:00
|
|
|
playlist_resume_playback(playlist &playlist, PlayerControl &pc);
|
2009-01-21 16:17:57 +01:00
|
|
|
|
2009-07-29 00:07:01 +02:00
|
|
|
void
|
2013-10-28 10:12:21 +01:00
|
|
|
playlist::SyncWithPlayer(PlayerControl &pc)
|
2006-07-20 18:02:40 +02:00
|
|
|
{
|
2013-01-07 10:55:05 +01:00
|
|
|
if (!playing)
|
2009-01-23 07:33:15 +01:00
|
|
|
/* this event has reached us out of sync: we aren't
|
|
|
|
playing anymore; ignore the event */
|
2006-07-20 18:02:40 +02:00
|
|
|
return;
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2013-01-20 17:48:23 +01:00
|
|
|
pc.Lock();
|
2013-09-27 22:07:20 +02:00
|
|
|
const PlayerState pc_state = pc.GetState();
|
2013-07-28 13:25:12 +02:00
|
|
|
const Song *pc_next_song = pc.next_song;
|
2013-01-20 17:48:23 +01:00
|
|
|
pc.Unlock();
|
2010-06-19 13:15:42 +02:00
|
|
|
|
2013-09-27 22:07:20 +02:00
|
|
|
if (pc_state == PlayerState::STOP)
|
2009-01-23 07:33:15 +01:00
|
|
|
/* the player thread has stopped: check if playback
|
|
|
|
should be restarted with the next song. That can
|
|
|
|
happen if the playlist isn't filling the queue fast
|
|
|
|
enough */
|
2013-10-19 18:48:38 +02:00
|
|
|
playlist_resume_playback(*this, pc);
|
2008-08-26 08:27:18 +02:00
|
|
|
else {
|
2009-01-23 07:33:15 +01:00
|
|
|
/* check if the player thread has already started
|
|
|
|
playing the queued song */
|
2013-01-07 10:55:05 +01:00
|
|
|
if (pc_next_song == nullptr && queued != -1)
|
2013-10-19 18:48:38 +02:00
|
|
|
playlist_song_started(*this, pc);
|
2009-01-23 07:33:15 +01:00
|
|
|
|
2013-01-20 17:48:23 +01:00
|
|
|
pc.Lock();
|
2013-01-07 10:55:05 +01:00
|
|
|
pc_next_song = pc.next_song;
|
2013-01-20 17:48:23 +01:00
|
|
|
pc.Unlock();
|
2012-08-15 22:47:08 +02:00
|
|
|
|
2009-01-23 07:33:15 +01:00
|
|
|
/* make sure the queued song is always set (if
|
|
|
|
possible) */
|
2013-01-07 10:55:05 +01:00
|
|
|
if (pc_next_song == nullptr && queued < 0)
|
|
|
|
UpdateQueuedSong(pc, nullptr);
|
2008-08-26 08:27:18 +02:00
|
|
|
}
|
2004-02-24 00:41:20 +01:00
|
|
|
}
|
|
|
|
|
2009-01-23 07:33:15 +01:00
|
|
|
/**
|
|
|
|
* The player has stopped for some reason. Check the error, and
|
|
|
|
* decide whether to re-start playback
|
|
|
|
*/
|
2009-02-04 18:56:41 +01:00
|
|
|
static void
|
2013-10-28 10:12:21 +01:00
|
|
|
playlist_resume_playback(playlist &playlist, PlayerControl &pc)
|
2006-07-20 18:02:40 +02:00
|
|
|
{
|
2013-10-19 18:48:38 +02:00
|
|
|
assert(playlist.playing);
|
|
|
|
assert(pc.GetState() == PlayerState::STOP);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2013-10-19 18:48:38 +02:00
|
|
|
const auto error = pc.GetErrorType();
|
2013-09-27 22:07:20 +02:00
|
|
|
if (error == PlayerError::NONE)
|
2013-10-19 18:48:38 +02:00
|
|
|
playlist.error_count = 0;
|
2009-01-23 06:40:52 +01:00
|
|
|
else
|
2013-10-19 18:48:38 +02:00
|
|
|
++playlist.error_count;
|
2009-01-23 06:40:52 +01:00
|
|
|
|
2013-10-19 18:48:38 +02:00
|
|
|
if ((playlist.stop_on_error && error != PlayerError::NONE) ||
|
2013-09-27 22:07:20 +02:00
|
|
|
error == PlayerError::OUTPUT ||
|
2013-10-19 18:48:38 +02:00
|
|
|
playlist.error_count >= playlist.queue.GetLength())
|
2009-01-23 07:33:15 +01:00
|
|
|
/* too many errors, or critical error: stop
|
|
|
|
playback */
|
2013-10-19 18:48:38 +02:00
|
|
|
playlist.Stop(pc);
|
2009-01-23 06:40:52 +01:00
|
|
|
else
|
2009-01-23 07:33:15 +01:00
|
|
|
/* continue playback at the next song */
|
2013-10-19 18:48:38 +02:00
|
|
|
playlist.PlayNext(pc);
|
2009-03-30 00:01:02 +02:00
|
|
|
}
|
|
|
|
|
2009-07-29 00:07:01 +02:00
|
|
|
void
|
2013-10-28 10:12:21 +01:00
|
|
|
playlist::SetRepeat(PlayerControl &pc, bool status)
|
2006-07-20 18:02:40 +02:00
|
|
|
{
|
2013-01-07 10:55:05 +01:00
|
|
|
if (status == queue.repeat)
|
2009-01-23 00:07:20 +01:00
|
|
|
return;
|
|
|
|
|
2013-01-07 10:55:05 +01:00
|
|
|
queue.repeat = status;
|
2012-08-25 08:44:31 +02:00
|
|
|
|
2013-01-20 17:48:23 +01:00
|
|
|
pc.SetBorderPause(queue.single && !queue.repeat);
|
2008-10-14 22:38:14 +02:00
|
|
|
|
2009-02-04 18:52:37 +01:00
|
|
|
/* if the last song is currently being played, the "next song"
|
|
|
|
might change when repeat mode is toggled */
|
2013-01-07 10:55:05 +01:00
|
|
|
UpdateQueuedSong(pc, GetQueuedSong());
|
2009-02-04 18:52:37 +01:00
|
|
|
|
2008-10-14 22:38:14 +02:00
|
|
|
idle_add(IDLE_OPTIONS);
|
2004-02-24 00:41:20 +01:00
|
|
|
}
|
|
|
|
|
2009-07-29 00:07:01 +02:00
|
|
|
static void
|
2013-10-19 18:48:38 +02:00
|
|
|
playlist_order(playlist &playlist)
|
2006-07-20 18:02:40 +02:00
|
|
|
{
|
2013-10-19 18:48:38 +02:00
|
|
|
if (playlist.current >= 0)
|
2009-01-23 07:33:15 +01:00
|
|
|
/* update playlist.current, order==position now */
|
2013-10-19 18:48:38 +02:00
|
|
|
playlist.current = playlist.queue.OrderToPosition(playlist.current);
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2013-10-19 18:48:38 +02:00
|
|
|
playlist.queue.RestoreOrder();
|
2004-02-24 00:41:20 +01:00
|
|
|
}
|
|
|
|
|
2009-07-29 00:07:01 +02:00
|
|
|
void
|
2013-10-28 10:12:21 +01:00
|
|
|
playlist::SetSingle(PlayerControl &pc, bool status)
|
2009-03-27 14:42:55 +01:00
|
|
|
{
|
2013-01-07 10:55:05 +01:00
|
|
|
if (status == queue.single)
|
2009-03-27 15:28:49 +01:00
|
|
|
return;
|
|
|
|
|
2013-01-07 10:55:05 +01:00
|
|
|
queue.single = status;
|
2012-08-25 08:44:31 +02:00
|
|
|
|
2013-01-20 17:48:23 +01:00
|
|
|
pc.SetBorderPause(queue.single && !queue.repeat);
|
2009-03-27 14:42:55 +01:00
|
|
|
|
|
|
|
/* if the last song is currently being played, the "next song"
|
2009-03-27 15:28:49 +01:00
|
|
|
might change when single mode is toggled */
|
2013-01-07 10:55:05 +01:00
|
|
|
UpdateQueuedSong(pc, GetQueuedSong());
|
2009-03-27 14:42:55 +01:00
|
|
|
|
|
|
|
idle_add(IDLE_OPTIONS);
|
|
|
|
}
|
|
|
|
|
2009-07-29 00:07:01 +02:00
|
|
|
void
|
2013-01-07 10:55:05 +01:00
|
|
|
playlist::SetConsume(bool status)
|
2009-03-30 00:01:02 +02:00
|
|
|
{
|
2013-01-07 10:55:05 +01:00
|
|
|
if (status == queue.consume)
|
2009-03-30 00:01:02 +02:00
|
|
|
return;
|
|
|
|
|
2013-01-07 10:55:05 +01:00
|
|
|
queue.consume = status;
|
2009-03-30 00:01:02 +02:00
|
|
|
idle_add(IDLE_OPTIONS);
|
|
|
|
}
|
|
|
|
|
2009-07-29 00:07:01 +02:00
|
|
|
void
|
2013-10-28 10:12:21 +01:00
|
|
|
playlist::SetRandom(PlayerControl &pc, bool status)
|
2006-07-20 18:02:40 +02:00
|
|
|
{
|
2013-01-07 10:55:05 +01:00
|
|
|
if (status == queue.random)
|
2008-10-08 11:05:02 +02:00
|
|
|
return;
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2013-07-28 13:25:12 +02:00
|
|
|
const Song *const queued_song = GetQueuedSong();
|
2009-01-23 00:07:10 +01:00
|
|
|
|
2013-01-07 10:55:05 +01:00
|
|
|
queue.random = status;
|
2004-02-24 00:41:20 +01:00
|
|
|
|
2013-01-07 10:55:05 +01:00
|
|
|
if (queue.random) {
|
|
|
|
/* shuffle the queue order, but preserve current */
|
2009-01-23 07:33:15 +01:00
|
|
|
|
2013-01-07 10:55:05 +01:00
|
|
|
const int current_position = GetCurrentPosition();
|
2009-01-23 00:08:40 +01:00
|
|
|
|
2013-01-07 10:55:05 +01:00
|
|
|
queue.ShuffleOrder();
|
2009-01-23 00:08:40 +01:00
|
|
|
|
|
|
|
if (current_position >= 0) {
|
2009-01-23 07:33:15 +01:00
|
|
|
/* make sure the current song is the first in
|
|
|
|
the order list, so the whole rest of the
|
|
|
|
playlist is played after that */
|
2009-01-23 00:08:40 +01:00
|
|
|
unsigned current_order =
|
2013-01-07 10:55:05 +01:00
|
|
|
queue.PositionToOrder(current_position);
|
|
|
|
queue.SwapOrders(0, current_order);
|
|
|
|
current = 0;
|
2009-02-11 18:02:50 +01:00
|
|
|
} else
|
2013-01-07 10:55:05 +01:00
|
|
|
current = -1;
|
2008-10-08 11:05:02 +02:00
|
|
|
} else
|
2013-10-19 18:48:38 +02:00
|
|
|
playlist_order(*this);
|
2008-10-14 22:38:14 +02:00
|
|
|
|
2013-01-07 10:55:05 +01:00
|
|
|
UpdateQueuedSong(pc, queued_song);
|
2009-02-04 18:52:37 +01:00
|
|
|
|
2008-10-14 22:38:14 +02:00
|
|
|
idle_add(IDLE_OPTIONS);
|
2004-02-24 00:41:20 +01:00
|
|
|
}
|
|
|
|
|
2009-07-29 00:07:01 +02:00
|
|
|
int
|
2013-01-07 10:55:05 +01:00
|
|
|
playlist::GetCurrentPosition() const
|
2006-07-20 18:02:40 +02:00
|
|
|
{
|
2013-01-07 10:55:05 +01:00
|
|
|
return current >= 0
|
|
|
|
? queue.OrderToPosition(current)
|
|
|
|
: -1;
|
2006-03-26 15:46:05 +02:00
|
|
|
}
|
|
|
|
|
2009-07-29 00:07:01 +02:00
|
|
|
int
|
2013-01-07 10:55:05 +01:00
|
|
|
playlist::GetNextPosition() const
|
2006-07-20 18:02:40 +02:00
|
|
|
{
|
2013-01-07 10:55:05 +01:00
|
|
|
if (current < 0)
|
|
|
|
return -1;
|
2006-03-26 15:46:05 +02:00
|
|
|
|
2013-01-07 10:55:05 +01:00
|
|
|
if (queue.single && queue.repeat)
|
|
|
|
return queue.OrderToPosition(current);
|
|
|
|
else if (queue.IsValidOrder(current + 1))
|
|
|
|
return queue.OrderToPosition(current + 1);
|
|
|
|
else if (queue.repeat)
|
|
|
|
return queue.OrderToPosition(0);
|
2006-03-26 15:46:05 +02:00
|
|
|
|
2013-01-07 10:55:05 +01:00
|
|
|
return -1;
|
2006-03-26 15:46:05 +02:00
|
|
|
}
|