Qt: add master volume slider to the audio tab

This commit is contained in:
Megamouse 2018-10-20 10:11:47 +02:00
parent db40cbda58
commit da5385686c
4 changed files with 54 additions and 7 deletions

View File

@ -4,7 +4,8 @@
"audioOutBox_Linux": "PulseAudio uses the recommended native Linux sound system and has good compatibility and sound quality. If it is unavailable on your system, ALSA is the next best alternative. \nOpenAL uses a cross-platform approach but will have poor audio quality and stuttering sound in most games.",
"audioDump": "Saves all audio as a raw wave file. If unsure, leave this unchecked.",
"convert": "Uses 16-bit audio samples instead of default 32-bit floating point.\nUse with buggy audio drivers if you have no sound or completely broken sound.",
"downmix": "Uses stereo audio output instead of default 7.1 surround sound.\nUse with stereo audio devices. Disable it only if you are using a surround sound audio system."
"downmix": "Uses stereo audio output instead of default 7.1 surround sound.\nUse with stereo audio devices. Disable it only if you are using a surround sound audio system.",
"masterVolume": "Controls the overall volume of the emulation."
},
"cpu": {
"PPU": {

View File

@ -100,6 +100,7 @@ public:
DumpToFile,
ConvertTo16Bit,
DownmixStereo,
MasterVolume,
// Input / Output
PadHandler,
@ -300,6 +301,7 @@ private:
{ DumpToFile, { "Audio", "Dump to file"}},
{ ConvertTo16Bit, { "Audio", "Convert to 16 bit"}},
{ DownmixStereo, { "Audio", "Downmix to Stereo"}},
{ MasterVolume, { "Audio", "Master Volume"}},
// Input / Output
{ PadHandler, { "Input/Output", "Pad"}},

View File

@ -722,6 +722,16 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
xemu_settings->EnhanceCheckBox(ui->downmix, emu_settings::DownmixStereo);
SubscribeTooltip(ui->downmix, json_audio["downmix"].toString());
// Sliders
xemu_settings->EnhanceSlider(ui->masterVolume, emu_settings::MasterVolume);
SubscribeTooltip(ui->masterVolume, json_audio["masterVolume"].toString());
ui->masterVolumeLabel->setText(tr("Master: %0%").arg(ui->masterVolume->value()));
connect(ui->masterVolume, &QSlider::valueChanged, [this](int value)
{
ui->masterVolumeLabel->setText(tr("Master: %0%").arg(value));
});
// _____ __ ____ _______ _
// |_ _| / / / __ \ |__ __| | |
// | | / / | | | | | | __ _| |__

View File

@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>703</width>
<height>499</height>
<width>752</width>
<height>576</height>
</rect>
</property>
<property name="sizePolicy">
@ -783,7 +783,7 @@
<attribute name="title">
<string>Audio</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_26">
<layout class="QVBoxLayout" name="verticalLayout_26" stretch="0,1,0">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_9" stretch="1,1,1">
<item>
@ -836,15 +836,49 @@
</layout>
</item>
<item>
<widget class="QWidget" name="widget_8" native="true"/>
<layout class="QVBoxLayout" name="verticalLayout_37">
<item>
<widget class="QGroupBox" name="groupBox_6">
<property name="title">
<string>Volume</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_74">
<item>
<widget class="QLabel" name="masterVolumeLabel">
<property name="text">
<string>Master: 0%</string>
</property>
</widget>
</item>
<item>
<widget class="QSlider" name="masterVolume">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::MinimumExpanding</enum>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QWidget" name="widget_2" native="true"/>
<layout class="QVBoxLayout" name="verticalLayout_71"/>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_6">
<spacer name="verticalSpacer_19">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>