1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-23 03:02:53 +01:00

cellAudioOut: add stereo, 5.1 and 7.1 for covenience

This commit is contained in:
Megamouse 2022-06-02 00:58:42 +02:00
parent 94aef197dd
commit 06e5b8a06a
6 changed files with 35 additions and 5 deletions

View File

@ -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;
};

View File

@ -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.

View File

@ -235,7 +235,7 @@ struct cfg_root : cfg::node
cfg::_enum<audio_avport> 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<audio_format> format{ this, "Audio Format", audio_format::manual, false };
cfg::_enum<audio_format> format{ this, "Audio Format", audio_format::stereo, false };
cfg::uint<0, umax> formats{ this, "Audio Formats", static_cast<u32>(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 };

View File

@ -538,8 +538,11 @@ void fmt_class_string<audio_format>::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;

View File

@ -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

View File

@ -1143,6 +1143,9 @@ QString emu_settings::GetLocalizedSetting(const QString& original, emu_settings_
case emu_settings_type::AudioFormat:
switch (static_cast<audio_format>(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");
}