mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 14:19:46 -06:00
Allow user to change DPLII decoding quality
This commit is contained in:
@ -101,6 +101,11 @@ std::string GetDefaultSoundBackend()
|
||||
return backend;
|
||||
}
|
||||
|
||||
DPL2Quality GetDefaultDPL2Quality()
|
||||
{
|
||||
return DPL2Quality::High;
|
||||
}
|
||||
|
||||
std::vector<std::string> GetSoundBackends()
|
||||
{
|
||||
std::vector<std::string> backends;
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
|
||||
#include "AudioCommon/Enums.h"
|
||||
#include "AudioCommon/SoundStream.h"
|
||||
|
||||
class Mixer;
|
||||
@ -21,6 +22,7 @@ void InitSoundStream();
|
||||
void ShutdownSoundStream();
|
||||
std::string GetDefaultSoundBackend();
|
||||
std::vector<std::string> GetSoundBackends();
|
||||
DPL2Quality GetDefaultDPL2Quality();
|
||||
bool SupportsDPL2Decoder(std::string_view backend);
|
||||
bool SupportsLatencyControl(std::string_view backend);
|
||||
bool SupportsVolumeChanges(std::string_view backend);
|
||||
|
@ -53,6 +53,7 @@
|
||||
<ClInclude Include="AudioStretcher.h" />
|
||||
<ClInclude Include="CubebStream.h" />
|
||||
<ClInclude Include="CubebUtils.h" />
|
||||
<ClInclude Include="Enums.h" />
|
||||
<ClInclude Include="Mixer.h" />
|
||||
<ClInclude Include="NullSoundStream.h" />
|
||||
<ClInclude Include="OpenALStream.h" />
|
||||
|
@ -56,6 +56,7 @@
|
||||
<Filter>SoundStreams</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SurroundDecoder.h" />
|
||||
<ClInclude Include="Enums.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Text Include="CMakeLists.txt" />
|
||||
|
@ -7,6 +7,7 @@ add_library(audiocommon
|
||||
CubebStream.h
|
||||
CubebUtils.cpp
|
||||
CubebUtils.h
|
||||
Enums.h
|
||||
Mixer.cpp
|
||||
Mixer.h
|
||||
SurroundDecoder.cpp
|
||||
|
16
Source/Core/AudioCommon/Enums.h
Normal file
16
Source/Core/AudioCommon/Enums.h
Normal file
@ -0,0 +1,16 @@
|
||||
// Copyright 2019 Dolphin Emulator Project
|
||||
// Licensed under GPLv2+
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace AudioCommon
|
||||
{
|
||||
enum class DPL2Quality
|
||||
{
|
||||
Low = 0,
|
||||
Medium = 1,
|
||||
High = 2,
|
||||
Highest = 3
|
||||
};
|
||||
} // namespace AudioCommon
|
@ -3,6 +3,7 @@
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include "AudioCommon/Mixer.h"
|
||||
#include "AudioCommon/Enums.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
@ -12,11 +13,28 @@
|
||||
#include "Common/CommonTypes.h"
|
||||
#include "Common/Logging/Log.h"
|
||||
#include "Common/Swap.h"
|
||||
#include "Core/Config/MainSettings.h"
|
||||
#include "Core/ConfigManager.h"
|
||||
|
||||
static u32 DPL2QualityToFrameBlockSize(AudioCommon::DPL2Quality quality)
|
||||
{
|
||||
switch (quality)
|
||||
{
|
||||
case AudioCommon::DPL2Quality::Low:
|
||||
return 512;
|
||||
case AudioCommon::DPL2Quality::Medium:
|
||||
return 1024;
|
||||
case AudioCommon::DPL2Quality::Highest:
|
||||
return 4096;
|
||||
default:
|
||||
return 2048;
|
||||
}
|
||||
}
|
||||
|
||||
Mixer::Mixer(unsigned int BackendSampleRate)
|
||||
: m_sampleRate(BackendSampleRate), m_stretcher(BackendSampleRate),
|
||||
m_surround_decoder(BackendSampleRate, SURROUND_BLOCK_SIZE)
|
||||
m_surround_decoder(BackendSampleRate,
|
||||
DPL2QualityToFrameBlockSize(Config::Get(Config::MAIN_DPL2_QUALITY)))
|
||||
{
|
||||
INFO_LOG(AUDIO_INTERFACE, "Mixer is initialized");
|
||||
}
|
||||
|
@ -54,7 +54,6 @@ private:
|
||||
static constexpr u32 CONTROL_AVG = 32; // In freq_shift per FIFO size offset
|
||||
|
||||
const unsigned int SURROUND_CHANNELS = 6;
|
||||
const unsigned int SURROUND_BLOCK_SIZE = 512;
|
||||
|
||||
class MixerFifo final
|
||||
{
|
||||
|
Reference in New Issue
Block a user