mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-31 05:40:04 +00:00 
			
		
		
		
	configure_audio: User-configuratble option to enable/disable audio stretching
This commit is contained in:
		
							parent
							
								
									904a319694
								
							
						
					
					
						commit
						dc3f6a34f8
					
				
					 7 changed files with 24 additions and 0 deletions
				
			
		|  | @ -78,6 +78,7 @@ void Config::ReadValues() { | ||||||
| 
 | 
 | ||||||
|     // Audio
 |     // Audio
 | ||||||
|     Settings::values.sink_id = sdl2_config->Get("Audio", "output_engine", "auto"); |     Settings::values.sink_id = sdl2_config->Get("Audio", "output_engine", "auto"); | ||||||
|  |     Settings::values.enable_audio_stretching = sdl2_config->GetBoolean("Audio", "enable_audio_stretching", true); | ||||||
| 
 | 
 | ||||||
|     // Data Storage
 |     // Data Storage
 | ||||||
|     Settings::values.use_virtual_sd = sdl2_config->GetBoolean("Data Storage", "use_virtual_sd", true); |     Settings::values.use_virtual_sd = sdl2_config->GetBoolean("Data Storage", "use_virtual_sd", true); | ||||||
|  |  | ||||||
|  | @ -66,6 +66,12 @@ bg_green = | ||||||
| # auto (default): Auto-select, null: No audio output, sdl2: SDL2 (if available) | # auto (default): Auto-select, null: No audio output, sdl2: SDL2 (if available) | ||||||
| output_engine = | output_engine = | ||||||
| 
 | 
 | ||||||
|  | # Whether or not to enable the audio-stretching post-processing effect. | ||||||
|  | # This effect adjusts audio speed to match emulation speed and helps prevent audio stutter, | ||||||
|  | # at the cost of increasing audio latency. | ||||||
|  | # 0: No, 1 (default): Yes | ||||||
|  | enable_audio_stretching = | ||||||
|  | 
 | ||||||
| [Data Storage] | [Data Storage] | ||||||
| # Whether to create a virtual SD card. | # Whether to create a virtual SD card. | ||||||
| # 1 (default): Yes, 0: No | # 1 (default): Yes, 0: No | ||||||
|  |  | ||||||
|  | @ -56,6 +56,7 @@ void Config::ReadValues() { | ||||||
| 
 | 
 | ||||||
|     qt_config->beginGroup("Audio"); |     qt_config->beginGroup("Audio"); | ||||||
|     Settings::values.sink_id = qt_config->value("output_engine", "auto").toString().toStdString(); |     Settings::values.sink_id = qt_config->value("output_engine", "auto").toString().toStdString(); | ||||||
|  |     Settings::values.enable_audio_stretching = qt_config->value("enable_audio_stretching", true).toBool(); | ||||||
|     qt_config->endGroup(); |     qt_config->endGroup(); | ||||||
| 
 | 
 | ||||||
|     qt_config->beginGroup("Data Storage"); |     qt_config->beginGroup("Data Storage"); | ||||||
|  | @ -148,6 +149,7 @@ void Config::SaveValues() { | ||||||
| 
 | 
 | ||||||
|     qt_config->beginGroup("Audio"); |     qt_config->beginGroup("Audio"); | ||||||
|     qt_config->setValue("output_engine", QString::fromStdString(Settings::values.sink_id)); |     qt_config->setValue("output_engine", QString::fromStdString(Settings::values.sink_id)); | ||||||
|  |     qt_config->setValue("enable_audio_stretching", Settings::values.enable_audio_stretching); | ||||||
|     qt_config->endGroup(); |     qt_config->endGroup(); | ||||||
| 
 | 
 | ||||||
|     qt_config->beginGroup("Data Storage"); |     qt_config->beginGroup("Data Storage"); | ||||||
|  |  | ||||||
|  | @ -36,9 +36,12 @@ void ConfigureAudio::setConfiguration() { | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     ui->output_sink_combo_box->setCurrentIndex(new_sink_index); |     ui->output_sink_combo_box->setCurrentIndex(new_sink_index); | ||||||
|  | 
 | ||||||
|  |     ui->toggle_audio_stretching->setChecked(Settings::values.enable_audio_stretching); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ConfigureAudio::applyConfiguration() { | void ConfigureAudio::applyConfiguration() { | ||||||
|     Settings::values.sink_id = ui->output_sink_combo_box->itemText(ui->output_sink_combo_box->currentIndex()).toStdString(); |     Settings::values.sink_id = ui->output_sink_combo_box->itemText(ui->output_sink_combo_box->currentIndex()).toStdString(); | ||||||
|  |     Settings::values.enable_audio_stretching = ui->toggle_audio_stretching->isChecked(); | ||||||
|     Settings::Apply(); |     Settings::Apply(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -25,6 +25,16 @@ | ||||||
|         </item> |         </item> | ||||||
|        </layout> |        </layout> | ||||||
|       </item> |       </item> | ||||||
|  |       <item> | ||||||
|  |        <widget class="QCheckBox" name="toggle_audio_stretching"> | ||||||
|  |         <property name="text"> | ||||||
|  |          <string>Enable audio stretching</string> | ||||||
|  |         </property> | ||||||
|  |         <property name="toolTip"> | ||||||
|  |          <string>This post-processing effect adjusts audio speed to match emulation speed and helps prevent audio stutter. This however increases audio latency.</string> | ||||||
|  |         </property> | ||||||
|  |        </widget> | ||||||
|  |       </item> | ||||||
|      </layout> |      </layout> | ||||||
|     </widget> |     </widget> | ||||||
|    </item> |    </item> | ||||||
|  |  | ||||||
|  | @ -24,6 +24,7 @@ void Apply() { | ||||||
|     VideoCore::g_scaled_resolution_enabled = values.use_scaled_resolution; |     VideoCore::g_scaled_resolution_enabled = values.use_scaled_resolution; | ||||||
| 
 | 
 | ||||||
|     AudioCore::SelectSink(values.sink_id); |     AudioCore::SelectSink(values.sink_id); | ||||||
|  |     AudioCore::EnableStretching(values.enable_audio_stretching); | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -81,6 +81,7 @@ struct Values { | ||||||
| 
 | 
 | ||||||
|     // Audio
 |     // Audio
 | ||||||
|     std::string sink_id; |     std::string sink_id; | ||||||
|  |     bool enable_audio_stretching; | ||||||
| 
 | 
 | ||||||
|     // Debugging
 |     // Debugging
 | ||||||
|     bool use_gdbstub; |     bool use_gdbstub; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue