Closed GoogleCodeExporter closed 9 years ago
Thanks for the report. I'm think I understand what happened.
During playback, Harmonium actually keeps track of two playlists: the regular
one and
the shuffled one. When you toggle shuffle on/off, it simply switches the
"real" now
playing playlist between these two.
When you add songs to play during playback, the song you're adding gets added
either
next or at the end of both the normal and shuffled playlist. This was
deliberate.
When you say "play this song next," you expect the song to play next whether
you're
shuffling or not. But when you say "add this song" (not next) when shuffle is
on, I
should probably add it in a random spot.
Two possible fixes:
1. Re-shuffle the shuffled playlist when shuffle gets toggled back on.
2. Have "add to now playing" add the selection in a random place in the shuffled
playlist. If adding multiple songs, I'll have to chose a random spot for each
one.
Maybe both.
Original comment by ian.ol...@gmail.com
on 17 Mar 2010 at 3:44
Original comment by ian.ol...@gmail.com
on 17 Mar 2010 at 3:45
I replied to the response I got automatically from the group expecting it would
show
up here but I dont see it. So here it is:
Actually I think just doing #1 would work. When someone adds a song or a group
of
songs to a playlist and shuffle is on then it should add the songs first then
Re-
shuffle the playlist. This should be an easy fix, you must already have a
shuffle
function written for when someone starts a new playlist. As long as you can
maintain
a pointer to the currently playing song then you can shuffle the entire
playlist.
If I am understanding this correctly then if someone selects "shuffle: on" it
actually plays a pre-compiled shuffled version of the playlist. If this is the
case
then I might also suggest the following change:
There must currently be a point in the program where it checks to see if
the "Repeat" option is turned on(when the end of a playlist is reached). Before
restarting the playlist the shuffled version of the playlist should be
re-shuffled.
This would prevent a shuffled playlist from repeating the same exact ordering
the
second time around.
***Here are the code changes I propose***
Change the following code in the toggleShuffleMode function from:
this.musicIndex = this.shuffledMusicQueue.indexOf(this.nowPlaying);
to:
{
Collections.shuffle(this.shuffledMusicQueue);
this.musicIndex = this.shuffledMusicQueue.indexOf(this.nowPlaying);
}
Change the following code in the enqueueAtEnd function from:
this.shuffledMusicQueue.addAll(list);
this.musicQueue.addAll(list);
to:
this.shuffledMusicQueue.addAll(list);
Collections.shuffle(this.shuffledMusicQueue);
this.musicQueue.addAll(list);
Change the following code in the playNext() function from:
if(this.repeatMode) {
this.musicIndex=0;
}
to:
if(this.repeatMode) {
Collections.shuffle(this.shuffledMusicQueue);
this.musicIndex=0;
}
If I find any more bugs I will try to help supply the code changes. The source
for
this program is a fairly easy read.
Thanks again for this awesome program!
Original comment by aaron.ri...@gmail.com
on 17 Mar 2010 at 6:07
Just noticed, for the enqueueAtEnd function you also need to add:
if(this.shuffleMode)
this.musicIndex = this.shuffledMusicQueue.indexOf(this.nowPlaying);
because the currently playing song will also be shuffled to an unknown location
Original comment by aaron.ri...@gmail.com
on 17 Mar 2010 at 6:13
This issue was closed by revision 7a6dcc6b6b.
Original comment by aaron.ri...@gmail.com
on 18 Mar 2010 at 3:28
Original issue reported on code.google.com by
aaron.ri...@gmail.com
on 16 Mar 2010 at 10:21