release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Search | Go
Wiki > Main > ShuffleExplained (r1)

How Shuffle Works in Rockbox

Goals

When we designed and created the Rockbox shuffle concept, we had a few goals:

  • true shuffle that won't repeat a single song until all songs in the list/dir have been played
  • resumable - when the box has been switched off and is later turned on, we should resume the same song at the same index in the shuffled playlist/dir
  • support limitless back - at any time, even after resuming, you can always go back to the previously played song(s)

General Playing

All song playing in Rockbox works on a list of songs. When you play a dir, it builds a list of song internally and plays that. If you play a playlist, it loads that list and plays it. (Playlists are stored internally as a long list of indexes into a file on disk where the actual song name is stored.)

Playing Shuffled

Rockbox generates a random seed and re-orders the internal list with the random function (Mersenne Twister). When storing resume info, the random seed is stored and thus later re-used again when the same random order is wanted.
Edit | Attach | Print version | History: r2 < r1 | Backlinks | View wiki text | More topic actions...
r1 - 31 Mar 2005 - 08:51:28 - DanielStenberg

Parents: WebHome
Copyright by the contributing authors.