Skip to content

Commit

Permalink
DSP must be set to LLE to select the decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
LAGonauta committed Oct 23, 2019
1 parent 3c9eb37 commit 2ff646b
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Source/Core/AudioCommon/CubebStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ bool CubebStream::Init()
if (!m_ctx)
return false;

m_stereo = !SConfig::GetInstance().bDPL2Decoder;
m_stereo = !SConfig::GetInstance().bDPL2Decoder || SConfig::GetInstance().bDSPHLE;

cubeb_stream_params params;
params.rate = m_mixer->GetSampleRate();
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/AudioCommon/Enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ namespace AudioCommon
{
enum class DPL2Quality
{
Low = 0,
Medium = 1,
Lowest = 0,
Low = 1,
High = 2,
Highest = 3
};
Expand Down
4 changes: 2 additions & 2 deletions Source/Core/AudioCommon/Mixer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ static u32 DPL2QualityToFrameBlockSize(AudioCommon::DPL2Quality quality)
{
switch (quality)
{
case AudioCommon::DPL2Quality::Low:
case AudioCommon::DPL2Quality::Lowest:
return 512;
case AudioCommon::DPL2Quality::Medium:
case AudioCommon::DPL2Quality::Low:
return 1024;
case AudioCommon::DPL2Quality::Highest:
return 4096;
Expand Down
3 changes: 2 additions & 1 deletion Source/Core/AudioCommon/OpenALStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ void OpenALStream::SoundLoop()

bool float32_capable = palIsExtensionPresent("AL_EXT_float32") != 0;
bool surround_capable = palIsExtensionPresent("AL_EXT_MCFORMATS") || IsCreativeXFi();
bool use_surround = SConfig::GetInstance().bDPL2Decoder && surround_capable;
bool use_surround =
SConfig::GetInstance().bDPL2Decoder && surround_capable && !SConfig::GetInstance().bDSPHLE;

// As there is no extension to check for 32-bit fixed point support
// and we know that only a X-Fi with hardware OpenAL supports it,
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/AudioCommon/PulseAudioStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ PulseAudio::PulseAudio() = default;

bool PulseAudio::Init()
{
m_stereo = !SConfig::GetInstance().bDPL2Decoder;
m_stereo = !SConfig::GetInstance().bDPL2Decoder || SConfig::GetInstance().bDSPHLE;
m_channels = m_stereo ? 2 : 6; // will tell PA we use a Stereo or 5.0 channel setup

NOTICE_LOG(AUDIO, "PulseAudio backend using %d channels", m_channels);
Expand Down
33 changes: 24 additions & 9 deletions Source/Core/DolphinQt/Settings/AudioPane.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ void AudioPane::CreateWidgets()
tr("Quality of the DPLII decoder. Audio latency increases with quality."));
m_dolby_quality_slider->setTracking(true);

m_dolby_quality_low_label = new QLabel(GetDPL2QualityLabel(AudioCommon::DPL2Quality::Low));
m_dolby_quality_low_label = new QLabel(GetDPL2QualityLabel(AudioCommon::DPL2Quality::Lowest));
m_dolby_quality_highest_label =
new QLabel(GetDPL2QualityLabel(AudioCommon::DPL2Quality::Highest));
m_dolby_quality_latency_label =
Expand Down Expand Up @@ -265,6 +265,11 @@ void AudioPane::SaveSettings()
auto& settings = Settings::Instance();

// DSP
if (SConfig::GetInstance().bDSPHLE != m_dsp_hle->isChecked() ||
SConfig::GetInstance().m_DSPEnableJIT != m_dsp_lle->isChecked())
{
OnDspChanged();
}
SConfig::GetInstance().bDSPHLE = m_dsp_hle->isChecked();
Config::SetBaseOrCurrent(Config::MAIN_DSP_HLE, m_dsp_hle->isChecked());
SConfig::GetInstance().m_DSPEnableJIT = m_dsp_lle->isChecked();
Expand Down Expand Up @@ -294,7 +299,7 @@ void AudioPane::SaveSettings()
static_cast<AudioCommon::DPL2Quality>(m_dolby_quality_slider->value()));
m_dolby_quality_latency_label->setText(
GetDPL2ApproximateLatencyLabel(Config::Get(Config::MAIN_DPL2_QUALITY)));
if (AudioCommon::SupportsDPL2Decoder(backend))
if (AudioCommon::SupportsDPL2Decoder(backend) && !m_dsp_hle->isChecked())
{
EnableDolbyQualityWidgets(m_dolby_pro_logic->isChecked());
}
Expand Down Expand Up @@ -324,12 +329,22 @@ void AudioPane::SaveSettings()
AudioCommon::UpdateSoundStream();
}

void AudioPane::OnDspChanged()
{
const auto backend = SConfig::GetInstance().sBackend;

m_dolby_pro_logic->setEnabled(AudioCommon::SupportsDPL2Decoder(backend) &&
!m_dsp_hle->isChecked());
EnableDolbyQualityWidgets(AudioCommon::SupportsDPL2Decoder(backend) && !m_dsp_hle->isChecked());
}

void AudioPane::OnBackendChanged()
{
const auto backend = SConfig::GetInstance().sBackend;

m_dolby_pro_logic->setEnabled(AudioCommon::SupportsDPL2Decoder(backend));
EnableDolbyQualityWidgets(AudioCommon::SupportsDPL2Decoder(backend));
m_dolby_pro_logic->setEnabled(AudioCommon::SupportsDPL2Decoder(backend) &&
!m_dsp_hle->isChecked());
EnableDolbyQualityWidgets(AudioCommon::SupportsDPL2Decoder(backend) && !m_dsp_hle->isChecked());
if (m_latency_control_supported)
{
m_latency_label->setEnabled(AudioCommon::SupportsLatencyControl(backend));
Expand Down Expand Up @@ -362,7 +377,7 @@ void AudioPane::OnEmulationStateChanged(bool running)
m_dsp_interpreter->setEnabled(!running);
m_backend_label->setEnabled(!running);
m_backend_combo->setEnabled(!running);
if (AudioCommon::SupportsDPL2Decoder(SConfig::GetInstance().sBackend))
if (AudioCommon::SupportsDPL2Decoder(SConfig::GetInstance().sBackend) && !m_dsp_hle->isChecked())
{
m_dolby_pro_logic->setEnabled(!running);
EnableDolbyQualityWidgets(!running);
Expand Down Expand Up @@ -395,10 +410,10 @@ QString AudioPane::GetDPL2QualityLabel(AudioCommon::DPL2Quality value) const
{
switch (value)
{
case AudioCommon::DPL2Quality::Lowest:
return tr("Lowest");
case AudioCommon::DPL2Quality::Low:
return tr("Low");
case AudioCommon::DPL2Quality::Medium:
return tr("Medium");
case AudioCommon::DPL2Quality::Highest:
return tr("Highest");
default:
Expand All @@ -410,9 +425,9 @@ QString AudioPane::GetDPL2ApproximateLatencyLabel(AudioCommon::DPL2Quality value
{
switch (value)
{
case AudioCommon::DPL2Quality::Low:
case AudioCommon::DPL2Quality::Lowest:
return tr("Latency: ~10ms");
case AudioCommon::DPL2Quality::Medium:
case AudioCommon::DPL2Quality::Low:
return tr("Latency: ~20ms");
case AudioCommon::DPL2Quality::Highest:
return tr("Latency: ~80ms");
Expand Down
1 change: 1 addition & 0 deletions Source/Core/DolphinQt/Settings/AudioPane.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ class AudioPane final : public QWidget

void OnEmulationStateChanged(bool running);
void OnBackendChanged();
void OnDspChanged();
void OnVolumeChanged(int volume);

void CheckNeedForLatencyControl();
Expand Down

0 comments on commit 2ff646b

Please sign in to comment.