mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 19:45:23 -04:00
Allow you to change delay between music playing by editing options.txt (thanks wasteland123)
This commit is contained in:
parent
0962e33a55
commit
63a06b0a17
@ -736,6 +736,7 @@ static AudioHandle music_out;
|
||||
static void* music_thread;
|
||||
static void* music_waitable;
|
||||
static volatile cc_bool music_pendingStop, music_joining;
|
||||
static int music_minDelay, music_maxDelay;
|
||||
|
||||
static cc_result Music_Buffer(int i, cc_int16* data, int maxSamples, struct VorbisState* ctx) {
|
||||
int samples = 0;
|
||||
@ -865,7 +866,7 @@ static void Music_RunLoop(void) {
|
||||
if (res) { Logger_Warn2(res, "closing", &path); break; }
|
||||
|
||||
if (music_pendingStop) break;
|
||||
delay = 120 * 1000 + Random_Next(&rnd, 300 * 1000);
|
||||
delay = Random_Range(&rnd, music_minDelay, music_maxDelay);
|
||||
Waitable_WaitFor(music_waitable, delay);
|
||||
}
|
||||
|
||||
@ -930,6 +931,10 @@ static void Audio_Init(void) {
|
||||
music_waitable = Waitable_Create();
|
||||
Audio_SysInit();
|
||||
|
||||
/* music is delayed between 2 - 7 minutes */
|
||||
music_minDelay = Options_GetInt(OPT_MIN_MUSIC_DELAY, 0, 3600, 120) * MILLIS_PER_SEC;
|
||||
music_maxDelay = Options_GetInt(OPT_MAX_MUSIC_DELAY, 0, 3600, 420) * MILLIS_PER_SEC;
|
||||
|
||||
volume = Audio_LoadVolume(OPT_MUSIC_VOLUME, OPT_USE_MUSIC);
|
||||
Audio_SetMusic(volume);
|
||||
volume = Audio_LoadVolume(OPT_SOUND_VOLUME, OPT_USE_SOUND);
|
||||
|
@ -10,6 +10,8 @@
|
||||
#define OPT_MUSIC_VOLUME "musicvolume"
|
||||
#define OPT_SOUND_VOLUME "soundsvolume"
|
||||
#define OPT_FORCE_OPENAL "forceopenal"
|
||||
#define OPT_MIN_MUSIC_DELAY "music-mindelay"
|
||||
#define OPT_MAX_MUSIC_DELAY "music-maxdelay"
|
||||
|
||||
#define OPT_VIEW_DISTANCE "viewdist"
|
||||
#define OPT_BLOCK_PHYSICS "singleplayerphysics"
|
||||
|
Loading…
x
Reference in New Issue
Block a user