X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Ftools.c;h=7c81b8f7748ba8f67339e8d784d6898371729a8d;hb=24e6fe624376685e6c63861aa132c6f6cdf2bd4d;hp=39976f9d9522949cc221b0234f69950c968b4e08;hpb=40705fd048ae2a23c4598ada848570f798ced780;p=rocksndiamonds.git diff --git a/src/tools.c b/src/tools.c index 39976f9d..7c81b8f7 100644 --- a/src/tools.c +++ b/src/tools.c @@ -11431,6 +11431,27 @@ void PlaySoundSelecting(void) #endif } +void ToggleAudioSampleRateIfNeeded(void) +{ + int setup_audio_sample_rate = (setup.audio_sample_rate_44100 ? 44100 : 22050); + + // if setup and audio sample rate are already matching, nothing do do + if ((setup_audio_sample_rate == audio.sample_rate) || + !audio.sound_available) + return; + +#if 1 + // apparently changing the audio output sample rate does not work at runtime, + // so currently the program has to be restarted to apply the new sample rate + Request("Please restart the program to change audio sample rate!", REQ_CONFIRM); +#else + SDLReopenAudio(); + + // set setup value according to successfully changed audio sample rate + setup.audio_sample_rate_44100 = (audio.sample_rate == 44100); +#endif +} + void ToggleFullscreenIfNeeded(void) { // if setup and video fullscreen state are already matching, nothing do do