mirror of https://github.com/stella-emu/stella.git
preliminary audio dialog changes
This commit is contained in:
parent
cf8f76a0e1
commit
adbde4e4db
|
@ -70,6 +70,7 @@ Settings::Settings(OSystem& osystem)
|
||||||
|
|
||||||
// Sound options
|
// Sound options
|
||||||
setInternal("sound", "true");
|
setInternal("sound", "true");
|
||||||
|
setInternal("aud.mode", "balanced");
|
||||||
setInternal("fragsize", "512");
|
setInternal("fragsize", "512");
|
||||||
setInternal("freq", "44100");
|
setInternal("freq", "44100");
|
||||||
setInternal("volume", "100");
|
setInternal("volume", "100");
|
||||||
|
|
|
@ -44,14 +44,14 @@ AudioDialog::AudioDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
fontWidth = font.getMaxCharWidth(),
|
fontWidth = font.getMaxCharWidth(),
|
||||||
fontHeight = font.getFontHeight();
|
fontHeight = font.getFontHeight();
|
||||||
int xpos, ypos;
|
int xpos, ypos;
|
||||||
int lwidth = font.getStringWidth("Sample Size (*) "),
|
int lwidth = font.getStringWidth("Resampling quality "),
|
||||||
pwidth = font.getStringWidth("512 bytes");
|
pwidth = font.getStringWidth("512 bytes");
|
||||||
WidgetArray wid;
|
WidgetArray wid;
|
||||||
VariantList items;
|
VariantList items;
|
||||||
|
|
||||||
// Set real dimensions
|
// Set real dimensions
|
||||||
_w = 35 * fontWidth + HBORDER * 2;
|
_w = 35 * fontWidth + HBORDER * 2;
|
||||||
_h = 7 * (lineHeight + 4) + VBORDER + _th;
|
_h = 11 * (lineHeight + 4) + VBORDER + _th;
|
||||||
|
|
||||||
xpos = HBORDER; ypos = VBORDER + _th;
|
xpos = HBORDER; ypos = VBORDER + _th;
|
||||||
|
|
||||||
|
@ -64,13 +64,26 @@ AudioDialog::AudioDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
xpos += INDENT;
|
xpos += INDENT;
|
||||||
|
|
||||||
// Volume
|
// Volume
|
||||||
myVolumeSlider = new SliderWidget(this, font, xpos, ypos, 11 * fontWidth + 5, lineHeight,
|
myVolumeSlider = new SliderWidget(this, font, xpos, ypos,
|
||||||
"Volume ", lwidth, 0, 4 * fontWidth, "%");
|
"Volume ", 0, 0, 4 * fontWidth, "%");
|
||||||
myVolumeSlider->setMinValue(1); myVolumeSlider->setMaxValue(100);
|
myVolumeSlider->setMinValue(1); myVolumeSlider->setMaxValue(100);
|
||||||
wid.push_back(myVolumeSlider);
|
wid.push_back(myVolumeSlider);
|
||||||
ypos += lineHeight + 4;
|
ypos += lineHeight + 4;
|
||||||
|
|
||||||
|
//
|
||||||
|
VarList::push_back(items, "Minimal Lag", "minlag");
|
||||||
|
VarList::push_back(items, "Balanced", "balanced");
|
||||||
|
VarList::push_back(items, "Max. Quality", "maxquality");
|
||||||
|
VarList::push_back(items, "Custom", "Custom");
|
||||||
|
myModePopup = new PopUpWidget(this, font, xpos, ypos,
|
||||||
|
font.getStringWidth("Max. Quality"), lineHeight,
|
||||||
|
items, "Mode (*) ", 0, kModeChanged);
|
||||||
|
wid.push_back(myModePopup);
|
||||||
|
ypos += lineHeight + 4;
|
||||||
|
xpos += INDENT;
|
||||||
|
|
||||||
// Fragment size
|
// Fragment size
|
||||||
|
items.clear();
|
||||||
VarList::push_back(items, "128 bytes", "128");
|
VarList::push_back(items, "128 bytes", "128");
|
||||||
VarList::push_back(items, "256 bytes", "256");
|
VarList::push_back(items, "256 bytes", "256");
|
||||||
VarList::push_back(items, "512 bytes", "512");
|
VarList::push_back(items, "512 bytes", "512");
|
||||||
|
@ -92,13 +105,39 @@ AudioDialog::AudioDialog(OSystem& osystem, DialogContainer& parent,
|
||||||
pwidth, lineHeight,
|
pwidth, lineHeight,
|
||||||
items, "Frequency (*) ", lwidth);
|
items, "Frequency (*) ", lwidth);
|
||||||
wid.push_back(myFreqPopup);
|
wid.push_back(myFreqPopup);
|
||||||
|
ypos += lineHeight + 4;
|
||||||
|
|
||||||
|
|
||||||
|
// Resampling quality
|
||||||
|
items.clear();
|
||||||
|
VarList::push_back(items, "Low", "low");
|
||||||
|
VarList::push_back(items, "Medium", "medium");
|
||||||
|
VarList::push_back(items, "High", "high");
|
||||||
|
myResamplingPopup = new PopUpWidget(this, font, xpos, ypos,
|
||||||
|
pwidth, lineHeight,
|
||||||
|
items, "Resampling quality ", lwidth);
|
||||||
|
wid.push_back(myResamplingPopup);
|
||||||
|
ypos += lineHeight + 4;
|
||||||
|
|
||||||
|
// Param 1
|
||||||
|
myHeadroomSlider = new SliderWidget(this, font, xpos, ypos,
|
||||||
|
"Headroom ");
|
||||||
|
myHeadroomSlider->setMinValue(1); myHeadroomSlider->setMaxValue(10);
|
||||||
|
wid.push_back(myHeadroomSlider);
|
||||||
|
ypos += lineHeight + 4;
|
||||||
|
|
||||||
|
// Param 2
|
||||||
|
myBufferSizeSlider = new SliderWidget(this, font, xpos, ypos,
|
||||||
|
"Buffer size ");
|
||||||
|
myBufferSizeSlider->setMinValue(1); myBufferSizeSlider->setMaxValue(10);
|
||||||
|
wid.push_back(myBufferSizeSlider);
|
||||||
|
|
||||||
// Add message concerning usage
|
// Add message concerning usage
|
||||||
ypos = _h - fontHeight * 2 - 24;
|
ypos = _h - fontHeight * 2 - 24;
|
||||||
const GUI::Font& infofont = instance().frameBuffer().infoFont();
|
const GUI::Font& infofont = instance().frameBuffer().infoFont();
|
||||||
new StaticTextWidget(this, infofont, HBORDER, ypos,
|
new StaticTextWidget(this, infofont, HBORDER, ypos, "(*) Requires application restart");/* ,
|
||||||
font.getStringWidth("(*) Requires application restart"), fontHeight,
|
font.getStringWidth("(*) Requires application restart"), fontHeight,
|
||||||
"(*) Requires application restart", TextAlign::Left);
|
"(*) Requires application restart", TextAlign::Left);*/
|
||||||
|
|
||||||
// Add Defaults, OK and Cancel buttons
|
// Add Defaults, OK and Cancel buttons
|
||||||
addDefaultsOKCancelBGroup(wid, font);
|
addDefaultsOKCancelBGroup(wid, font);
|
||||||
|
@ -170,10 +209,23 @@ void AudioDialog::setDefaults()
|
||||||
void AudioDialog::handleSoundEnableChange(bool active)
|
void AudioDialog::handleSoundEnableChange(bool active)
|
||||||
{
|
{
|
||||||
myVolumeSlider->setEnabled(active);
|
myVolumeSlider->setEnabled(active);
|
||||||
myFragsizePopup->setEnabled(active);
|
myModePopup->setEnabled(active);
|
||||||
myFreqPopup->setEnabled(active);
|
handleModeChange(active);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void AudioDialog::handleModeChange(bool active)
|
||||||
|
{
|
||||||
|
bool userMode = active && "Custom" == myModePopup->getSelectedName();
|
||||||
|
|
||||||
|
myFragsizePopup->setEnabled(userMode);
|
||||||
|
myFreqPopup->setEnabled(userMode);
|
||||||
|
myResamplingPopup->setEnabled(userMode);
|
||||||
|
myHeadroomSlider->setEnabled(userMode);
|
||||||
|
myBufferSizeSlider->setEnabled(userMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void AudioDialog::handleCommand(CommandSender* sender, int cmd,
|
void AudioDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
int data, int id)
|
int data, int id)
|
||||||
|
@ -193,6 +245,10 @@ void AudioDialog::handleCommand(CommandSender* sender, int cmd,
|
||||||
handleSoundEnableChange(data == 1);
|
handleSoundEnableChange(data == 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case kModeChanged:
|
||||||
|
handleModeChange(true);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Dialog::handleCommand(sender, cmd, data, 0);
|
Dialog::handleCommand(sender, cmd, data, 0);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -41,17 +41,23 @@ class AudioDialog : public Dialog
|
||||||
void setDefaults() override;
|
void setDefaults() override;
|
||||||
|
|
||||||
void handleSoundEnableChange(bool active);
|
void handleSoundEnableChange(bool active);
|
||||||
|
void handleModeChange(bool active);
|
||||||
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
void handleCommand(CommandSender* sender, int cmd, int data, int id) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum {
|
enum {
|
||||||
kSoundEnableChanged = 'ADse'
|
kSoundEnableChanged = 'ADse',
|
||||||
|
kModeChanged = 'ADmc'
|
||||||
};
|
};
|
||||||
|
|
||||||
|
CheckboxWidget* mySoundEnableCheckbox;
|
||||||
SliderWidget* myVolumeSlider;
|
SliderWidget* myVolumeSlider;
|
||||||
|
PopUpWidget* myModePopup;
|
||||||
PopUpWidget* myFragsizePopup;
|
PopUpWidget* myFragsizePopup;
|
||||||
PopUpWidget* myFreqPopup;
|
PopUpWidget* myFreqPopup;
|
||||||
CheckboxWidget* mySoundEnableCheckbox;
|
PopUpWidget* myResamplingPopup;
|
||||||
|
SliderWidget* myHeadroomSlider;
|
||||||
|
SliderWidget* myBufferSizeSlider;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Following constructors and assignment operators not supported
|
// Following constructors and assignment operators not supported
|
||||||
|
|
Loading…
Reference in New Issue