diff --git a/docs/graphics/options_audio.png b/docs/graphics/options_audio.png index e54e9bc75..0055a67b0 100644 Binary files a/docs/graphics/options_audio.png and b/docs/graphics/options_audio.png differ diff --git a/src/common/AudioSettings.cxx b/src/common/AudioSettings.cxx index 7af42eb32..155b2ee42 100644 --- a/src/common/AudioSettings.cxx +++ b/src/common/AudioSettings.cxx @@ -141,10 +141,10 @@ AudioSettings::ResamplingQuality AudioSettings::resamplingQuality() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -string AudioSettings::stereo() const +bool AudioSettings::stereo() const { // 0 is a valid value -> keep it - return mySettings.getString(SETTING_STEREO); + return mySettings.getBool(SETTING_STEREO); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -255,11 +255,11 @@ void AudioSettings::setResamplingQuality(AudioSettings::ResamplingQuality resamp } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void AudioSettings::setStereo(const string& mode) +void AudioSettings::setStereo(bool allROMs) { if(!myIsPersistent) return; - mySettings.setValue(SETTING_STEREO, mode); + mySettings.setValue(SETTING_STEREO, allROMs); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/common/AudioSettings.hxx b/src/common/AudioSettings.hxx index c9efaa8fc..0092dc904 100644 --- a/src/common/AudioSettings.hxx +++ b/src/common/AudioSettings.hxx @@ -56,7 +56,7 @@ class AudioSettings static constexpr uInt32 DEFAULT_BUFFER_SIZE = 3; static constexpr uInt32 DEFAULT_HEADROOM = 2; static constexpr ResamplingQuality DEFAULT_RESAMPLING_QUALITY = ResamplingQuality::lanczos_2; - static constexpr const char* DEFAULT_STEREO = "byrom"; + static constexpr bool DEFAULT_STEREO = false; static constexpr uInt32 DEFAULT_VOLUME = 80; static constexpr bool DEFAULT_ENABLED = true; @@ -81,7 +81,7 @@ class AudioSettings ResamplingQuality resamplingQuality(); - string stereo() const; + bool stereo() const; uInt32 volume() const; @@ -99,7 +99,7 @@ class AudioSettings void setResamplingQuality(ResamplingQuality resamplingQuality); - void setStereo(const string& mode); + void setStereo(bool allROMs); void setVolume(uInt32 volume); diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx index 019256d69..a75387803 100644 --- a/src/emucore/Console.cxx +++ b/src/emucore/Console.cxx @@ -544,13 +544,13 @@ void Console::togglePhosphor() { if(myOSystem.frameBuffer().tiaSurface().phosphorEnabled()) { - myProperties.set(Display_Phosphor, "No"); + myProperties.set(Display_Phosphor, "NO"); myOSystem.frameBuffer().tiaSurface().enablePhosphor(false); myOSystem.frameBuffer().showMessage("Phosphor effect disabled"); } else { - myProperties.set(Display_Phosphor, "Yes"); + myProperties.set(Display_Phosphor, "YES"); myOSystem.frameBuffer().tiaSurface().enablePhosphor(true); myOSystem.frameBuffer().showMessage("Phosphor effect enabled"); } @@ -812,12 +812,8 @@ void Console::setTIAProperties() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void Console::createAudioQueue() { - const string& stereo = myOSystem.settings().getString(AudioSettings::SETTING_STEREO); - bool useStereo = false; - if(BSPF::equalsIgnoreCase(stereo, "byrom")) - useStereo = myProperties.get(Cartridge_Sound) == "STEREO"; - else - useStereo = BSPF::equalsIgnoreCase(stereo, "stereo"); + bool useStereo = myOSystem.settings().getBool(AudioSettings::SETTING_STEREO) + || myProperties.get(Cartridge_Sound) == "STEREO"; myAudioQueue = make_shared( myEmulationTiming.audioFragmentSize(), diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx index 7852cc796..e36ae0d7f 100644 --- a/src/emucore/Settings.cxx +++ b/src/emucore/Settings.cxx @@ -444,8 +444,7 @@ void Settings::usage() const #ifdef SOUND_SUPPORT << " -audio.enabled <1|0> Enable audio\n" << " -audio.volume Vokume (0-100)\n" - << " -audio.stereo \n" + << " -audio.stereo <1|0> Enable stereo mode for all ROMs\n" << " -audio.preset <1-5> Audio preset (or 1 for custom)\n" << " -audio.sample_rate Output sample rate (44100|48000|96000)\n" << " -audio.fragment_size Fragment size (128|256|512|1024|\n" diff --git a/src/gui/AudioDialog.cxx b/src/gui/AudioDialog.cxx index 3abef70b1..09dc0cfe1 100644 --- a/src/gui/AudioDialog.cxx +++ b/src/gui/AudioDialog.cxx @@ -72,18 +72,6 @@ AudioDialog::AudioDialog(OSystem& osystem, DialogContainer& parent, wid.push_back(myVolumeSlider); ypos += lineHeight + VGAP; - // Stereo sound - VarList::push_back(items, "By ROM", "BYROM"); - VarList::push_back(items, "Off", "MONO"); - VarList::push_back(items, "On", "STEREO"); - pwidth = font.getStringWidth("By ROM"); - - myStereoSoundPopup = new PopUpWidget(this, font, xpos, ypos, - pwidth, lineHeight, - items, "Stereo", lwidth); - wid.push_back(myStereoSoundPopup); - ypos += lineHeight + VGAP; - // Mode items.clear(); VarList::push_back(items, "Low quality, medium lag", static_cast(AudioSettings::Preset::lowQualityMediumLag)); @@ -151,6 +139,13 @@ AudioDialog::AudioDialog(OSystem& osystem, DialogContainer& parent, myBufferSizeSlider->setMinValue(0); myBufferSizeSlider->setMaxValue(AudioSettings::MAX_BUFFER_SIZE); myBufferSizeSlider->setTickmarkInterval(5); wid.push_back(myBufferSizeSlider); + ypos += lineHeight + VGAP; + + // Stereo sound + xpos -= INDENT; + myStereoSoundCheckbox = new CheckboxWidget(this, font, xpos, ypos, + "Stereo for all ROMs"); + wid.push_back(myStereoSoundCheckbox); // Add Defaults, OK and Cancel buttons addDefaultsOKCancelBGroup(wid, font); @@ -170,7 +165,7 @@ void AudioDialog::loadConfig() myVolumeSlider->setValue(audioSettings.volume()); // Stereo - myStereoSoundPopup->setSelected(audioSettings.stereo()); + myStereoSoundCheckbox->setState(audioSettings.stereo()); // Preset / mode myModePopup->setSelected(static_cast(audioSettings.preset())); @@ -213,7 +208,7 @@ void AudioDialog::saveConfig() instance().sound().setVolume(myVolumeSlider->getValue()); // Stereo - audioSettings.setStereo(myStereoSoundPopup->getSelectedTag().toString()); + audioSettings.setStereo(myStereoSoundCheckbox->getState()); AudioSettings::Preset preset = static_cast(myModePopup->getSelectedTag().toInt()); audioSettings.setPreset(preset); @@ -238,7 +233,7 @@ void AudioDialog::setDefaults() { mySoundEnableCheckbox->setState(AudioSettings::DEFAULT_ENABLED); myVolumeSlider->setValue(AudioSettings::DEFAULT_VOLUME); - myStereoSoundPopup->setSelected(AudioSettings::DEFAULT_STEREO); + myStereoSoundCheckbox->setState(AudioSettings::DEFAULT_STEREO); myModePopup->setSelected(static_cast(AudioSettings::DEFAULT_PRESET)); if (AudioSettings::DEFAULT_PRESET == AudioSettings::Preset::custom) { @@ -261,7 +256,7 @@ void AudioDialog::updateEnabledState() bool userMode = preset == AudioSettings::Preset::custom; myVolumeSlider->setEnabled(active); - myStereoSoundPopup->setEnabled(active); + myStereoSoundCheckbox->setEnabled(active); myModePopup->setEnabled(active); myFragsizePopup->setEnabled(active && userMode); diff --git a/src/gui/AudioDialog.hxx b/src/gui/AudioDialog.hxx index f63f1d1f0..edc68bcf1 100644 --- a/src/gui/AudioDialog.hxx +++ b/src/gui/AudioDialog.hxx @@ -56,13 +56,13 @@ class AudioDialog : public Dialog CheckboxWidget* mySoundEnableCheckbox; SliderWidget* myVolumeSlider; + CheckboxWidget* myStereoSoundCheckbox; PopUpWidget* myModePopup; PopUpWidget* myFragsizePopup; PopUpWidget* myFreqPopup; PopUpWidget* myResamplingPopup; SliderWidget* myHeadroomSlider; SliderWidget* myBufferSizeSlider; - PopUpWidget* myStereoSoundPopup; private: // Following constructors and assignment operators not supported