diff --git a/rpcs3/Emu/Cell/Modules/cellAudio.h b/rpcs3/Emu/Cell/Modules/cellAudio.h index ad99d3236c..560f1455fa 100644 --- a/rpcs3/Emu/Cell/Modules/cellAudio.h +++ b/rpcs3/Emu/Cell/Modules/cellAudio.h @@ -201,7 +201,7 @@ struct cell_audio_config s64 time_stretching_threshold = 0; bool convert_to_s16 = false; bool dump_to_file = false; - audio_format format = audio_format::manual; + audio_format format = audio_format::stereo; audio_renderer renderer = audio_renderer::null; audio_provider provider = audio_provider::none; }; diff --git a/rpcs3/Emu/Cell/Modules/cellAudioOut.cpp b/rpcs3/Emu/Cell/Modules/cellAudioOut.cpp index 8ca6f8042f..29624b77ba 100644 --- a/rpcs3/Emu/Cell/Modules/cellAudioOut.cpp +++ b/rpcs3/Emu/Cell/Modules/cellAudioOut.cpp @@ -73,7 +73,6 @@ audio_out_configuration::audio_out_configuration() // Always add Linear PCM 2 Ch. add_sound_mode_to_both_outputs(CELL_AUDIO_OUT_CODING_TYPE_LPCM, CELL_AUDIO_OUT_CHNUM_2, CELL_AUDIO_OUT_FS_48KHZ, CELL_AUDIO_OUT_SPEAKER_LAYOUT_2CH); - // TODO: audio_format should be a bitmap, but we'll keep it simple for now (Linear PCM 2 Ch. 48 kHz should always exist) // TODO: more formats: // - Each LPCM with other sample frequencies (we currently only support 48 kHz) // - AAC @@ -84,6 +83,28 @@ audio_out_configuration::audio_out_configuration() // - ... switch (g_cfg.audio.format) { + case audio_format::stereo: + { + break; // Already added by default + } + case audio_format::surround_7_1: + { + // Linear PCM 7.1 Ch. 48 kHz + add_sound_mode_to_both_outputs(CELL_AUDIO_OUT_CODING_TYPE_LPCM, CELL_AUDIO_OUT_CHNUM_8, CELL_AUDIO_OUT_FS_48KHZ, CELL_AUDIO_OUT_SPEAKER_LAYOUT_8CH_LREClrxy); + [[fallthrough]]; // Also add all available 5.1 formats in case the game doesn't like 7.1 + } + case audio_format::surround_5_1: + { + // Linear PCM 5.1 Ch. 48 kHz + add_sound_mode_to_both_outputs(CELL_AUDIO_OUT_CODING_TYPE_LPCM, CELL_AUDIO_OUT_CHNUM_6, CELL_AUDIO_OUT_FS_48KHZ, CELL_AUDIO_OUT_SPEAKER_LAYOUT_6CH_LREClr); + + // Dolby Digital 5.1 Ch. + add_sound_mode_to_both_outputs(CELL_AUDIO_OUT_CODING_TYPE_AC3, CELL_AUDIO_OUT_CHNUM_6, CELL_AUDIO_OUT_FS_48KHZ, CELL_AUDIO_OUT_SPEAKER_LAYOUT_6CH_LREClr); + + // DTS 5.1 Ch. + add_sound_mode_to_both_outputs(CELL_AUDIO_OUT_CODING_TYPE_DTS, CELL_AUDIO_OUT_CHNUM_6, CELL_AUDIO_OUT_FS_48KHZ, CELL_AUDIO_OUT_SPEAKER_LAYOUT_6CH_LREClr); + break; + } case audio_format::automatic: // Automatic based on supported formats { if (supports_lpcm_5_1) // Linear PCM 5.1 Ch. diff --git a/rpcs3/Emu/system_config.h b/rpcs3/Emu/system_config.h index c7e4465ad2..671df8422b 100644 --- a/rpcs3/Emu/system_config.h +++ b/rpcs3/Emu/system_config.h @@ -235,7 +235,7 @@ struct cfg_root : cfg::node cfg::_enum rsxaudio_port{ this, "RSXAudio Avport", audio_avport::hdmi_0, true }; cfg::_bool dump_to_file{ this, "Dump to file", false, true }; cfg::_bool convert_to_s16{ this, "Convert to 16 bit", false, true }; - cfg::_enum format{ this, "Audio Format", audio_format::manual, false }; + cfg::_enum format{ this, "Audio Format", audio_format::stereo, false }; cfg::uint<0, umax> formats{ this, "Audio Formats", static_cast(audio_format_flag::lpcm_2_48khz), false }; cfg::_int<0, 200> volume{ this, "Master Volume", 100, true }; cfg::_bool enable_buffering{ this, "Enable Buffering", true, true }; diff --git a/rpcs3/Emu/system_config_types.cpp b/rpcs3/Emu/system_config_types.cpp index 1148a3dcc1..f3880c0456 100644 --- a/rpcs3/Emu/system_config_types.cpp +++ b/rpcs3/Emu/system_config_types.cpp @@ -538,8 +538,11 @@ void fmt_class_string::format(std::string& out, u64 arg) { switch (value) { - case audio_format::manual: return "Manual"; + case audio_format::stereo: return "Stereo"; + case audio_format::surround_5_1: return "Surround 5.1"; + case audio_format::surround_7_1: return "Surround 7.1"; case audio_format::automatic: return "Automatic"; + case audio_format::manual: return "Manual"; } return unknown; diff --git a/rpcs3/Emu/system_config_types.h b/rpcs3/Emu/system_config_types.h index d86d9b7748..8ad3b1017d 100644 --- a/rpcs3/Emu/system_config_types.h +++ b/rpcs3/Emu/system_config_types.h @@ -78,8 +78,11 @@ enum class audio_avport enum class audio_format { - manual, + stereo, + surround_5_1, + surround_7_1, automatic, + manual, }; enum class audio_format_flag : unsigned diff --git a/rpcs3/rpcs3qt/emu_settings.cpp b/rpcs3/rpcs3qt/emu_settings.cpp index f76f3333e1..6fdfb349b6 100644 --- a/rpcs3/rpcs3qt/emu_settings.cpp +++ b/rpcs3/rpcs3qt/emu_settings.cpp @@ -1143,6 +1143,9 @@ QString emu_settings::GetLocalizedSetting(const QString& original, emu_settings_ case emu_settings_type::AudioFormat: switch (static_cast(index)) { + case audio_format::stereo: return tr("Stereo", "Audio format"); + case audio_format::surround_5_1: return tr("Surround 5.1", "Audio format"); + case audio_format::surround_7_1: return tr("Surround 7.1", "Audio format"); case audio_format::manual: return tr("Manual", "Audio format"); case audio_format::automatic: return tr("Automatic", "Audio format"); }