diff options
author | Colin Snover | 2017-09-05 22:30:01 -0500 |
---|---|---|
committer | Colin Snover | 2017-09-12 11:27:45 -0500 |
commit | eb4e9fe1d48bee1c9f641b019a29642780604b30 (patch) | |
tree | df6495b8257c69c12759d0ad281c63b974f23925 | |
parent | c2a4784706502b21cde005979851f80d65698622 (diff) | |
download | scummvm-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.
-rw-r--r-- | backends/mixer/sdl/sdl-mixer.cpp | 20 | ||||
-rw-r--r-- | gui/options.cpp | 34 | ||||
-rw-r--r-- | gui/options.h | 2 | ||||
-rw-r--r-- | gui/themes/default.inc | 16 | ||||
-rw-r--r-- | gui/themes/scummclassic.zip | bin | 129631 -> 129144 bytes | |||
-rw-r--r-- | gui/themes/scummclassic/classic_layout.stx | 8 | ||||
-rw-r--r-- | gui/themes/scummclassic/classic_layout_lowres.stx | 8 | ||||
-rw-r--r-- | gui/themes/scummmodern.zip | bin | 1649171 -> 1648684 bytes | |||
-rw-r--r-- | gui/themes/scummmodern/scummmodern_layout.stx | 8 | ||||
-rw-r--r-- | gui/themes/scummmodern/scummmodern_layout_lowres.stx | 8 |
10 files changed, 12 insertions, 92 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; diff --git a/gui/options.cpp b/gui/options.cpp index 3ff027620e..82eb252cf1 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -120,8 +120,6 @@ enum { static const char *savePeriodLabels[] = { _s("Never"), _s("every 5 mins"), _s("every 10 mins"), _s("every 15 mins"), _s("every 30 mins"), 0 }; static const int savePeriodValues[] = { 0, 5 * 60, 10 * 60, 15 * 60, 30 * 60, -1 }; -static const char *outputRateLabels[] = { _s("<default>"), _s("8 kHz"), _s("11 kHz"), _s("22 kHz"), _s("44 kHz"), _s("48 kHz"), 0 }; -static const int outputRateValues[] = { 0, 8000, 11025, 22050, 44100, 48000, -1 }; // The keyboard mouse speed values range from 0 to 7 and correspond to speeds shown in the label // "10" (value 3) is the default speed corresponding to the speed before introduction of this control static const char *kbdMouseSpeedLabels[] = { "3", "5", "8", "10", "13", "15", "18", "20", 0 }; @@ -167,8 +165,6 @@ void OptionsDialog::init() { _midiPopUpDesc = 0; _oplPopUp = 0; _oplPopUpDesc = 0; - _outputRatePopUp = 0; - _outputRatePopUpDesc = 0; _enableMIDISettings = false; _gmDevicePopUp = 0; _gmDevicePopUpDesc = 0; @@ -335,15 +331,6 @@ void OptionsDialog::build() { _oplPopUp->setSelectedTag(id); } - if (_outputRatePopUp) { - _outputRatePopUp->setSelected(1); - int value = ConfMan.getInt("output_rate", _domain); - for (int i = 0; outputRateLabels[i]; i++) { - if (value == outputRateValues[i]) - _outputRatePopUp->setSelected(i); - } - } - if (_multiMidiCheckbox) { if (!loadMusicDeviceSetting(_gmDevicePopUp, "gm_device")) _gmDevicePopUp->setSelected(0); @@ -641,17 +628,6 @@ void OptionsDialog::apply() { } } - if (_outputRatePopUp) { - if (_enableAudioSettings) { - if (_outputRatePopUp->getSelectedTag() != 0) - ConfMan.setInt("output_rate", _outputRatePopUp->getSelectedTag(), _domain); - else - ConfMan.removeKey("output_rate", _domain); - } else { - ConfMan.removeKey("output_rate", _domain); - } - } - // MIDI options if (_multiMidiCheckbox) { if (_enableMIDISettings) { @@ -860,8 +836,6 @@ void OptionsDialog::setAudioSettingsState(bool enabled) { _oplPopUpDesc->setEnabled(enabled); _oplPopUp->setEnabled(enabled); } - _outputRatePopUpDesc->setEnabled(enabled); - _outputRatePopUp->setEnabled(enabled); } void OptionsDialog::setMIDISettingsState(bool enabled) { @@ -1096,14 +1070,6 @@ void OptionsDialog::addAudioControls(GuiObject *boss, const Common::String &pref ++ed; } - // Sample rate settings - _outputRatePopUpDesc = new StaticTextWidget(boss, prefix + "auSampleRatePopupDesc", _("Output rate:"), _("Higher value specifies better sound quality but may be not supported by your soundcard")); - _outputRatePopUp = new PopUpWidget(boss, prefix + "auSampleRatePopup", _("Higher value specifies better sound quality but may be not supported by your soundcard")); - - for (int i = 0; outputRateLabels[i]; i++) { - _outputRatePopUp->appendEntry(_(outputRateLabels[i]), outputRateValues[i]); - } - _enableAudioSettings = true; } diff --git a/gui/options.h b/gui/options.h index ed07307f80..b1666c2fff 100644 --- a/gui/options.h +++ b/gui/options.h @@ -159,8 +159,6 @@ private: PopUpWidget *_midiPopUp; StaticTextWidget *_oplPopUpDesc; PopUpWidget *_oplPopUp; - StaticTextWidget *_outputRatePopUpDesc; - PopUpWidget *_outputRatePopUp; StaticTextWidget *_mt32DevicePopUpDesc; PopUpWidget *_mt32DevicePopUp; diff --git a/gui/themes/default.inc b/gui/themes/default.inc index 23488a8cd0..fe48acd1a0 100644 --- a/gui/themes/default.inc +++ b/gui/themes/default.inc @@ -907,14 +907,6 @@ const char *defaultXML1 = "<?xml version = '1.0'?>" "type='PopUp' " "/>" "</layout>" -"<layout type='horizontal' padding='0,0,0,0' spacing='10' center='true'>" -"<widget name='auSampleRatePopupDesc' " -"type='OptionsLabel' " -"/>" -"<widget name='auSampleRatePopup' " -"type='PopUp' " -"/>" -"</layout>" "<layout type='horizontal' padding='0,0,0,0' spacing='10'>" "<widget name='subToggleDesc' " "type='OptionsLabel' " @@ -2496,14 +2488,6 @@ const char *defaultXML1 = "<?xml version = '1.0'?>" "type='PopUp' " "/>" "</layout>" -"<layout type='horizontal' padding='0,0,0,0' spacing='6' center='true'>" -"<widget name='auSampleRatePopupDesc' " -"type='OptionsLabel' " -"/>" -"<widget name='auSampleRatePopup' " -"type='PopUp' " -"/>" -"</layout>" "<layout type='horizontal' padding='0,0,0,0' spacing='3' center='true'>" "<widget name='subToggleDesc' " "type='OptionsLabel' " diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip Binary files differindex acb6d20a99..4f7e3ce68d 100644 --- a/gui/themes/scummclassic.zip +++ b/gui/themes/scummclassic.zip diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx index 2bb07d914c..e3411dcb3e 100644 --- a/gui/themes/scummclassic/classic_layout.stx +++ b/gui/themes/scummclassic/classic_layout.stx @@ -335,14 +335,6 @@ type = 'PopUp' /> </layout> - <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> - <widget name = 'auSampleRatePopupDesc' - type = 'OptionsLabel' - /> - <widget name = 'auSampleRatePopup' - type = 'PopUp' - /> - </layout> <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10'> <widget name = 'subToggleDesc' type = 'OptionsLabel' diff --git a/gui/themes/scummclassic/classic_layout_lowres.stx b/gui/themes/scummclassic/classic_layout_lowres.stx index d0c3170d8e..4b710b8999 100644 --- a/gui/themes/scummclassic/classic_layout_lowres.stx +++ b/gui/themes/scummclassic/classic_layout_lowres.stx @@ -332,14 +332,6 @@ type = 'PopUp' /> </layout> - <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' center = 'true'> - <widget name = 'auSampleRatePopupDesc' - type = 'OptionsLabel' - /> - <widget name = 'auSampleRatePopup' - type = 'PopUp' - /> - </layout> <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '3' center = 'true'> <widget name = 'subToggleDesc' type = 'OptionsLabel' diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip Binary files differindex 055c82ad3c..fae746b72c 100644 --- a/gui/themes/scummmodern.zip +++ b/gui/themes/scummmodern.zip diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx index 0a1c377aea..34b66e2274 100644 --- a/gui/themes/scummmodern/scummmodern_layout.stx +++ b/gui/themes/scummmodern/scummmodern_layout.stx @@ -349,14 +349,6 @@ type = 'PopUp' /> </layout> - <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10' center = 'true'> - <widget name = 'auSampleRatePopupDesc' - type = 'OptionsLabel' - /> - <widget name = 'auSampleRatePopup' - type = 'PopUp' - /> - </layout> <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '10'> <widget name = 'subToggleDesc' type = 'OptionsLabel' diff --git a/gui/themes/scummmodern/scummmodern_layout_lowres.stx b/gui/themes/scummmodern/scummmodern_layout_lowres.stx index 3da8a6c6a3..506a97520e 100644 --- a/gui/themes/scummmodern/scummmodern_layout_lowres.stx +++ b/gui/themes/scummmodern/scummmodern_layout_lowres.stx @@ -330,14 +330,6 @@ type = 'PopUp' /> </layout> - <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '6' center = 'true'> - <widget name = 'auSampleRatePopupDesc' - type = 'OptionsLabel' - /> - <widget name = 'auSampleRatePopup' - type = 'PopUp' - /> - </layout> <layout type = 'horizontal' padding = '0, 0, 0, 0' spacing = '3' center = 'true'> <widget name = 'subToggleDesc' type = 'OptionsLabel' |