diff --git a/doc/040_cvarlist.md b/doc/040_cvarlist.md index 4200fd76..7d11bb62 100644 --- a/doc/040_cvarlist.md +++ b/doc/040_cvarlist.md @@ -291,6 +291,15 @@ it's `+set busywait 0` (setting the `busywait` cvar) and `-portable` 0. Setting this cvar to `1` disables this behavior, the music keeps playing. +* **ogg_shuffle**: Ogg/Vorbis playback mode. Supported modes are: + `0`: Loop the current track (the default). + `1`: Play the current track once, then stop. + `2`: Play all available tracks in a linear sequence. + `3`: Shuffle through the available tracks, never play the same track + twice in a row. + `4`: Shuffle through the available tracks, may play the same track + multiple times in a row. + * **s_doppler**: If set to `1` doppler effects are enabled. This is only supported by the OpenAL sound backend. diff --git a/src/client/menu/menu.c b/src/client/menu/menu.c index 41f97939..90f8ea2d 100644 --- a/src/client/menu/menu.c +++ b/src/client/menu/menu.c @@ -2371,6 +2371,7 @@ Options_MenuInit(void) "play once", "sequential", "random", + "truly random", 0 }; diff --git a/src/client/sound/ogg.c b/src/client/sound/ogg.c index 74fc6303..782c2731 100644 --- a/src/client/sound/ogg.c +++ b/src/client/sound/ogg.c @@ -530,6 +530,7 @@ OGG_PlayTrack(const char *track, qboolean cdtrack, qboolean immediate) newtrack = (curtrack + 1) % (ogg_maxfileindex + 1) != 0 ? (curtrack + 1) : 2; } break; case 3: // random + case 4: // random with true randomness { int retries = 100; newtrack = 0; @@ -537,6 +538,14 @@ OGG_PlayTrack(const char *track, qboolean cdtrack, qboolean immediate) while (retries-- > 0 && newtrack < 2) { newtrack = randk() % (ogg_maxfileindex + 1); + + if (playback == 3) + { + if (newtrack == curtrack) + { + newtrack = 0; + } + } } } break; }