diff options
author | Eugene Sandulenko | 2007-03-10 13:39:38 +0000 |
---|---|---|
committer | Eugene Sandulenko | 2007-03-10 13:39:38 +0000 |
commit | 5577379ac3d163c62d319a80f6749c9342401a01 (patch) | |
tree | 0a56af1e976c7757b8adb268f682206c55526b8e /gui/options.cpp | |
parent | 669c34d8c280650fc07871b8556119c57a83ccda (diff) | |
download | scummvm-rg350-5577379ac3d163c62d319a80f6749c9342401a01.tar.gz scummvm-rg350-5577379ac3d163c62d319a80f6749c9342401a01.tar.bz2 scummvm-rg350-5577379ac3d163c62d319a80f6749c9342401a01.zip |
Implement FR #1559561: "GUI: output sample rate widgets"
svn-id: r26056
Diffstat (limited to 'gui/options.cpp')
-rw-r--r-- | gui/options.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/gui/options.cpp b/gui/options.cpp index 1d32662c8d..3ad861de7b 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -63,6 +63,8 @@ enum { static const char *savePeriodLabels[] = { "Never", "every 5 mins", "every 10 mins", "every 15 mins", "every 30 mins", 0 }; static const int savePeriodValues[] = { 0, 5 * 60, 10 * 60, 15 * 60, 30 * 60, -1 }; +static const char *outputRateLabels[] = { "Default", "22 kHz", "8 kHz", "11kHz", "44 kHz", "48 kHz", 0 }; +static const int outputRateValues[] = { 0, 22050, 8000, 11025, 44100, 48000, -1 }; @@ -90,6 +92,7 @@ void OptionsDialog::init() { _aspectCheckbox = 0; _enableAudioSettings = false; _midiPopUp = 0; + _outputRatePopUp = 0; _enableMIDISettings = false; _multiMidiCheckbox = 0; _mt32Checkbox = 0; @@ -173,6 +176,15 @@ void OptionsDialog::open() { _midiPopUp->setSelected(md->name ? i : 0); } + 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) { // Multi midi setting @@ -298,6 +310,17 @@ void OptionsDialog::close() { } } + 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) { @@ -424,6 +447,7 @@ void OptionsDialog::setAudioSettingsState(bool enabled) { _enableAudioSettings = enabled; _midiPopUp->setEnabled(enabled); + _outputRatePopUp->setEnabled(enabled); } void OptionsDialog::setMIDISettingsState(bool enabled) { @@ -521,6 +545,13 @@ void OptionsDialog::addAudioControls(GuiObject *boss, const String &prefix) { md++; } + // Sample rate settings + _outputRatePopUp = new PopUpWidget(boss, prefix + "auSampleRatePopup", "Output rate: ", labelWidth); + + for (int i = 0; outputRateLabels[i]; i++) { + _outputRatePopUp->appendEntry(outputRateLabels[i], outputRateValues[i]); + } + _enableAudioSettings = true; } @@ -612,6 +643,8 @@ void OptionsDialog::reflowLayout() { if (_midiPopUp) _midiPopUp->changeLabelWidth(labelWidth); + if (_outputRatePopUp) + _outputRatePopUp->changeLabelWidth(labelWidth); if (_gfxPopUp) _gfxPopUp->changeLabelWidth(labelWidth); if (_renderModePopUp) @@ -764,10 +797,14 @@ void GlobalOptionsDialog::close() { String themePath(_themePath->getLabel()); if (!themePath.empty() && (themePath != "None")) ConfMan.set("themepath", themePath, _domain); + else + ConfMan.removeKey("themepath", _domain); String extraPath(_extraPath->getLabel()); if (!extraPath.empty() && (extraPath != "None")) ConfMan.set("extrapath", extraPath, _domain); + else + ConfMan.removeKey("extrapath", _domain); ConfMan.setInt("autosave_period", _autosavePeriodPopUp->getSelectedTag(), _domain); } |