by thevinn » Sun Aug 28, 2011 3:44 pm
I did set "shuffle" and when I let the song play, it correctly goes to a new random song.
The problem is that when I press "next song" button, it goes to the next song by folder order instead of going to the next random song in the shuffle.
When shuffle mode is active it should be possible to go forward and backward in the shuffled list. This would be done by calculating the array of shuffled songs ahead of time, so that the order of all shuffled songs is known at once. This way, you can go forward and backward in shuffle order instead of folder order.
For example, if the folder song order is:
a.mp3, b.mp3, c.mp3, d.mp3
Then when shuffle is activated (or any time a folder is chosen), a random shuffle is calculated and stored in a separate array, for example:
c.mp3, a.mp3, d.mp3, b.mp3
Now if shuffle is turned on, and a.mp3 is playing, then d.mp3 will be the next song to play (instead of b.mp3, which would be folder order). Since the list of shuffled songs is known ahead of time (it was calculated when the folder was chosen), it is now possible to go forward and backward in the shuffled list.
For example, when d.mp3 plays I could press "previous song" and we would get a.mp3, instead of c.mp3 (folder order).
Hope this helps, and yes I'm also a programmer.