2023-12-22 11:57:49 +00:00
// SPDX-FileCopyrightText: 2002-2023 PCSX2 Dev Team
// SPDX-License-Identifier: LGPL-3.0+
2022-02-15 14:59:15 +00:00
# include <QtWidgets/QMessageBox>
# include <algorithm>
2022-09-29 13:52:11 +00:00
# include "pcsx2/SPU2/Global.h"
2022-12-30 07:17:40 +00:00
# include "pcsx2/SPU2/spu2.h"
# include "pcsx2/VMManager.h"
2022-09-29 13:52:11 +00:00
2022-02-15 14:59:15 +00:00
# include "AudioSettingsWidget.h"
2022-09-07 09:20:50 +00:00
# include "QtHost.h"
2022-02-15 14:59:15 +00:00
# include "QtUtils.h"
# include "SettingWidgetBinder.h"
2023-10-14 08:45:09 +00:00
# include "SettingsWindow.h"
2022-02-15 14:59:15 +00:00
2022-03-25 09:24:27 +00:00
static constexpr s32 DEFAULT_SYNCHRONIZATION_MODE = 0 ;
static constexpr s32 DEFAULT_EXPANSION_MODE = 0 ;
2022-08-14 01:23:52 +00:00
static constexpr s32 DEFAULT_DPL_DECODING_LEVEL = 0 ;
2022-03-25 09:24:27 +00:00
static const char * DEFAULT_OUTPUT_MODULE = " cubeb " ;
2023-01-11 16:04:52 +00:00
static constexpr s32 DEFAULT_TARGET_LATENCY = 60 ;
2022-12-30 07:39:41 +00:00
static constexpr s32 DEFAULT_OUTPUT_LATENCY = 20 ;
2022-03-25 09:24:27 +00:00
static constexpr s32 DEFAULT_VOLUME = 100 ;
static constexpr s32 DEFAULT_SOUNDTOUCH_SEQUENCE_LENGTH = 30 ;
static constexpr s32 DEFAULT_SOUNDTOUCH_SEEK_WINDOW = 20 ;
static constexpr s32 DEFAULT_SOUNDTOUCH_OVERLAP = 10 ;
2023-10-14 08:45:09 +00:00
AudioSettingsWidget : : AudioSettingsWidget ( SettingsWindow * dialog , QWidget * parent )
2022-02-15 14:59:15 +00:00
: QWidget ( parent )
2022-08-14 01:23:52 +00:00
, m_dialog ( dialog )
2022-02-15 14:59:15 +00:00
{
2022-03-25 09:24:27 +00:00
SettingsInterface * sif = dialog - > getSettingsInterface ( ) ;
2022-02-15 14:59:15 +00:00
m_ui . setupUi ( this ) ;
2023-06-26 11:24:46 +00:00
populateOutputModules ( ) ;
2022-03-25 09:24:27 +00:00
SettingWidgetBinder : : BindWidgetToIntSetting ( sif , m_ui . syncMode , " SPU2/Output " , " SynchMode " , DEFAULT_SYNCHRONIZATION_MODE ) ;
SettingWidgetBinder : : BindWidgetToIntSetting ( sif , m_ui . expansionMode , " SPU2/Output " , " SpeakerConfiguration " , DEFAULT_EXPANSION_MODE ) ;
2022-08-14 01:23:52 +00:00
SettingWidgetBinder : : BindWidgetToIntSetting ( sif , m_ui . dplLevel , " SPU2/Output " , " DplDecodingLevel " , DEFAULT_DPL_DECODING_LEVEL ) ;
2022-12-30 07:39:41 +00:00
connect ( m_ui . syncMode , QOverload < int > : : of ( & QComboBox : : currentIndexChanged ) , this , & AudioSettingsWidget : : updateTargetLatencyRange ) ;
2022-08-14 01:23:52 +00:00
connect ( m_ui . expansionMode , QOverload < int > : : of ( & QComboBox : : currentIndexChanged ) , this , & AudioSettingsWidget : : expansionModeChanged ) ;
2022-12-30 07:39:41 +00:00
updateTargetLatencyRange ( ) ;
2022-08-14 01:23:52 +00:00
expansionModeChanged ( ) ;
2022-03-25 09:24:27 +00:00
2023-06-26 11:24:46 +00:00
SettingWidgetBinder : : BindWidgetToStringSetting ( sif , m_ui . outputModule , " SPU2/Output " , " OutputModule " , DEFAULT_OUTPUT_MODULE ) ;
2024-04-24 13:53:21 +00:00
SettingWidgetBinder : : BindWidgetAndLabelToIntSetting (
2023-03-18 21:14:55 +00:00
//: Measuring unit that will appear after the number selected in its option. Adapt the space depending on your language's rules.
2023-01-01 12:46:07 +00:00
sif , m_ui . targetLatency , m_ui . targetLatencyLabel , tr ( " ms " ) , " SPU2/Output " , " Latency " , DEFAULT_TARGET_LATENCY ) ;
2024-04-24 13:53:21 +00:00
SettingWidgetBinder : : BindWidgetAndLabelToIntSetting (
2023-01-01 12:46:07 +00:00
sif , m_ui . outputLatency , m_ui . outputLatencyLabel , tr ( " ms " ) , " SPU2/Output " , " OutputLatency " , DEFAULT_OUTPUT_LATENCY ) ;
2022-12-30 07:39:41 +00:00
SettingWidgetBinder : : BindWidgetToBoolSetting ( sif , m_ui . outputLatencyMinimal , " SPU2/Output " , " OutputLatencyMinimal " , false ) ;
2022-09-29 13:52:11 +00:00
connect ( m_ui . outputModule , & QComboBox : : currentIndexChanged , this , & AudioSettingsWidget : : outputModuleChanged ) ;
connect ( m_ui . backend , & QComboBox : : currentIndexChanged , this , & AudioSettingsWidget : : outputBackendChanged ) ;
2022-12-30 07:39:41 +00:00
connect ( m_ui . targetLatency , & QSlider : : valueChanged , this , & AudioSettingsWidget : : updateLatencyLabels ) ;
connect ( m_ui . outputLatency , & QSlider : : valueChanged , this , & AudioSettingsWidget : : updateLatencyLabels ) ;
2024-04-12 12:22:58 +00:00
connect ( m_ui . outputLatencyMinimal , & QCheckBox : : checkStateChanged , this , & AudioSettingsWidget : : updateLatencyLabels ) ;
connect ( m_ui . outputLatencyMinimal , & QCheckBox : : checkStateChanged , this , & AudioSettingsWidget : : onMinimalOutputLatencyStateChanged ) ;
2022-09-29 13:52:11 +00:00
outputModuleChanged ( ) ;
2022-03-25 09:24:27 +00:00
2022-12-30 07:17:40 +00:00
m_ui . volume - > setValue ( m_dialog - > getEffectiveIntValue ( " SPU2/Mixing " , " FinalVolume " , DEFAULT_VOLUME ) ) ;
connect ( m_ui . volume , & QSlider : : valueChanged , this , & AudioSettingsWidget : : volumeChanged ) ;
2023-01-01 12:46:07 +00:00
updateVolumeLabel ( ) ;
2023-06-23 10:00:52 +00:00
if ( dialog - > isPerGameSettings ( ) )
2023-01-01 12:46:07 +00:00
{
2023-06-23 10:00:52 +00:00
connect ( m_ui . volume , & QSlider : : customContextMenuRequested , this , & AudioSettingsWidget : : volumeContextMenuRequested ) ;
m_ui . volume - > setContextMenuPolicy ( Qt : : CustomContextMenu ) ;
if ( sif - > ContainsValue ( " SPU2/Mixing " , " FinalVolume " ) )
{
QFont bold_font ( m_ui . volume - > font ( ) ) ;
bold_font . setBold ( true ) ;
m_ui . volumeLabel - > setFont ( bold_font ) ;
}
2023-01-01 12:46:07 +00:00
}
2022-03-25 09:24:27 +00:00
2024-04-24 13:53:21 +00:00
SettingWidgetBinder : : BindWidgetAndLabelToIntSetting ( sif , m_ui . sequenceLength , m_ui . sequenceLengthLabel , tr ( " ms " ) , " Soundtouch " ,
2023-01-01 12:46:07 +00:00
" SequenceLengthMS " , DEFAULT_SOUNDTOUCH_SEQUENCE_LENGTH ) ;
2024-04-24 13:53:21 +00:00
SettingWidgetBinder : : BindWidgetAndLabelToIntSetting (
2023-01-01 12:46:07 +00:00
sif , m_ui . seekWindowSize , m_ui . seekWindowSizeLabel , tr ( " ms " ) , " Soundtouch " , " SeekWindowMS " , DEFAULT_SOUNDTOUCH_SEEK_WINDOW ) ;
2024-04-24 13:53:21 +00:00
SettingWidgetBinder : : BindWidgetAndLabelToIntSetting (
2023-01-01 12:46:07 +00:00
sif , m_ui . overlap , m_ui . overlapLabel , tr ( " ms " ) , " Soundtouch " , " OverlapMS " , DEFAULT_SOUNDTOUCH_OVERLAP ) ;
2022-10-01 03:23:50 +00:00
connect ( m_ui . resetTimestretchDefaults , & QPushButton : : clicked , this , & AudioSettingsWidget : : resetTimestretchDefaults ) ;
2022-03-25 09:24:27 +00:00
2022-08-23 09:35:55 +00:00
m_ui . label_3b - > setVisible ( false ) ;
m_ui . dplLevel - > setVisible ( false ) ;
2022-12-30 07:39:41 +00:00
onMinimalOutputLatencyStateChanged ( ) ;
updateLatencyLabels ( ) ;
2022-12-08 10:13:20 +00:00
2023-01-14 20:12:07 +00:00
dialog - > registerWidgetHelp ( m_ui . syncMode , tr ( " Synchronization " ) , tr ( " TimeStretch (Recommended) " ) ,
2023-03-13 00:34:20 +00:00
tr ( " When running outside of 100% speed, adjusts the tempo on audio instead of dropping frames. Produces much nicer fast-forward/slowdown audio. " ) ) ;
2022-12-08 10:13:20 +00:00
2023-04-01 10:25:09 +00:00
dialog - > registerWidgetHelp ( m_ui . expansionMode , tr ( " Expansion " ) , tr ( " Stereo (None, Default) " ) ,
tr ( " Determines how the stereo output from the emulated system is upmixed into a greater number of the output speakers. " ) ) ;
2022-12-08 10:13:20 +00:00
2023-03-18 21:14:55 +00:00
//: Cubeb is an audio engine name. Leave as-is.
2023-04-01 10:25:09 +00:00
dialog - > registerWidgetHelp ( m_ui . outputModule , tr ( " Output Module " ) , tr ( " Cubeb (Cross-platform) " ) ,
tr ( " Selects the library to be used for audio output. " ) ) ;
2022-12-08 10:13:20 +00:00
2023-04-01 10:25:09 +00:00
dialog - > registerWidgetHelp ( m_ui . backend , tr ( " Output Backend " ) , tr ( " Default " ) ,
tr ( " When the sound output module supports multiple audio backends, determines the API to be used for audio output to the system. " ) ) ;
dialog - > registerWidgetHelp ( m_ui . outputDevice , tr ( " Output Device " ) , tr ( " Default " ) ,
tr ( " Determines which audio device to output the sound to. " ) ) ;
2022-12-08 10:13:20 +00:00
2023-01-11 16:04:52 +00:00
dialog - > registerWidgetHelp ( m_ui . targetLatency , tr ( " Target Latency " ) , tr ( " 60 ms " ) ,
2022-12-30 07:39:41 +00:00
tr ( " Determines the buffer size which the time stretcher will try to keep filled. It effectively selects the average latency, as "
" audio will be stretched/shrunk to keep the buffer size within check. " ) ) ;
dialog - > registerWidgetHelp ( m_ui . outputLatency , tr ( " Output Latency " ) , tr ( " 20 ms " ) ,
tr ( " Determines the latency from the buffer to the host audio output. This can be set lower than the target latency to reduce audio "
" delay. " ) ) ;
2022-12-08 10:13:20 +00:00
2023-12-30 11:09:16 +00:00
dialog - > registerWidgetHelp ( m_ui . sequenceLength , tr ( " Sequence Length " ) , tr ( " 30 ms " ) , tr ( " This is the default length of a single processing sequence which determines how the original sound is chopped in the time-stretch algorithm. "
" Larger values mean fewer sequences are used in processing. In principle a larger value sounds better when slowing down the tempo, but worse when increasing the tempo. " ) ) ;
2022-12-08 10:13:20 +00:00
2023-03-18 21:14:55 +00:00
//: Seek Window: the region of samples (window) the audio stretching algorithm is allowed to search.
2023-11-10 15:08:17 +00:00
dialog - > registerWidgetHelp ( m_ui . seekWindowSize , tr ( " Seek Window Size " ) , tr ( " 20 ms " ) , tr ( " The seeking window is for the algorithm that seeks the best possible overlapping location. "
2022-12-08 10:13:20 +00:00
2023-11-10 15:08:17 +00:00
" This determines from how wide a sample window the algorithm can use to find an optimal mixing location when the sound sequences are to be linked back together. " ) ) ;
dialog - > registerWidgetHelp ( m_ui . overlap , tr ( " Overlap " ) , tr ( " 10 ms " ) , tr ( " When the sound sequences are mixed back together to form again a continuous sound stream, this parameter defines how much the ends of the consecutive sequences will overlap with each other. " ) ) ;
2022-12-08 10:13:20 +00:00
2023-01-01 12:46:07 +00:00
dialog - > registerWidgetHelp ( m_ui . volume , tr ( " Volume " ) , tr ( " 100% " ) ,
tr ( " Pre-applies a volume modifier to the game's audio output before forwarding it to your computer. " ) ) ;
2022-02-15 14:59:15 +00:00
}
AudioSettingsWidget : : ~ AudioSettingsWidget ( ) = default ;
2022-03-25 09:24:27 +00:00
2022-08-14 01:23:52 +00:00
void AudioSettingsWidget : : expansionModeChanged ( )
{
const bool expansion51 = m_dialog - > getEffectiveIntValue ( " SPU2/Output " , " SpeakerConfiguration " , 0 ) = = 2 ;
m_ui . dplLevel - > setDisabled ( ! expansion51 ) ;
}
2023-06-26 11:24:46 +00:00
void AudioSettingsWidget : : populateOutputModules ( )
{
for ( const SndOutModule * mod : GetSndOutModules ( ) )
m_ui . outputModule - > addItem ( qApp - > translate ( " SPU2 " , mod - > GetDisplayName ( ) ) , QString : : fromUtf8 ( mod - > GetIdent ( ) ) ) ;
}
2022-09-29 13:52:11 +00:00
void AudioSettingsWidget : : outputModuleChanged ( )
{
const std : : string module_name ( m_dialog - > getEffectiveStringValue ( " SPU2/Output " , " OutputModule " , DEFAULT_OUTPUT_MODULE ) ) ;
const char * const * backend_names = GetOutputModuleBackends ( module_name . c_str ( ) ) ;
const std : : string backend_name ( m_dialog - > getEffectiveStringValue ( " SPU2/Output " , " BackendName " , " " ) ) ;
QSignalBlocker sb ( m_ui . backend ) ;
m_ui . backend - > clear ( ) ;
if ( m_dialog - > isPerGameSettings ( ) )
{
const QString global_backend ( QString : : fromStdString ( Host : : GetStringSettingValue ( " SPU2/Output " , " BackendName " , " " ) ) ) ;
m_ui . backend - > addItem ( tr ( " Use Global Setting [%1] " ) . arg ( global_backend . isEmpty ( ) ? tr ( " Default " ) : global_backend ) ) ;
}
m_ui . backend - > setEnabled ( backend_names ! = nullptr ) ;
2022-12-08 10:13:20 +00:00
m_ui . backend - > addItem ( tr ( " Default " ) ) ;
2022-09-29 13:52:11 +00:00
if ( ! backend_names | | backend_name . empty ( ) )
m_ui . backend - > setCurrentIndex ( 0 ) ;
if ( backend_names )
{
for ( u32 i = 0 ; backend_names [ i ] ! = nullptr ; i + + )
{
const int index = m_ui . backend - > count ( ) ;
m_ui . backend - > addItem ( QString : : fromUtf8 ( backend_names [ i ] ) ) ;
if ( backend_name = = backend_names [ i ] )
m_ui . backend - > setCurrentIndex ( index ) ;
}
}
2022-12-30 10:51:16 +00:00
updateDevices ( ) ;
2022-09-29 13:52:11 +00:00
}
void AudioSettingsWidget : : outputBackendChanged ( )
{
int index = m_ui . backend - > currentIndex ( ) ;
if ( m_dialog - > isPerGameSettings ( ) )
{
if ( index = = 0 )
{
m_dialog - > setStringSettingValue ( " SPU2/Output " , " BackendName " , std : : nullopt ) ;
return ;
}
index - - ;
}
if ( index = = 0 )
m_dialog - > setStringSettingValue ( " SPU2/Output " , " BackendName " , " " ) ;
else
m_dialog - > setStringSettingValue ( " SPU2/Output " , " BackendName " , m_ui . backend - > currentText ( ) . toUtf8 ( ) . constData ( ) ) ;
2022-12-30 10:51:16 +00:00
updateDevices ( ) ;
}
void AudioSettingsWidget : : updateDevices ( )
{
const std : : string module_name ( m_dialog - > getEffectiveStringValue ( " SPU2/Output " , " OutputModule " , DEFAULT_OUTPUT_MODULE ) ) ;
const std : : string backend_name ( m_dialog - > getEffectiveStringValue ( " SPU2/Output " , " BackendName " , " " ) ) ;
m_ui . outputDevice - > disconnect ( ) ;
m_ui . outputDevice - > clear ( ) ;
m_output_device_latency = 0 ;
std : : vector < SndOutDeviceInfo > devices ( GetOutputDeviceList ( module_name . c_str ( ) , backend_name . c_str ( ) ) ) ;
if ( devices . empty ( ) )
{
m_ui . outputDevice - > addItem ( tr ( " Default " ) ) ;
m_ui . outputDevice - > setEnabled ( false ) ;
}
else
{
const std : : string current_device ( m_dialog - > getEffectiveStringValue ( " SPU2/Output " , " DeviceName " , " " ) ) ;
m_ui . outputDevice - > setEnabled ( true ) ;
for ( const SndOutDeviceInfo & devi : devices )
{
m_ui . outputDevice - > addItem ( QString : : fromStdString ( devi . display_name ) , QString : : fromStdString ( devi . name ) ) ;
if ( devi . name = = current_device )
m_output_device_latency = devi . minimum_latency_frames ;
}
SettingWidgetBinder : : BindWidgetToStringSetting (
m_dialog - > getSettingsInterface ( ) , m_ui . outputDevice , " SPU2/Output " , " DeviceName " , std : : move ( devices . front ( ) . name ) ) ;
}
2022-09-29 13:52:11 +00:00
}
2022-12-30 07:17:40 +00:00
void AudioSettingsWidget : : volumeChanged ( int value )
2022-03-25 09:24:27 +00:00
{
2022-12-30 07:17:40 +00:00
// Nasty, but needed so we don't do a full settings apply and lag while dragging.
if ( SettingsInterface * sif = m_dialog - > getSettingsInterface ( ) )
{
2023-01-01 12:46:07 +00:00
if ( ! m_ui . volumeLabel - > font ( ) . bold ( ) )
{
QFont bold_font ( m_ui . volumeLabel - > font ( ) ) ;
bold_font . setBold ( true ) ;
m_ui . volumeLabel - > setFont ( bold_font ) ;
}
2022-12-30 07:17:40 +00:00
sif - > SetIntValue ( " SPU2/Mixing " , " FinalVolume " , value ) ;
sif - > Save ( ) ;
2023-08-27 03:21:16 +00:00
// There's two separate interfaces - one we're editing, and the active one.
// We need to reload the latter.
g_emu_thread - > reloadGameSettings ( ) ;
2022-12-30 07:17:40 +00:00
}
else
{
Host : : SetBaseIntSettingValue ( " SPU2/Mixing " , " FinalVolume " , value ) ;
Host : : CommitBaseSettingChanges ( ) ;
2023-08-27 03:21:16 +00:00
// Push through to emu thread since we're not applying.
if ( QtHost : : IsVMValid ( ) )
{
Host : : RunOnCPUThread ( [ ] ( ) {
if ( ! VMManager : : HasValidVM ( ) )
return ;
2022-12-30 07:17:40 +00:00
2023-08-27 03:21:16 +00:00
EmuConfig . SPU2 . FinalVolume = Host : : GetIntSettingValue ( " SPU2/Mixing " , " FinalVolume " , DEFAULT_VOLUME ) ;
SPU2 : : SetOutputVolume ( EmuConfig . SPU2 . FinalVolume ) ;
} ) ;
}
2022-12-30 07:17:40 +00:00
}
2023-01-01 12:46:07 +00:00
updateVolumeLabel ( ) ;
}
void AudioSettingsWidget : : volumeContextMenuRequested ( const QPoint & pt )
{
QMenu menu ( m_ui . volume ) ;
m_ui . volume - > connect ( menu . addAction ( qApp - > translate ( " SettingWidgetBinder " , " Reset " ) ) , & QAction : : triggered , this , [ this ] ( ) {
const s32 global_value = Host : : GetBaseIntSettingValue ( " SPU2/Mixing " , " FinalVolume " , DEFAULT_VOLUME ) ;
{
2023-06-23 10:00:52 +00:00
QSignalBlocker sb ( m_ui . volume ) ;
2023-01-01 12:46:07 +00:00
m_ui . volume - > setValue ( global_value ) ;
updateVolumeLabel ( ) ;
}
if ( m_ui . volumeLabel - > font ( ) . bold ( ) )
{
QFont orig_font ( m_ui . volumeLabel - > font ( ) ) ;
orig_font . setBold ( false ) ;
m_ui . volumeLabel - > setFont ( orig_font ) ;
}
SettingsInterface * sif = m_dialog - > getSettingsInterface ( ) ;
if ( sif - > ContainsValue ( " SPU2/Mixing " , " FinalVolume " ) )
{
sif - > DeleteValue ( " SPU2/Mixing " , " FinalVolume " ) ;
sif - > Save ( ) ;
g_emu_thread - > reloadGameSettings ( ) ;
}
} ) ;
menu . exec ( m_ui . volume - > mapToGlobal ( pt ) ) ;
}
void AudioSettingsWidget : : updateVolumeLabel ( )
{
2023-03-18 21:14:55 +00:00
//: Variable value that indicates a percentage. Preserve the %1 variable, adapt the latter % (and/or any possible spaces) to your language's ruleset.
2023-01-01 12:46:07 +00:00
m_ui . volumeLabel - > setText ( tr ( " %1% " ) . arg ( m_ui . volume - > value ( ) ) ) ;
2022-03-25 09:24:27 +00:00
}
2022-12-30 07:39:41 +00:00
void AudioSettingsWidget : : updateTargetLatencyRange ( )
2022-03-25 09:24:27 +00:00
{
2022-12-30 07:39:41 +00:00
const Pcsx2Config : : SPU2Options : : SynchronizationMode sync_mode = static_cast < Pcsx2Config : : SPU2Options : : SynchronizationMode > (
m_dialog - > getIntValue ( " SPU2/Output " , " SynchMode " , DEFAULT_SYNCHRONIZATION_MODE ) . value_or ( DEFAULT_SYNCHRONIZATION_MODE ) ) ;
m_ui . targetLatency - > setMinimum ( ( sync_mode = = Pcsx2Config : : SPU2Options : : SynchronizationMode : : TimeStretch ) ?
Pcsx2Config : : SPU2Options : : MIN_LATENCY_TIMESTRETCH :
Pcsx2Config : : SPU2Options : : MIN_LATENCY ) ;
m_ui . targetLatency - > setMaximum ( Pcsx2Config : : SPU2Options : : MAX_LATENCY ) ;
}
void AudioSettingsWidget : : updateLatencyLabels ( )
{
const bool minimal_output = m_dialog - > getEffectiveBoolValue ( " SPU2/Output " , " OutputLatencyMinimal " , false ) ;
2023-03-18 21:14:55 +00:00
//: Preserve the %1 variable, adapt the latter ms (and/or any possible spaces in between) to your language's ruleset.
2022-12-30 07:39:41 +00:00
m_ui . outputLatencyLabel - > setText ( minimal_output ? tr ( " N/A " ) : tr ( " %1 ms " ) . arg ( m_ui . outputLatency - > value ( ) ) ) ;
2022-12-30 10:51:16 +00:00
const u32 output_latency_ms =
minimal_output ? ( ( ( m_output_device_latency * 1000u ) + 47999u ) / 48000u ) : static_cast < u32 > ( m_ui . outputLatency - > value ( ) ) ;
2022-12-30 07:39:41 +00:00
const u32 buffer_ms = static_cast < u32 > ( m_ui . targetLatency - > value ( ) ) ;
if ( output_latency_ms > 0 )
{
m_ui . latencySummary - > setText ( tr ( " Average Latency: %1 ms (%2 ms buffer + %3 ms output) " )
. arg ( buffer_ms + output_latency_ms )
. arg ( buffer_ms )
. arg ( output_latency_ms ) ) ;
}
else
{
2022-12-30 10:51:16 +00:00
m_ui . latencySummary - > setText ( tr ( " Average Latency: %1 ms (minimum output latency unknown) " ) . arg ( buffer_ms ) ) ;
2022-12-30 07:39:41 +00:00
}
}
void AudioSettingsWidget : : onMinimalOutputLatencyStateChanged ( )
{
m_ui . outputLatency - > setEnabled ( ! m_dialog - > getEffectiveBoolValue ( " SPU2/Output " , " OutputLatencyMinimal " , false ) ) ;
2022-03-25 09:24:27 +00:00
}
void AudioSettingsWidget : : resetTimestretchDefaults ( )
{
m_ui . sequenceLength - > setValue ( DEFAULT_SOUNDTOUCH_SEQUENCE_LENGTH ) ;
m_ui . seekWindowSize - > setValue ( DEFAULT_SOUNDTOUCH_SEEK_WINDOW ) ;
m_ui . overlap - > setValue ( DEFAULT_SOUNDTOUCH_OVERLAP ) ;
}