| 1 | // Copyright 2017 Dolphin Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | |
| 4 | #include "DolphinQt/Settings/AudioPane.h" |
| 5 | |
| 6 | #include <string> |
| 7 | #include <utility> |
| 8 | #include <vector> |
| 9 | |
| 10 | #include <QFontMetrics> |
| 11 | #include <QFormLayout> |
| 12 | #include <QGridLayout> |
| 13 | #include <QGroupBox> |
| 14 | #include <QHBoxLayout> |
| 15 | #include <QLabel> |
| 16 | #include <QRadioButton> |
| 17 | #include <QSpacerItem> |
| 18 | #include <QString> |
| 19 | #include <QVBoxLayout> |
| 20 | #include <QWidget> |
| 21 | |
| 22 | #include "AudioCommon/AudioCommon.h" |
| 23 | #include "AudioCommon/WASAPIStream.h" |
| 24 | |
| 25 | #ifdef HAVE_CUBEB |
| 26 | #include "AudioCommon/CubebUtils.h" |
| 27 | #endif |
| 28 | |
| 29 | #include "Core/Config/MainSettings.h" |
| 30 | #include "Core/Config/WiimoteSettings.h" |
| 31 | #include "Core/Core.h" |
| 32 | #include "Core/HW/Wiimote.h" |
| 33 | #include "Core/System.h" |
| 34 | #include "DolphinQt/Config/ConfigControls/ConfigBool.h" |
| 35 | #include "DolphinQt/Config/ConfigControls/ConfigChoice.h" |
| 36 | #include "DolphinQt/Config/ConfigControls/ConfigSlider.h" |
| 37 | |
| 38 | #include "DolphinQt/Settings.h" |
| 39 | |
| 40 | static QString GetVolumeLabelText(int volume_level) |
| 41 | { |
| 42 | return QWidget::tr("%1%").arg(volume_level); |
| 43 | } |
| 44 | |
| 45 | AudioPane::AudioPane() |
| 46 | { |
| 47 | CheckNeedForLatencyControl(); |
| 48 | CreateWidgets(); |
| 49 | AddDescriptions(); |
| 50 | ConnectWidgets(); |
| 51 | OnBackendChanged(); |
| 52 | |
| 53 | connect(&Settings::Instance(), &Settings::EmulationStateChanged, this, [this](Core::State state) { |
| 54 | OnEmulationStateChanged(state != Core::State::Uninitialized); |
| 55 | }); |
| 56 | |
| 57 | OnEmulationStateChanged(!Core::IsUninitialized(Core::System::GetInstance())); |
| 58 | } |
| 59 | |
| 60 | void AudioPane::CreateWidgets() |
| 61 | { |
| 62 | auto* dsp_box = new QGroupBox(tr("DSP Options")); |
| 63 | auto* dsp_layout = new QHBoxLayout; |
| 64 | |
| 65 | dsp_box->setLayout(dsp_layout); |
| 66 | QLabel* dsp_combo_label = new QLabel(tr("DSP Emulation Engine:")); |
| 67 | m_dsp_combo = new ConfigComplexChoice(Config::MAIN_DSP_HLE, Config::MAIN_DSP_JIT); |
| 68 | m_dsp_combo->Add(tr("HLE (recommended)"), true, true); |
| 69 | m_dsp_combo->Add(tr("LLE Recompiler (slow)"), false, true); |
| 70 | m_dsp_combo->Add(tr("LLE Interpreter (very slow)"), false, false); |
| 71 | // The state true/false shouldn't normally happen, but is HLE (index 0) when it does. |
| 72 | m_dsp_combo->SetDefault(0); |
| 73 | m_dsp_combo->Refresh(); |
| 74 | |
| 75 | dsp_layout->addWidget(dsp_combo_label); |
| 76 | dsp_layout->addWidget(m_dsp_combo, Qt::AlignLeft); |
| 77 | |
| 78 | auto* volume_box = new QGroupBox(tr("Volume")); |
| 79 | auto* volume_layout = new QVBoxLayout{volume_box}; |
| 80 | |
| 81 | m_volume_slider = new ConfigSlider(0, 100, Config::MAIN_AUDIO_VOLUME); |
| 82 | m_volume_slider->setOrientation(Qt::Vertical); |
| 83 | |
| 84 | // Volume indicator text label. |
| 85 | m_volume_indicator = new QLabel; |
| 86 | m_volume_indicator->setAlignment(Qt::AlignVCenter | Qt::AlignHCenter); |
| 87 | auto update_volume_label = [this]() { |
| 88 | m_volume_indicator->setText(GetVolumeLabelText(m_volume_slider->value())); |
| 89 | }; |
| 90 | update_volume_label(); |
| 91 | connect(m_volume_slider, &QSlider::valueChanged, this, std::move(update_volume_label)); |
| 92 | |
| 93 | const QFontMetrics font_metrics{font()}; |
| 94 | const int label_width = font_metrics.boundingRect(GetVolumeLabelText(100)).width(); |
| 95 | // Ensure the label is at least as wide as the QGroupBox title. |
| 96 | // This prevents [-Volume] title ugliness on Windows. |
| 97 | const int title_width = font_metrics.boundingRect(volume_box->title()).width(); |
| 98 | m_volume_indicator->setFixedWidth(std::max(label_width, title_width)); |
| 99 | |
| 100 | volume_layout->addWidget(m_volume_slider, 0, Qt::AlignHCenter); |
| 101 | volume_layout->addWidget(m_volume_indicator, 0, Qt::AlignHCenter); |
| 102 | |
| 103 | auto* backend_box = new QGroupBox(tr("Backend Settings")); |
| 104 | auto* backend_layout = new QFormLayout; |
| 105 | backend_box->setLayout(backend_layout); |
| 106 | m_backend_label = new QLabel(tr("Audio Backend:")); |
| 107 | |
| 108 | { |
| 109 | std::vector<std::string> backends = AudioCommon::GetSoundBackends(); |
| 110 | std::vector<std::pair<QString, QString>> translated_backends; |
| 111 | translated_backends.reserve(backends.size()); |
| 112 | for (const std::string& backend : backends) |
| 113 | { |
| 114 | translated_backends.emplace_back(tr(backend.c_str()), QString::fromStdString(backend)); |
| 115 | } |
| 116 | m_backend_combo = new ConfigStringChoice(translated_backends, Config::MAIN_AUDIO_BACKEND); |
| 117 | } |
| 118 | |
| 119 | m_dolby_pro_logic = new ConfigBool(tr("Dolby Pro Logic II Decoder"), Config::MAIN_DPL2_DECODER); |
| 120 | m_dolby_quality_label = new QLabel(tr("Decoding Quality:")); |
| 121 | |
| 122 | QStringList quality_options{tr("Lowest (Latency ~10 ms)"), tr("Low (Latency ~20 ms)"), |
| 123 | tr("High (Latency ~40 ms)"), tr("Highest (Latency ~80 ms)")}; |
| 124 | |
| 125 | m_dolby_quality_combo = new ConfigChoice(quality_options, Config::MAIN_DPL2_QUALITY); |
| 126 | |
| 127 | backend_layout->setFormAlignment(Qt::AlignLeft | Qt::AlignTop); |
| 128 | backend_layout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow); |
| 129 | backend_layout->addRow(m_backend_label, m_backend_combo); |
| 130 | |
| 131 | #ifdef _WIN32 |
| 132 | std::vector<std::pair<QString, QString>> wasapi_options; |
| 133 | const auto default_device_config_value = |
| 134 | QString::fromStdString(Config::MAIN_WASAPI_DEVICE.GetDefaultValue()); |
| 135 | wasapi_options.emplace_back(tr("Default Device"), default_device_config_value); |
| 136 | |
| 137 | for (auto string : WASAPIStream::GetAvailableDevices()) |
| 138 | { |
| 139 | wasapi_options.push_back(std::pair<QString, QString>{QString::fromStdString(string), |
| 140 | QString::fromStdString(string)}); |
| 141 | } |
| 142 | |
| 143 | m_wasapi_device_label = new QLabel(tr("Output Device:")); |
| 144 | m_wasapi_device_combo = new ConfigStringChoice(wasapi_options, Config::MAIN_WASAPI_DEVICE); |
| 145 | |
| 146 | backend_layout->addRow(m_wasapi_device_label, m_wasapi_device_combo); |
| 147 | #endif |
| 148 | |
| 149 | if (m_latency_control_supported) |
| 150 | { |
| 151 | m_latency_slider = new ConfigSlider(0, 200, Config::MAIN_AUDIO_LATENCY); |
| 152 | m_latency_label = new QLabel(tr("Latency: %1 ms").arg(m_latency_slider->value())); |
| 153 | m_latency_label->setFixedWidth( |
| 154 | QFontMetrics(font()).boundingRect(tr("Latency: 000 ms")).width()); |
| 155 | |
| 156 | backend_layout->addRow(m_latency_label, m_latency_slider); |
| 157 | } |
| 158 | |
| 159 | backend_layout->addRow(m_dolby_pro_logic); |
| 160 | backend_layout->addRow(m_dolby_quality_label, m_dolby_quality_combo); |
| 161 | |
| 162 | dsp_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
| 163 | |
| 164 | auto* playback_box = new QGroupBox(tr("Audio Playback Settings")); |
| 165 | auto* playback_layout = new QGridLayout; |
| 166 | playback_box->setLayout(playback_layout); |
| 167 | |
| 168 | ConfigSlider* audio_buffer_size = new ConfigSlider(16, 512, Config::MAIN_AUDIO_BUFFER_SIZE, 8); |
| 169 | QLabel* audio_buffer_size_label = new QLabel; |
| 170 | |
| 171 | audio_buffer_size->setSingleStep(8); |
| 172 | audio_buffer_size->setPageStep(8); |
| 173 | |
| 174 | audio_buffer_size->SetDescription( |
| 175 | tr("Controls the number of audio samples buffered." |
| 176 | " Lower values reduce latency but may cause more crackling or stuttering." |
| 177 | "<br><br><dolphin_emphasis>If unsure, set this to 80 ms.</dolphin_emphasis>")); |
| 178 | |
| 179 | // Connect the slider to update the value label live |
| 180 | connect(audio_buffer_size, &QSlider::valueChanged, this, [=](int value) { |
| 181 | int stepped_value = (value / 8) * 8; |
| 182 | audio_buffer_size->setValue(stepped_value); |
| 183 | audio_buffer_size_label->setText(tr("%1 ms").arg(stepped_value)); |
| 184 | }); |
| 185 | |
| 186 | // Set initial value display |
| 187 | audio_buffer_size_label->setText(tr("%1 ms").arg(audio_buffer_size->value())); |
| 188 | audio_buffer_size_label->setFixedWidth(QFontMetrics(font()).boundingRect(tr(" 000 ms")).width()); |
| 189 | |
| 190 | m_audio_fill_gaps = new ConfigBool(tr("Fill Audio Gaps"), Config::MAIN_AUDIO_FILL_GAPS); |
| 191 | |
| 192 | m_audio_preserve_pitch = |
| 193 | new ConfigBool(tr("Preserve Audio Pitch"), Config::MAIN_AUDIO_PRESERVE_PITCH); |
| 194 | |
| 195 | m_speed_up_mute_enable = new ConfigBool(tr("Mute When Disabling Speed Limit"), |
| 196 | Config::MAIN_AUDIO_MUTE_ON_DISABLED_SPEED_LIMIT); |
| 197 | |
| 198 | // Create a horizontal layout for the slider + value label |
| 199 | auto* buffer_layout = new QHBoxLayout; |
| 200 | buffer_layout->addWidget(new ConfigSliderLabel(tr("Audio Buffer Size:"), audio_buffer_size)); |
| 201 | buffer_layout->addWidget(audio_buffer_size); |
| 202 | buffer_layout->addWidget(audio_buffer_size_label); |
| 203 | |
| 204 | playback_layout->addLayout(buffer_layout, 0, 0); |
| 205 | playback_layout->addWidget(m_audio_fill_gaps, 1, 0); |
| 206 | playback_layout->addWidget(m_audio_preserve_pitch, 2, 0); |
| 207 | playback_layout->addWidget(m_speed_up_mute_enable, 3, 0); |
| 208 | playback_layout->setRowStretch(4, 1); |
| 209 | playback_box->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
| 210 | |
| 211 | // Wiimote Audio Routing |
| 212 | #ifdef HAVE_CUBEB |
| 213 | m_wiimote_routing_box = new QGroupBox(tr("Wii Remote Audio Routing")); |
| 214 | auto* wiimote_routing_layout = new QVBoxLayout; |
| 215 | m_wiimote_routing_box->setLayout(wiimote_routing_layout); |
| 216 | |
| 217 | m_wiimote_routing_enable = new ConfigBool(tr("Enable Wii Remote Audio Routing"), |
| 218 | Config::MAIN_WIIMOTE_AUDIO_ROUTING_ENABLED); |
| 219 | wiimote_routing_layout->addWidget(m_wiimote_routing_enable); |
| 220 | |
| 221 | // Build device list once for all wiimote dropdowns |
| 222 | std::vector<std::pair<QString, QString>> output_devices; |
| 223 | output_devices.emplace_back(tr("Default Device"), QStringLiteral("")); |
| 224 | for (const auto& [id, name] : CubebUtils::ListOutputDevices()) |
| 225 | output_devices.emplace_back(QString::fromStdString(name), QString::fromStdString(id)); |
| 226 | |
| 227 | for (std::size_t i = 0; i < 4; ++i) |
| 228 | { |
| 229 | auto* row_widget = new QWidget; |
| 230 | auto* row_layout = new QHBoxLayout(row_widget); |
| 231 | row_layout->setContentsMargins(0, 0, 0, 0); |
| 232 | |
| 233 | m_wiimote_output_enable[i] = new ConfigBool(tr("Wii Remote %1").arg(i + 1), |
| 234 | Config::MAIN_WIIMOTE_AUDIO_OUTPUT_ENABLED[i]); |
| 235 | m_wiimote_output_device[i] = |
| 236 | new ConfigStringChoice(output_devices, Config::MAIN_WIIMOTE_AUDIO_OUTPUT_DEVICE[i]); |
| 237 | |
| 238 | row_layout->addWidget(m_wiimote_output_enable[i]); |
| 239 | row_layout->addWidget(m_wiimote_output_device[i], 1); |
| 240 | |
| 241 | wiimote_routing_layout->addWidget(row_widget); |
| 242 | } |
| 243 | #endif |
| 244 | |
| 245 | auto* const main_vbox_layout = new QVBoxLayout; |
| 246 | |
| 247 | main_vbox_layout->addWidget(dsp_box); |
| 248 | main_vbox_layout->addWidget(backend_box); |
| 249 | main_vbox_layout->addWidget(playback_box); |
| 250 | #ifdef HAVE_CUBEB |
| 251 | main_vbox_layout->addWidget(m_wiimote_routing_box); |
| 252 | #endif |
| 253 | |
| 254 | m_main_layout = new QHBoxLayout; |
| 255 | m_main_layout->addLayout(main_vbox_layout); |
| 256 | m_main_layout->addWidget(volume_box); |
| 257 | |
| 258 | setLayout(m_main_layout); |
| 259 | setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); |
| 260 | } |
| 261 | |
| 262 | void AudioPane::ConnectWidgets() |
| 263 | { |
| 264 | connect(m_backend_combo, &QComboBox::currentIndexChanged, this, &AudioPane::OnBackendChanged); |
| 265 | connect(m_dolby_pro_logic, &ConfigBool::toggled, this, &AudioPane::OnDspChanged); |
| 266 | connect(m_dsp_combo, &ConfigComplexChoice::currentIndexChanged, this, &AudioPane::OnDspChanged); |
| 267 | connect(m_volume_slider, &QSlider::valueChanged, this, |
| 268 | [] { AudioCommon::UpdateSoundStream(Core::System::GetInstance()); }); |
| 269 | |
| 270 | if (m_latency_control_supported) |
| 271 | { |
| 272 | connect(m_latency_slider, &QSlider::valueChanged, this, |
| 273 | [this](int value) { m_latency_label->setText(tr("Latency: %1 ms").arg(value)); }); |
| 274 | } |
| 275 | |
| 276 | #ifdef HAVE_CUBEB |
| 277 | connect(m_wiimote_routing_enable, &ConfigBool::toggled, this, |
| 278 | [this](bool) { UpdateWiimoteRoutingEnabled(); }); |
| 279 | for (std::size_t i = 0; i < 4; ++i) |
| 280 | { |
| 281 | connect(m_wiimote_output_enable[i], &ConfigBool::toggled, this, |
| 282 | [this](bool) { UpdateWiimoteRoutingEnabled(); }); |
| 283 | } |
| 284 | // Also react to external config changes: wiimote source type, speaker data, BT passthrough. |
| 285 | connect(&Settings::Instance(), &Settings::ConfigChanged, this, |
| 286 | &AudioPane::UpdateWiimoteRoutingEnabled); |
| 287 | UpdateWiimoteRoutingEnabled(); |
| 288 | #endif |
| 289 | } |
| 290 | |
| 291 | void AudioPane::OnDspChanged() |
| 292 | { |
| 293 | const auto backend = Config::Get(Config::MAIN_AUDIO_BACKEND); |
| 294 | const bool enabled = |
| 295 | AudioCommon::SupportsDPL2Decoder(backend) && !Config::Get(Config::MAIN_DSP_HLE); |
| 296 | m_dolby_pro_logic->setEnabled(enabled); |
| 297 | m_dolby_quality_label->setEnabled(enabled && m_dolby_pro_logic->isChecked()); |
| 298 | m_dolby_quality_combo->setEnabled(enabled && m_dolby_pro_logic->isChecked()); |
| 299 | } |
| 300 | |
| 301 | void AudioPane::OnBackendChanged() |
| 302 | { |
| 303 | OnDspChanged(); |
| 304 | |
| 305 | const auto backend = Config::Get(Config::MAIN_AUDIO_BACKEND); |
| 306 | |
| 307 | if (m_latency_control_supported) |
| 308 | { |
| 309 | m_latency_label->setEnabled(AudioCommon::SupportsLatencyControl(backend)); |
| 310 | m_latency_slider->setEnabled(AudioCommon::SupportsLatencyControl(backend)); |
| 311 | } |
| 312 | |
| 313 | #ifdef _WIN32 |
| 314 | bool is_wasapi = backend == BACKEND_WASAPI; |
| 315 | m_wasapi_device_label->setHidden(!is_wasapi); |
| 316 | m_wasapi_device_combo->setHidden(!is_wasapi); |
| 317 | #endif |
| 318 | |
| 319 | m_volume_slider->setEnabled(AudioCommon::SupportsVolumeChanges(backend)); |
| 320 | m_volume_indicator->setEnabled(AudioCommon::SupportsVolumeChanges(backend)); |
| 321 | |
| 322 | #ifdef HAVE_CUBEB |
| 323 | UpdateWiimoteRoutingEnabled(); |
| 324 | #endif |
| 325 | } |
| 326 | |
| 327 | void AudioPane::OnEmulationStateChanged(bool running) |
| 328 | { |
| 329 | m_dsp_combo->setEnabled(!running); |
| 330 | m_backend_label->setEnabled(!running); |
| 331 | m_backend_combo->setEnabled(!running); |
| 332 | if (AudioCommon::SupportsDPL2Decoder(Config::Get(Config::MAIN_AUDIO_BACKEND)) && |
| 333 | !Config::Get(Config::MAIN_DSP_HLE)) |
| 334 | { |
| 335 | m_dolby_pro_logic->setEnabled(!running); |
| 336 | m_dolby_quality_label->setEnabled(!running && m_dolby_pro_logic->isChecked()); |
| 337 | m_dolby_quality_combo->setEnabled(!running && m_dolby_pro_logic->isChecked()); |
| 338 | } |
| 339 | if (m_latency_control_supported && |
| 340 | AudioCommon::SupportsLatencyControl(Config::Get(Config::MAIN_AUDIO_BACKEND))) |
| 341 | { |
| 342 | m_latency_label->setEnabled(!running); |
| 343 | m_latency_slider->setEnabled(!running); |
| 344 | } |
| 345 | |
| 346 | #ifdef _WIN32 |
| 347 | m_wasapi_device_combo->setEnabled(!running); |
| 348 | #endif |
| 349 | |
| 350 | #ifdef HAVE_CUBEB |
| 351 | UpdateWiimoteRoutingEnabled(); |
| 352 | #endif |
| 353 | } |
| 354 | |
| 355 | void AudioPane::UpdateWiimoteRoutingEnabled() |
| 356 | { |
| 357 | #ifdef HAVE_CUBEB |
| 358 | if (!m_wiimote_routing_box) |
| 359 | return; |
| 360 | |
| 361 | const bool running = Core::GetState(Core::System::GetInstance()) != Core::State::Uninitialized; |
| 362 | const bool is_cubeb = Config::Get(Config::MAIN_AUDIO_BACKEND) == BACKEND_CUBEB; |
| 363 | const bool speaker_enabled = Config::Get(Config::MAIN_WIIMOTE_ENABLE_SPEAKER); |
| 364 | const bool bt_passthrough = Config::Get(Config::MAIN_BLUETOOTH_PASSTHROUGH_ENABLED); |
| 365 | |
| 366 | // The entire group requires Cubeb backend, speaker data enabled, no BT passthrough, and |
| 367 | // emulation not running. |
| 368 | const bool group_usable = !running && is_cubeb && speaker_enabled && !bt_passthrough; |
| 369 | |
| 370 | m_wiimote_routing_enable->setEnabled(group_usable); |
| 371 | |
| 372 | const bool routing_on = group_usable && m_wiimote_routing_enable->isChecked(); |
| 373 | |
| 374 | for (std::size_t i = 0; i < 4; ++i) |
| 375 | { |
| 376 | const WiimoteSource source = Config::Get(Config::GetInfoForWiimoteSource(static_cast<int>(i))); |
| 377 | const bool is_emulated = source == WiimoteSource::Emulated; |
| 378 | |
| 379 | m_wiimote_output_enable[i]->setEnabled(routing_on && is_emulated); |
| 380 | m_wiimote_output_device[i]->setEnabled(routing_on && is_emulated && |
| 381 | m_wiimote_output_enable[i]->isChecked()); |
| 382 | } |
| 383 | #endif |
| 384 | } |
| 385 | |
| 386 | void AudioPane::CheckNeedForLatencyControl() |
| 387 | { |
| 388 | std::vector<std::string> backends = AudioCommon::GetSoundBackends(); |
| 389 | m_latency_control_supported = std::ranges::any_of(backends, AudioCommon::SupportsLatencyControl); |
| 390 | } |
| 391 | |
| 392 | void AudioPane::AddDescriptions() |
| 393 | { |
| 394 | static const char TR_DSP_DESCRIPTION[] = QT_TR_NOOP( |
| 395 | "Selects how the Digital Signal Processor (DSP) is emulated. Determines how the audio is " |
| 396 | "processed and what system features are available.<br><br>" |
| 397 | "<b>HLE</b> - High Level Emulation of the DSP. Fast, but not always accurate. Lacks Dolby " |
| 398 | "Pro Logic II decoding.<br><br>" |
| 399 | "<b>LLE Recompiler</b> - Low Level Emulation of the DSP, via a recompiler. Slower, but more " |
| 400 | "accurate. Enables Dolby Pro Logic II decoding on certain audio backends.<br><br>" |
| 401 | "<b>LLE Interpreter</b> - Low Level Emulation of the DSP, via an interpreter. Slowest, for " |
| 402 | "debugging purposes only. Not recommended.<br><br><dolphin_emphasis>If unsure, select " |
| 403 | "HLE.</dolphin_emphasis>"); |
| 404 | static const char TR_AUDIO_BACKEND_DESCRIPTION[] = |
| 405 | QT_TR_NOOP("Selects which audio API to use internally.<br><br><dolphin_emphasis>If unsure, " |
| 406 | "select %1.</dolphin_emphasis>"); |
| 407 | static const char TR_LATENCY_SLIDER_DESCRIPTION[] = QT_TR_NOOP( |
| 408 | "Sets the audio latency in milliseconds. Higher values may reduce audio crackling. Certain " |
| 409 | "backends only.<br><br><dolphin_emphasis>If unsure, leave this at 20 ms.</dolphin_emphasis>"); |
| 410 | static const char TR_DOLBY_DESCRIPTION[] = |
| 411 | QT_TR_NOOP("Enables Dolby Pro Logic II emulation using 5.1 surround. Certain backends only. " |
| 412 | "<br><br><dolphin_emphasis>If unsure, leave this unchecked.</dolphin_emphasis>"); |
| 413 | static const char TR_DOLBY_OPTIONS_DESCRIPTION[] = QT_TR_NOOP( |
| 414 | "Adjusts the quality setting of the Dolby Pro Logic II decoder. Higher presets increases " |
| 415 | "audio latency.<br><br><dolphin_emphasis>If unsure, select High.</dolphin_emphasis>"); |
| 416 | static const char TR_VOLUME_DESCRIPTION[] = |
| 417 | QT_TR_NOOP("Adjusts audio output volume.<br><br><dolphin_emphasis>If unsure, leave this at " |
| 418 | "100%.</dolphin_emphasis>"); |
| 419 | static const char TR_FILL_AUDIO_GAPS_DESCRIPTION[] = QT_TR_NOOP( |
| 420 | "Repeat existing audio during lag spikes to prevent stuttering.<br><br><dolphin_emphasis>If " |
| 421 | "unsure, leave this checked.</dolphin_emphasis>"); |
| 422 | static const char TR_PRESERVE_AUDIO_PITCH_DESCRIPTION[] = QT_TR_NOOP( |
| 423 | "Keeps audio at normal pitch when changing emulation speed. Without this, audio pitch " |
| 424 | "changes proportionally with speed.<br><br><dolphin_emphasis>If unsure, leave this " |
| 425 | "unchecked.</dolphin_emphasis>"); |
| 426 | static const char TR_SPEED_UP_MUTE_DESCRIPTION[] = |
| 427 | QT_TR_NOOP("Mutes the audio when overriding the emulation speed limit (default hotkey: Tab). " |
| 428 | "<br><br><dolphin_emphasis>If unsure, leave this unchecked.</dolphin_emphasis>"); |
| 429 | |
| 430 | m_dsp_combo->SetTitle(tr("DSP Emulation Engine")); |
| 431 | m_dsp_combo->SetDescription(tr(TR_DSP_DESCRIPTION)); |
| 432 | |
| 433 | m_backend_combo->SetTitle(tr("Audio Backend")); |
| 434 | m_backend_combo->SetDescription( |
| 435 | tr(TR_AUDIO_BACKEND_DESCRIPTION) |
| 436 | .arg(QString::fromStdString(AudioCommon::GetDefaultSoundBackend()))); |
| 437 | |
| 438 | m_dolby_pro_logic->SetTitle(tr("Dolby Pro Logic II Decoder")); |
| 439 | m_dolby_pro_logic->SetDescription(tr(TR_DOLBY_DESCRIPTION)); |
| 440 | |
| 441 | m_dolby_quality_combo->SetTitle(tr("Decoding Quality")); |
| 442 | m_dolby_quality_combo->SetDescription(tr(TR_DOLBY_OPTIONS_DESCRIPTION)); |
| 443 | |
| 444 | #ifdef _WIN32 |
| 445 | static const char TR_WASAPI_DEVICE_DESCRIPTION[] = |
| 446 | QT_TR_NOOP("Selects an output device to use.<br><br><dolphin_emphasis>If unsure, select " |
| 447 | "Default Device.</dolphin_emphasis>"); |
| 448 | m_wasapi_device_combo->SetTitle(tr("Output Device")); |
| 449 | m_wasapi_device_combo->SetDescription(tr(TR_WASAPI_DEVICE_DESCRIPTION)); |
| 450 | #endif |
| 451 | |
| 452 | m_volume_slider->SetTitle(tr("Volume")); |
| 453 | m_volume_slider->SetDescription(tr(TR_VOLUME_DESCRIPTION)); |
| 454 | |
| 455 | if (m_latency_control_supported) |
| 456 | { |
| 457 | m_latency_slider->SetTitle(tr("Latency")); |
| 458 | m_latency_slider->SetDescription(tr(TR_LATENCY_SLIDER_DESCRIPTION)); |
| 459 | } |
| 460 | |
| 461 | m_speed_up_mute_enable->SetTitle(tr("Mute When Disabling Speed Limit")); |
| 462 | m_speed_up_mute_enable->SetDescription(tr(TR_SPEED_UP_MUTE_DESCRIPTION)); |
| 463 | |
| 464 | m_audio_fill_gaps->SetTitle(tr("Fill Audio Gaps")); |
| 465 | m_audio_fill_gaps->SetDescription(tr(TR_FILL_AUDIO_GAPS_DESCRIPTION)); |
| 466 | |
| 467 | m_audio_preserve_pitch->SetTitle(tr("Preserve Audio Pitch")); |
| 468 | m_audio_preserve_pitch->SetDescription(tr(TR_PRESERVE_AUDIO_PITCH_DESCRIPTION)); |
| 469 | |
| 470 | #ifdef HAVE_CUBEB |
| 471 | static const char TR_WIIMOTE_ROUTING_DESCRIPTION[] = |
| 472 | QT_TR_NOOP("Routes each Wii Remote's speaker audio to a separate audio output device. " |
| 473 | "This setting cannot be changed while emulation is active." |
| 474 | "<br><br>This setting is disabled when Enable Speaker Data is disabled, " |
| 475 | "Passthrough a Bluetooth adapter is selected, or an audio backend other than " |
| 476 | "Cubeb is selected." |
| 477 | "<br><br><dolphin_emphasis>If unsure, leave this unchecked.</dolphin_emphasis>"); |
| 478 | static const char TR_WIIMOTE_OUTPUT_ENABLE_DESCRIPTION[] = |
| 479 | QT_TR_NOOP("Enables routing this Wii Remote's speaker audio to a separate output device."); |
| 480 | static const char TR_WIIMOTE_OUTPUT_DEVICE_DESCRIPTION[] = |
| 481 | QT_TR_NOOP("Selects the audio output device for this Wii Remote's speaker audio." |
| 482 | "<br><br>This setting is disabled when this Wii Remote is not set to Emulated " |
| 483 | "Wii Remote."); |
| 484 | |
| 485 | if (m_wiimote_routing_box) |
| 486 | { |
| 487 | m_wiimote_routing_enable->SetTitle(tr("Enable Wii Remote Audio Routing")); |
| 488 | m_wiimote_routing_enable->SetDescription(tr(TR_WIIMOTE_ROUTING_DESCRIPTION)); |
| 489 | for (std::size_t i = 0; i < 4; ++i) |
| 490 | { |
| 491 | m_wiimote_output_enable[i]->SetDescription(tr(TR_WIIMOTE_OUTPUT_ENABLE_DESCRIPTION)); |
| 492 | m_wiimote_output_device[i]->SetTitle(tr("Wii Remote %1").arg(i + 1)); |
| 493 | m_wiimote_output_device[i]->SetDescription(tr(TR_WIIMOTE_OUTPUT_DEVICE_DESCRIPTION)); |
| 494 | } |
| 495 | } |
| 496 | #endif |
| 497 | } |