mirror of
				https://git.zaroz.cloud/nintendo-back-up/yuzu/yuzu-mainline.git
				synced 2025-03-21 01:53:15 +00:00 
			
		
		
		
	configure_audio: User-configuratble option to enable/disable audio stretching
This commit is contained in:
		
							parent
							
								
									904a319694
								
							
						
					
					
						commit
						dc3f6a34f8
					
				@ -78,6 +78,7 @@ void Config::ReadValues() {
 | 
			
		||||
 | 
			
		||||
    // Audio
 | 
			
		||||
    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
 | 
			
		||||
    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)
 | 
			
		||||
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]
 | 
			
		||||
# Whether to create a virtual SD card.
 | 
			
		||||
# 1 (default): Yes, 0: No
 | 
			
		||||
 | 
			
		||||
@ -56,6 +56,7 @@ void Config::ReadValues() {
 | 
			
		||||
 | 
			
		||||
    qt_config->beginGroup("Audio");
 | 
			
		||||
    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->beginGroup("Data Storage");
 | 
			
		||||
@ -148,6 +149,7 @@ void Config::SaveValues() {
 | 
			
		||||
 | 
			
		||||
    qt_config->beginGroup("Audio");
 | 
			
		||||
    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->beginGroup("Data Storage");
 | 
			
		||||
 | 
			
		||||
@ -36,9 +36,12 @@ void ConfigureAudio::setConfiguration() {
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    ui->output_sink_combo_box->setCurrentIndex(new_sink_index);
 | 
			
		||||
 | 
			
		||||
    ui->toggle_audio_stretching->setChecked(Settings::values.enable_audio_stretching);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void ConfigureAudio::applyConfiguration() {
 | 
			
		||||
    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();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -25,6 +25,16 @@
 | 
			
		||||
        </item>
 | 
			
		||||
       </layout>
 | 
			
		||||
      </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>
 | 
			
		||||
    </widget>
 | 
			
		||||
   </item>
 | 
			
		||||
 | 
			
		||||
@ -24,6 +24,7 @@ void Apply() {
 | 
			
		||||
    VideoCore::g_scaled_resolution_enabled = values.use_scaled_resolution;
 | 
			
		||||
 | 
			
		||||
    AudioCore::SelectSink(values.sink_id);
 | 
			
		||||
    AudioCore::EnableStretching(values.enable_audio_stretching);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -81,6 +81,7 @@ struct Values {
 | 
			
		||||
 | 
			
		||||
    // Audio
 | 
			
		||||
    std::string sink_id;
 | 
			
		||||
    bool enable_audio_stretching;
 | 
			
		||||
 | 
			
		||||
    // Debugging
 | 
			
		||||
    bool use_gdbstub;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user