use switch/case in syncPlaylistWithQueue()

This commit is contained in:
Max Kellermann 2008-08-26 08:27:17 +02:00
parent 110cef6fda
commit 2a06e2dafa

View File

@ -507,22 +507,32 @@ static void queueNextSongInPlaylist(void)
static void syncPlaylistWithQueue(int queue) static void syncPlaylistWithQueue(int queue)
{ {
if (queue && getPlayerQueueState() == PLAYER_QUEUE_BLANK) { switch (getPlayerQueueState()) {
queueNextSongInPlaylist(); case PLAYER_QUEUE_EMPTY:
} else if (getPlayerQueueState() == PLAYER_QUEUE_DECODE) {
if (playlist.queued != -1)
setQueueState(PLAYER_QUEUE_PLAY);
else
setQueueState(PLAYER_QUEUE_STOP);
} else if (getPlayerQueueState() == PLAYER_QUEUE_EMPTY) {
setQueueState(PLAYER_QUEUE_BLANK); setQueueState(PLAYER_QUEUE_BLANK);
if (playlist.queued >= 0) { if (playlist.queued >= 0) {
DEBUG("playlist: now playing queued song\n"); DEBUG("playlist: now playing queued song\n");
playlist.current = playlist.queued; playlist.current = playlist.queued;
} }
playlist.queued = -1; playlist.queued = -1;
/* intentionally no break here */
case PLAYER_QUEUE_BLANK:
if (queue) if (queue)
queueNextSongInPlaylist(); queueNextSongInPlaylist();
break;
case PLAYER_QUEUE_DECODE:
if (playlist.queued != -1)
setQueueState(PLAYER_QUEUE_PLAY);
else
setQueueState(PLAYER_QUEUE_STOP);
break;
case PLAYER_QUEUE_FULL:
case PLAYER_QUEUE_PLAY:
case PLAYER_QUEUE_STOP:
break;
} }
} }