reworked Stereo for all ROMs setting in AudioDialog

This commit is contained in:
thrust26 2018-09-19 22:24:25 +02:00
parent 27956cff15
commit a6a762bbb4
7 changed files with 24 additions and 34 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@ -141,10 +141,10 @@ AudioSettings::ResamplingQuality AudioSettings::resamplingQuality()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string AudioSettings::stereo() const bool AudioSettings::stereo() const
{ {
// 0 is a valid value -> keep it // 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; if(!myIsPersistent) return;
mySettings.setValue(SETTING_STEREO, mode); mySettings.setValue(SETTING_STEREO, allROMs);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -56,7 +56,7 @@ class AudioSettings
static constexpr uInt32 DEFAULT_BUFFER_SIZE = 3; static constexpr uInt32 DEFAULT_BUFFER_SIZE = 3;
static constexpr uInt32 DEFAULT_HEADROOM = 2; static constexpr uInt32 DEFAULT_HEADROOM = 2;
static constexpr ResamplingQuality DEFAULT_RESAMPLING_QUALITY = ResamplingQuality::lanczos_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 uInt32 DEFAULT_VOLUME = 80;
static constexpr bool DEFAULT_ENABLED = true; static constexpr bool DEFAULT_ENABLED = true;
@ -81,7 +81,7 @@ class AudioSettings
ResamplingQuality resamplingQuality(); ResamplingQuality resamplingQuality();
string stereo() const; bool stereo() const;
uInt32 volume() const; uInt32 volume() const;
@ -99,7 +99,7 @@ class AudioSettings
void setResamplingQuality(ResamplingQuality resamplingQuality); void setResamplingQuality(ResamplingQuality resamplingQuality);
void setStereo(const string& mode); void setStereo(bool allROMs);
void setVolume(uInt32 volume); void setVolume(uInt32 volume);

View File

@ -544,13 +544,13 @@ void Console::togglePhosphor()
{ {
if(myOSystem.frameBuffer().tiaSurface().phosphorEnabled()) if(myOSystem.frameBuffer().tiaSurface().phosphorEnabled())
{ {
myProperties.set(Display_Phosphor, "No"); myProperties.set(Display_Phosphor, "NO");
myOSystem.frameBuffer().tiaSurface().enablePhosphor(false); myOSystem.frameBuffer().tiaSurface().enablePhosphor(false);
myOSystem.frameBuffer().showMessage("Phosphor effect disabled"); myOSystem.frameBuffer().showMessage("Phosphor effect disabled");
} }
else else
{ {
myProperties.set(Display_Phosphor, "Yes"); myProperties.set(Display_Phosphor, "YES");
myOSystem.frameBuffer().tiaSurface().enablePhosphor(true); myOSystem.frameBuffer().tiaSurface().enablePhosphor(true);
myOSystem.frameBuffer().showMessage("Phosphor effect enabled"); myOSystem.frameBuffer().showMessage("Phosphor effect enabled");
} }
@ -812,12 +812,8 @@ void Console::setTIAProperties()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::createAudioQueue() void Console::createAudioQueue()
{ {
const string& stereo = myOSystem.settings().getString(AudioSettings::SETTING_STEREO); bool useStereo = myOSystem.settings().getBool(AudioSettings::SETTING_STEREO)
bool useStereo = false; || myProperties.get(Cartridge_Sound) == "STEREO";
if(BSPF::equalsIgnoreCase(stereo, "byrom"))
useStereo = myProperties.get(Cartridge_Sound) == "STEREO";
else
useStereo = BSPF::equalsIgnoreCase(stereo, "stereo");
myAudioQueue = make_shared<AudioQueue>( myAudioQueue = make_shared<AudioQueue>(
myEmulationTiming.audioFragmentSize(), myEmulationTiming.audioFragmentSize(),

View File

@ -444,8 +444,7 @@ void Settings::usage() const
#ifdef SOUND_SUPPORT #ifdef SOUND_SUPPORT
<< " -audio.enabled <1|0> Enable audio\n" << " -audio.enabled <1|0> Enable audio\n"
<< " -audio.volume <number> Vokume (0-100)\n" << " -audio.volume <number> Vokume (0-100)\n"
<< " -audio.stereo <byrom|mono| Enable stereo mode\n" << " -audio.stereo <1|0> Enable stereo mode for all ROMs\n"
<< " stereo>\n"
<< " -audio.preset <1-5> Audio preset (or 1 for custom)\n" << " -audio.preset <1-5> Audio preset (or 1 for custom)\n"
<< " -audio.sample_rate <number> Output sample rate (44100|48000|96000)\n" << " -audio.sample_rate <number> Output sample rate (44100|48000|96000)\n"
<< " -audio.fragment_size <number> Fragment size (128|256|512|1024|\n" << " -audio.fragment_size <number> Fragment size (128|256|512|1024|\n"

View File

@ -72,18 +72,6 @@ AudioDialog::AudioDialog(OSystem& osystem, DialogContainer& parent,
wid.push_back(myVolumeSlider); wid.push_back(myVolumeSlider);
ypos += lineHeight + VGAP; 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 // Mode
items.clear(); items.clear();
VarList::push_back(items, "Low quality, medium lag", static_cast<int>(AudioSettings::Preset::lowQualityMediumLag)); VarList::push_back(items, "Low quality, medium lag", static_cast<int>(AudioSettings::Preset::lowQualityMediumLag));
@ -151,6 +139,13 @@ AudioDialog::AudioDialog(OSystem& osystem, DialogContainer& parent,
myBufferSizeSlider->setMinValue(0); myBufferSizeSlider->setMaxValue(AudioSettings::MAX_BUFFER_SIZE); myBufferSizeSlider->setMinValue(0); myBufferSizeSlider->setMaxValue(AudioSettings::MAX_BUFFER_SIZE);
myBufferSizeSlider->setTickmarkInterval(5); myBufferSizeSlider->setTickmarkInterval(5);
wid.push_back(myBufferSizeSlider); 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 // Add Defaults, OK and Cancel buttons
addDefaultsOKCancelBGroup(wid, font); addDefaultsOKCancelBGroup(wid, font);
@ -170,7 +165,7 @@ void AudioDialog::loadConfig()
myVolumeSlider->setValue(audioSettings.volume()); myVolumeSlider->setValue(audioSettings.volume());
// Stereo // Stereo
myStereoSoundPopup->setSelected(audioSettings.stereo()); myStereoSoundCheckbox->setState(audioSettings.stereo());
// Preset / mode // Preset / mode
myModePopup->setSelected(static_cast<int>(audioSettings.preset())); myModePopup->setSelected(static_cast<int>(audioSettings.preset()));
@ -213,7 +208,7 @@ void AudioDialog::saveConfig()
instance().sound().setVolume(myVolumeSlider->getValue()); instance().sound().setVolume(myVolumeSlider->getValue());
// Stereo // Stereo
audioSettings.setStereo(myStereoSoundPopup->getSelectedTag().toString()); audioSettings.setStereo(myStereoSoundCheckbox->getState());
AudioSettings::Preset preset = static_cast<AudioSettings::Preset>(myModePopup->getSelectedTag().toInt()); AudioSettings::Preset preset = static_cast<AudioSettings::Preset>(myModePopup->getSelectedTag().toInt());
audioSettings.setPreset(preset); audioSettings.setPreset(preset);
@ -238,7 +233,7 @@ void AudioDialog::setDefaults()
{ {
mySoundEnableCheckbox->setState(AudioSettings::DEFAULT_ENABLED); mySoundEnableCheckbox->setState(AudioSettings::DEFAULT_ENABLED);
myVolumeSlider->setValue(AudioSettings::DEFAULT_VOLUME); myVolumeSlider->setValue(AudioSettings::DEFAULT_VOLUME);
myStereoSoundPopup->setSelected(AudioSettings::DEFAULT_STEREO); myStereoSoundCheckbox->setState(AudioSettings::DEFAULT_STEREO);
myModePopup->setSelected(static_cast<int>(AudioSettings::DEFAULT_PRESET)); myModePopup->setSelected(static_cast<int>(AudioSettings::DEFAULT_PRESET));
if (AudioSettings::DEFAULT_PRESET == AudioSettings::Preset::custom) { if (AudioSettings::DEFAULT_PRESET == AudioSettings::Preset::custom) {
@ -261,7 +256,7 @@ void AudioDialog::updateEnabledState()
bool userMode = preset == AudioSettings::Preset::custom; bool userMode = preset == AudioSettings::Preset::custom;
myVolumeSlider->setEnabled(active); myVolumeSlider->setEnabled(active);
myStereoSoundPopup->setEnabled(active); myStereoSoundCheckbox->setEnabled(active);
myModePopup->setEnabled(active); myModePopup->setEnabled(active);
myFragsizePopup->setEnabled(active && userMode); myFragsizePopup->setEnabled(active && userMode);

View File

@ -56,13 +56,13 @@ class AudioDialog : public Dialog
CheckboxWidget* mySoundEnableCheckbox; CheckboxWidget* mySoundEnableCheckbox;
SliderWidget* myVolumeSlider; SliderWidget* myVolumeSlider;
CheckboxWidget* myStereoSoundCheckbox;
PopUpWidget* myModePopup; PopUpWidget* myModePopup;
PopUpWidget* myFragsizePopup; PopUpWidget* myFragsizePopup;
PopUpWidget* myFreqPopup; PopUpWidget* myFreqPopup;
PopUpWidget* myResamplingPopup; PopUpWidget* myResamplingPopup;
SliderWidget* myHeadroomSlider; SliderWidget* myHeadroomSlider;
SliderWidget* myBufferSizeSlider; SliderWidget* myBufferSizeSlider;
PopUpWidget* myStereoSoundPopup;
private: private:
// Following constructors and assignment operators not supported // Following constructors and assignment operators not supported