aboutsummaryrefslogtreecommitdiff
path: root/backends/mixer
diff options
context:
space:
mode:
authorColin Snover2017-09-05 22:30:01 -0500
committerColin Snover2017-09-12 11:27:45 -0500
commiteb4e9fe1d48bee1c9f641b019a29642780604b30 (patch)
treedf6495b8257c69c12759d0ad281c63b974f23925 /backends/mixer
parentc2a4784706502b21cde005979851f80d65698622 (diff)
downloadscummvm-rg350-eb4e9fe1d48bee1c9f641b019a29642780604b30.tar.gz
scummvm-rg350-eb4e9fe1d48bee1c9f641b019a29642780604b30.tar.bz2
scummvm-rg350-eb4e9fe1d48bee1c9f641b019a29642780604b30.zip
GUI: Remove mostly-broken audio output sample rate control
Removing this GUI control was suggested as far back as 2011 at <http://lists.scummvm.org/pipermail/scummvm-devel/2011-November/010416.html>. There were no objections, but it was never removed. When working on audio latency bugs, I independently rediscovered that the GUI option was broken: the per-game options would *never* work, and the option would not take effect until ScummVM was restarted because there is no API for interacting with the backend audio mixer. So now, it is finally gone. Primarily for the sake of future troubleshooting, configurability of the audio sample frequency within SdlMixerManager is maintained for the moment, but now users will need to edit their ScummVM configuration file manually to change it.
Diffstat (limited to 'backends/mixer')
-rw-r--r--backends/mixer/sdl/sdl-mixer.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/backends/mixer/sdl/sdl-mixer.cpp b/backends/mixer/sdl/sdl-mixer.cpp
index 3e65fbae97..5a31feb4dc 100644
--- a/backends/mixer/sdl/sdl-mixer.cpp
+++ b/backends/mixer/sdl/sdl-mixer.cpp
@@ -128,23 +128,27 @@ void SdlMixerManager::init() {
SDL_AudioSpec SdlMixerManager::getAudioSpec(uint32 outputRate) {
SDL_AudioSpec desired;
- // Determine the desired output sampling frequency.
- uint32 samplesPerSec = 0;
- if (ConfMan.hasKey("output_rate"))
- samplesPerSec = ConfMan.getInt("output_rate");
- if (samplesPerSec <= 0)
- samplesPerSec = outputRate;
+ const char *const appDomain = Common::ConfigManager::kApplicationDomain;
+
+ // There was once a GUI option for this, but it was never used;
+ // configurability is retained for advanced users only who wish to modify
+ // their ScummVM config file directly
+ uint32 freq = 0;
+ if (ConfMan.hasKey("output_rate", appDomain))
+ freq = ConfMan.getInt("output_rate", appDomain);
+ if (freq <= 0)
+ freq = outputRate;
// Determine the sample buffer size. We want it to store enough data for
// at least 1/16th of a second (though at most 8192 samples). Note
// that it must be a power of two. So e.g. at 22050 Hz, we request a
// sample buffer size of 2048.
uint32 samples = 8192;
- while (samples * 16 > samplesPerSec * 2)
+ while (samples * 16 > freq * 2)
samples >>= 1;
memset(&desired, 0, sizeof(desired));
- desired.freq = samplesPerSec;
+ desired.freq = freq;
desired.format = AUDIO_S16SYS;
desired.channels = 2;
desired.samples = (uint16)samples;