mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-09 00:11:24 +12:00
Qt/settings: add new audio buffering options
This commit is contained in:
parent
48db0430d4
commit
5e3311746c
5 changed files with 144 additions and 7 deletions
|
@ -5,7 +5,11 @@
|
|||
"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.",
|
||||
"masterVolume": "Controls the overall volume of the emulation.\nValues above 100% might reduce the audio quality."
|
||||
"masterVolume": "Controls the overall volume of the emulation.\nValues above 100% might reduce the audio quality.",
|
||||
"enableBuffering": "Enables the new audio buffering features - if supported by the backend (XAudio2, OpenAL).",
|
||||
"audioBufferDuration": "Target buffer duration in milliseconds.\nHigher values make the algorithm's job easier, but may introduce noticeable audio latency.",
|
||||
"enableTimeStretching": "Enables time stretching - requires buffering to be enabled.\nReduces crackle/stutter further, but may cause a very noticeable reduction in audio quality on slower CPUs.",
|
||||
"timeStretchingThreshold": "Buffer fill level (in percentage) below which time stretching will start."
|
||||
},
|
||||
"cpu": {
|
||||
"PPU": {
|
||||
|
|
|
@ -102,6 +102,10 @@ public:
|
|||
ConvertTo16Bit,
|
||||
DownmixStereo,
|
||||
MasterVolume,
|
||||
EnableBuffering,
|
||||
AudioBufferDuration,
|
||||
EnableTimeStretching,
|
||||
TimeStretchingThreshold,
|
||||
|
||||
// Input / Output
|
||||
PadHandler,
|
||||
|
@ -306,6 +310,10 @@ private:
|
|||
{ ConvertTo16Bit, { "Audio", "Convert to 16 bit"}},
|
||||
{ DownmixStereo, { "Audio", "Downmix to Stereo"}},
|
||||
{ MasterVolume, { "Audio", "Master Volume"}},
|
||||
{ EnableBuffering, { "Audio", "Enable Buffering"}},
|
||||
{ AudioBufferDuration, { "Audio", "Desired Audio Buffer Duration"}},
|
||||
{ EnableTimeStretching, { "Audio", "Enable Time Stretching"}},
|
||||
{ TimeStretchingThreshold, { "Audio", "Time Stretching Threshold"}},
|
||||
|
||||
// Input / Output
|
||||
{ PadHandler, { "Input/Output", "Pad"}},
|
||||
|
|
|
@ -711,6 +711,25 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
|
|||
// / ____ \ |_| | (_| | | (_) | | | (_| | |_) |
|
||||
// /_/ \_\__,_|\__,_|_|\___/ |_|\__,_|_.__/
|
||||
|
||||
auto EnableTimeStretchingOptions = [this](bool enabled)
|
||||
{
|
||||
ui->timeStretchingThresholdLabel->setEnabled(enabled);
|
||||
ui->timeStretchingThreshold->setEnabled(enabled);
|
||||
};
|
||||
auto EnableBufferingOptions = [this, EnableTimeStretchingOptions](bool enabled)
|
||||
{
|
||||
ui->audioBufferDuration->setEnabled(enabled);
|
||||
ui->audioBufferDurationLabel->setEnabled(enabled);
|
||||
ui->enableTimeStretching->setEnabled(enabled);
|
||||
EnableTimeStretchingOptions(enabled && ui->enableTimeStretching->isChecked());
|
||||
};
|
||||
auto EnableBuffering = [this, EnableBufferingOptions](const QString& text)
|
||||
{
|
||||
const bool enabled = text == "XAudio2" || text == "OpenAL";
|
||||
ui->enableBuffering->setEnabled(enabled);
|
||||
EnableBufferingOptions(enabled && ui->enableBuffering->isChecked());
|
||||
};
|
||||
|
||||
// Comboboxes
|
||||
|
||||
xemu_settings->EnhanceComboBox(ui->audioOutBox, emu_settings::AudioRenderer);
|
||||
|
@ -721,6 +740,7 @@ settings_dialog::settings_dialog(std::shared_ptr<gui_settings> guiSettings, std:
|
|||
#endif
|
||||
// Change displayed backend names
|
||||
ui->audioOutBox->setItemText(ui->renderBox->findData("Null"), tr("Disable Audio Output"));
|
||||
connect(ui->audioOutBox, &QComboBox::currentTextChanged, EnableBuffering);
|
||||
|
||||
// Checkboxes
|
||||
|
||||
|
@ -733,11 +753,27 @@ 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());
|
||||
|
||||
xemu_settings->EnhanceCheckBox(ui->enableBuffering, emu_settings::EnableBuffering);
|
||||
SubscribeTooltip(ui->enableBuffering, json_audio["enableBuffering"].toString());
|
||||
connect(ui->enableBuffering, &QCheckBox::clicked, EnableBufferingOptions);
|
||||
|
||||
xemu_settings->EnhanceCheckBox(ui->enableTimeStretching, emu_settings::EnableTimeStretching);
|
||||
SubscribeTooltip(ui->enableTimeStretching, json_audio["enableTimeStretching"].toString());
|
||||
connect(ui->enableTimeStretching, &QCheckBox::clicked, EnableTimeStretchingOptions);
|
||||
|
||||
EnableBuffering(ui->audioOutBox->currentText());
|
||||
|
||||
// Sliders
|
||||
|
||||
EnhanceSlider(emu_settings::MasterVolume, ui->masterVolume, ui->masterVolumeLabel, tr("Master: %0 %"));
|
||||
SubscribeTooltip(ui->masterVolume, json_audio["masterVolume"].toString());
|
||||
|
||||
EnhanceSlider(emu_settings::AudioBufferDuration, ui->audioBufferDuration, ui->audioBufferDurationLabel, tr("Audio Buffer Duration: %0 ms"));
|
||||
SubscribeTooltip({ ui->audioBufferDuration, ui->audioBufferDurationLabel }, json_audio["audioBufferDuration"].toString());
|
||||
|
||||
EnhanceSlider(emu_settings::TimeStretchingThreshold, ui->timeStretchingThreshold, ui->timeStretchingThresholdLabel, tr("Time Stretching Threshold: %0 %"));
|
||||
SubscribeTooltip({ ui->timeStretchingThreshold, ui->timeStretchingThresholdLabel }, json_audio["timeStretchingThreshold"].toString());
|
||||
|
||||
// _____ __ ____ _______ _
|
||||
// |_ _| / / / __ \ |__ __| | |
|
||||
// | | / / | | | | | | __ _| |__
|
||||
|
@ -1435,6 +1471,14 @@ void settings_dialog::SubscribeTooltip(QObject* object, const QString& tooltip)
|
|||
object->installEventFilter(this);
|
||||
}
|
||||
|
||||
void settings_dialog::SubscribeTooltip(QList<QObject*> objects, const QString& tooltip)
|
||||
{
|
||||
for (auto obj : objects)
|
||||
{
|
||||
SubscribeTooltip(obj, tooltip);
|
||||
}
|
||||
}
|
||||
|
||||
// Thanks Dolphin
|
||||
bool settings_dialog::eventFilter(QObject* object, QEvent* event)
|
||||
{
|
||||
|
|
|
@ -58,5 +58,6 @@ private:
|
|||
QHash<QObject*, QString> m_descriptions;
|
||||
void SubscribeDescription(QLabel* description);
|
||||
void SubscribeTooltip(QObject* object, const QString& tooltip);
|
||||
void SubscribeTooltip(QList<QObject*> objects, const QString& tooltip);
|
||||
bool eventFilter(QObject* object, QEvent* event) override;
|
||||
};
|
||||
|
|
|
@ -823,6 +823,22 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::MinimumExpanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -878,7 +894,71 @@
|
|||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_71"/>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_71">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_8">
|
||||
<property name="title">
|
||||
<string>Buffering</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_75">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="enableBuffering">
|
||||
<property name="text">
|
||||
<string>Enable Buffering</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="audioBufferDurationLabel">
|
||||
<property name="text">
|
||||
<string>Audio Buffer Duration: 0ms</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="audioBufferDuration">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::TicksBelow</enum>
|
||||
</property>
|
||||
<property name="tickInterval">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="enableTimeStretching">
|
||||
<property name="text">
|
||||
<string>Enable Time Stretching</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="timeStretchingThresholdLabel">
|
||||
<property name="text">
|
||||
<string>Time Stretching Threshold: 0%</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSlider" name="timeStretchingThreshold">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="tickPosition">
|
||||
<enum>QSlider::TicksBelow</enum>
|
||||
</property>
|
||||
<property name="tickInterval">
|
||||
<number>10</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue