Skip to content

Commit

Permalink
cellAudioOut: add stereo, 5.1 and 7.1 for covenience
Browse files Browse the repository at this point in the history
  • Loading branch information
Megamouse committed Jun 1, 2022
1 parent 5b80973 commit 7ef6bee
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 4 deletions.
2 changes: 1 addition & 1 deletion rpcs3/Emu/Cell/Modules/cellAudio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
22 changes: 22 additions & 0 deletions rpcs3/Emu/Cell/Modules/cellAudioOut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,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.
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.
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.
Expand Down
2 changes: 1 addition & 1 deletion rpcs3/Emu/system_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down
5 changes: 4 additions & 1 deletion rpcs3/Emu/system_config_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion rpcs3/Emu/system_config_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions rpcs3/rpcs3qt/emu_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down

0 comments on commit 7ef6bee

Please sign in to comment.