mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Merge pull request #13122 from TryTwo/PR_Audio_Configs
AudioPanel: Refactor to use Config system.
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
namespace AudioCommon
|
||||
{
|
||||
enum class DPL2Quality
|
||||
enum class DPL2Quality : int
|
||||
{
|
||||
Lowest = 0,
|
||||
Low = 1,
|
||||
|
||||
@@ -153,13 +153,23 @@ void ConfigComplexChoice::UpdateComboIndex()
|
||||
};
|
||||
|
||||
auto it = std::find_if(m_options.begin(), m_options.end(), is_correct_option);
|
||||
int index = static_cast<int>(std::distance(m_options.begin(), it));
|
||||
int index;
|
||||
|
||||
if (it == m_options.end())
|
||||
index = m_default_index;
|
||||
else
|
||||
index = static_cast<int>(std::distance(m_options.begin(), it));
|
||||
|
||||
// Will crash if not blocked
|
||||
const QSignalBlocker blocker(this);
|
||||
setCurrentIndex(index);
|
||||
}
|
||||
|
||||
void ConfigComplexChoice::SetDefault(int index)
|
||||
{
|
||||
m_default_index = index;
|
||||
}
|
||||
|
||||
const std::pair<Config::Location, Config::Location> ConfigComplexChoice::GetLocation() const
|
||||
{
|
||||
auto visit = [](auto& v) { return v.GetLocation(); };
|
||||
|
||||
@@ -62,6 +62,7 @@ public:
|
||||
void Add(const QString& name, const OptionVariant option1, const OptionVariant option2);
|
||||
void Refresh();
|
||||
void Reset();
|
||||
void SetDefault(int index);
|
||||
const std::pair<Config::Location, Config::Location> GetLocation() const;
|
||||
|
||||
private:
|
||||
@@ -73,4 +74,5 @@ private:
|
||||
const InfoVariant m_setting1;
|
||||
const InfoVariant m_setting2;
|
||||
std::vector<std::pair<OptionVariant, OptionVariant>> m_options;
|
||||
int m_default_index = -1;
|
||||
};
|
||||
|
||||
@@ -438,22 +438,17 @@ int Settings::GetVolume() const
|
||||
void Settings::SetVolume(int volume)
|
||||
{
|
||||
if (GetVolume() != volume)
|
||||
{
|
||||
Config::SetBaseOrCurrent(Config::MAIN_AUDIO_VOLUME, volume);
|
||||
emit VolumeChanged(volume);
|
||||
}
|
||||
}
|
||||
|
||||
void Settings::IncreaseVolume(int volume)
|
||||
{
|
||||
AudioCommon::IncreaseVolume(Core::System::GetInstance(), volume);
|
||||
emit VolumeChanged(GetVolume());
|
||||
}
|
||||
|
||||
void Settings::DecreaseVolume(int volume)
|
||||
{
|
||||
AudioCommon::DecreaseVolume(Core::System::GetInstance(), volume);
|
||||
emit VolumeChanged(GetVolume());
|
||||
}
|
||||
|
||||
bool Settings::IsLogVisible() const
|
||||
|
||||
@@ -197,7 +197,6 @@ signals:
|
||||
void CursorVisibilityChanged();
|
||||
void LockCursorChanged();
|
||||
void KeepWindowOnTopChanged(bool top);
|
||||
void VolumeChanged(int volume);
|
||||
void NANDRefresh();
|
||||
void RegistersVisibilityChanged(bool visible);
|
||||
void ThreadsVisibilityChanged(bool visible);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -10,13 +10,15 @@ namespace AudioCommon
|
||||
enum class DPL2Quality;
|
||||
}
|
||||
|
||||
class QCheckBox;
|
||||
class QComboBox;
|
||||
class ConfigBool;
|
||||
class ConfigChoice;
|
||||
class ConfigComplexChoice;
|
||||
class ConfigRadioBool;
|
||||
class ConfigSlider;
|
||||
class ConfigStringChoice;
|
||||
class QHBoxLayout;
|
||||
class QLabel;
|
||||
class QRadioButton;
|
||||
class QSlider;
|
||||
class QSpinBox;
|
||||
class SettingsWindow;
|
||||
class ConfigBool;
|
||||
|
||||
@@ -29,47 +31,37 @@ public:
|
||||
private:
|
||||
void CreateWidgets();
|
||||
void ConnectWidgets();
|
||||
|
||||
void LoadSettings();
|
||||
void SaveSettings();
|
||||
void AddDescriptions();
|
||||
|
||||
void OnEmulationStateChanged(bool running);
|
||||
void OnBackendChanged();
|
||||
void OnDspChanged();
|
||||
void OnVolumeChanged(int volume);
|
||||
|
||||
void CheckNeedForLatencyControl();
|
||||
bool m_latency_control_supported;
|
||||
|
||||
QString GetDPL2QualityLabel(AudioCommon::DPL2Quality value) const;
|
||||
QString GetDPL2ApproximateLatencyLabel(AudioCommon::DPL2Quality value) const;
|
||||
void EnableDolbyQualityWidgets(bool enabled) const;
|
||||
|
||||
QHBoxLayout* m_main_layout;
|
||||
|
||||
// DSP Engine
|
||||
QRadioButton* m_dsp_hle;
|
||||
QRadioButton* m_dsp_lle;
|
||||
QRadioButton* m_dsp_interpreter;
|
||||
ConfigComplexChoice* m_dsp_combo;
|
||||
|
||||
// Volume
|
||||
QSlider* m_volume_slider;
|
||||
ConfigSlider* m_volume_slider;
|
||||
QLabel* m_volume_indicator;
|
||||
|
||||
// Backend
|
||||
QLabel* m_backend_label;
|
||||
QComboBox* m_backend_combo;
|
||||
QCheckBox* m_dolby_pro_logic;
|
||||
ConfigStringChoice* m_backend_combo;
|
||||
|
||||
ConfigBool* m_dolby_pro_logic;
|
||||
QLabel* m_dolby_quality_label;
|
||||
QSlider* m_dolby_quality_slider;
|
||||
QLabel* m_dolby_quality_low_label;
|
||||
QLabel* m_dolby_quality_highest_label;
|
||||
QLabel* m_dolby_quality_latency_label;
|
||||
ConfigChoice* m_dolby_quality_combo;
|
||||
|
||||
QLabel* m_latency_label;
|
||||
QSpinBox* m_latency_spin;
|
||||
ConfigSlider* m_latency_slider;
|
||||
#ifdef _WIN32
|
||||
QLabel* m_wasapi_device_label;
|
||||
QComboBox* m_wasapi_device_combo;
|
||||
ConfigStringChoice* m_wasapi_device_combo;
|
||||
#endif
|
||||
|
||||
// Misc Settings
|
||||
|
||||
Reference in New Issue
Block a user