mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-29 00:33:01 +00:00
sys_rsxaudio: use max channel count from configured sound_modes
This commit is contained in:
parent
61823a5d62
commit
2a1e3b2b77
@ -144,3 +144,29 @@ std::pair<AudioChannelCnt, AudioChannelCnt> AudioBackend::get_channel_count_and_
|
||||
fmt::throw_exception("Unknown downmixer in cellAudioOut config: %d", out.downmixer);
|
||||
}
|
||||
}
|
||||
|
||||
AudioChannelCnt AudioBackend::get_max_channel_count(u32 device_index)
|
||||
{
|
||||
audio_out_configuration& audio_out_cfg = g_fxo->get<audio_out_configuration>();
|
||||
std::lock_guard lock(audio_out_cfg.mtx);
|
||||
ensure(device_index < audio_out_cfg.out.size());
|
||||
const audio_out_configuration::audio_out& out = audio_out_cfg.out.at(device_index);
|
||||
|
||||
AudioChannelCnt count = AudioChannelCnt::STEREO;
|
||||
|
||||
for (const CellAudioOutSoundMode& mode : out.sound_modes)
|
||||
{
|
||||
switch (mode.channel)
|
||||
{
|
||||
case 6:
|
||||
count = AudioChannelCnt::SURROUND_5_1;
|
||||
break;
|
||||
case 8:
|
||||
return AudioChannelCnt::SURROUND_7_1; // Max possible count. So let's return immediately.
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
@ -140,6 +140,11 @@ public:
|
||||
*/
|
||||
static std::pair<AudioChannelCnt, AudioChannelCnt> get_channel_count_and_downmixer(u32 device_index);
|
||||
|
||||
/*
|
||||
* Returns the max supported channel count.
|
||||
*/
|
||||
static AudioChannelCnt get_max_channel_count(u32 device_index);
|
||||
|
||||
/*
|
||||
* Downmix audio stream.
|
||||
*/
|
||||
|
@ -1322,7 +1322,8 @@ void rsxaudio_backend_thread::update_emu_cfg()
|
||||
|
||||
rsxaudio_backend_thread::emu_audio_cfg rsxaudio_backend_thread::get_emu_cfg()
|
||||
{
|
||||
const auto [out_ch_cnt, out_downmix] = AudioBackend::get_channel_count_and_downmixer(0); // CELL_AUDIO_OUT_PRIMARY
|
||||
// Get max supported channel count
|
||||
AudioChannelCnt out_ch_cnt = AudioBackend::get_max_channel_count(0); // CELL_AUDIO_OUT_PRIMARY
|
||||
|
||||
emu_audio_cfg cfg =
|
||||
{
|
||||
@ -1333,7 +1334,6 @@ rsxaudio_backend_thread::emu_audio_cfg rsxaudio_backend_thread::get_emu_cfg()
|
||||
.enable_time_stretching = static_cast<bool>(g_cfg.audio.enable_time_stretching),
|
||||
.dump_to_file = static_cast<bool>(g_cfg.audio.dump_to_file),
|
||||
.channels = out_ch_cnt,
|
||||
.downmix = out_downmix,
|
||||
.renderer = g_cfg.audio.renderer,
|
||||
.provider = g_cfg.audio.provider,
|
||||
.avport = convert_avport(g_cfg.audio.rsxaudio_port)
|
||||
@ -1672,8 +1672,6 @@ void rsxaudio_backend_thread::backend_init(const rsxaudio_state& ra_state, const
|
||||
backend->SetErrorCallback(std::bind(&rsxaudio_backend_thread::error_callback, this));
|
||||
}
|
||||
|
||||
// TODO: properly handle dowmnix
|
||||
|
||||
const port_config& port_cfg = ra_state.port[static_cast<u8>(emu_cfg.avport)];
|
||||
const AudioSampleSize sample_size = emu_cfg.convert_to_s16 ? AudioSampleSize::S16 : AudioSampleSize::FLOAT;
|
||||
const AudioChannelCnt ch_cnt = static_cast<AudioChannelCnt>(std::min<u32>(static_cast<u32>(port_cfg.ch_cnt), static_cast<u32>(emu_cfg.channels)));
|
||||
|
@ -475,7 +475,6 @@ private:
|
||||
bool enable_time_stretching = false;
|
||||
bool dump_to_file = false;
|
||||
AudioChannelCnt channels = AudioChannelCnt::STEREO;
|
||||
AudioChannelCnt downmix = AudioChannelCnt::SURROUND_7_1;
|
||||
audio_renderer renderer = audio_renderer::null;
|
||||
audio_provider provider = audio_provider::none;
|
||||
RsxaudioAvportIdx avport = RsxaudioAvportIdx::HDMI_0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user