mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-29 00:33:01 +00:00
cellAudioOut: Only add LPCM 2ch. to secondary output
This commit is contained in:
parent
fec9fcda7d
commit
5dffbca636
@ -54,40 +54,32 @@ audio_out_configuration::audio_out_configuration()
|
||||
if (supports_ac3) cellSysutil.notice("cellAudioOut: found support for Dolby Digital 5.1 Ch.");
|
||||
if (supports_dts) cellSysutil.notice("cellAudioOut: found support for DTS 5.1 Ch.");
|
||||
|
||||
bool initial_mode_selected = false;
|
||||
std::array<bool, 2> initial_mode_selected = {};
|
||||
|
||||
const auto add_sound_mode = [](std::vector<CellAudioOutSoundMode>& sound_modes, u8 type, u8 channel, u8 fs, u32 layout)
|
||||
const auto add_sound_mode = [&](u32 index, u8 type, u8 channel, u8 fs, u32 layout, bool supported)
|
||||
{
|
||||
audio_out& output = out.at(index);
|
||||
bool& selected = initial_mode_selected.at(index);
|
||||
|
||||
CellAudioOutSoundMode mode{};
|
||||
mode.type = type;
|
||||
mode.channel = channel;
|
||||
mode.fs = fs;
|
||||
mode.layout = layout;
|
||||
sound_modes.push_back(std::move(mode));
|
||||
};
|
||||
output.sound_modes.push_back(std::move(mode));
|
||||
|
||||
const auto add_sound_mode_to_both_outputs = [&](u8 type, u8 channel, u8 fs, u32 layout, bool supported)
|
||||
{
|
||||
add_sound_mode(primary_modes, type, channel, fs, layout);
|
||||
add_sound_mode(secondary_modes, type, channel, fs, layout);
|
||||
|
||||
if (!initial_mode_selected && supported)
|
||||
if (!selected && supported)
|
||||
{
|
||||
// Pre-select the first available sound mode
|
||||
primary_output.channels = primary_modes.front().channel;
|
||||
primary_output.encoder = primary_modes.front().type;
|
||||
secondary_output.channels = secondary_modes.front().channel;
|
||||
secondary_output.encoder = secondary_modes.front().type;
|
||||
output.channels = channel;
|
||||
output.encoder = type;
|
||||
|
||||
// Set the initially selected configuration
|
||||
primary_output.config.channel = primary_output.channels;
|
||||
primary_output.config.encoder = primary_output.encoder;
|
||||
primary_output.config.downMixer = CELL_AUDIO_OUT_DOWNMIXER_NONE;
|
||||
secondary_output.config.channel = secondary_output.channels;
|
||||
secondary_output.config.encoder = secondary_output.encoder;
|
||||
secondary_output.config.downMixer = CELL_AUDIO_OUT_DOWNMIXER_NONE;
|
||||
output.config.channel = channel;
|
||||
output.config.encoder = type;
|
||||
output.config.downMixer = CELL_AUDIO_OUT_DOWNMIXER_NONE;
|
||||
|
||||
initial_mode_selected = true;
|
||||
selected = true;
|
||||
}
|
||||
};
|
||||
|
||||
@ -108,41 +100,41 @@ audio_out_configuration::audio_out_configuration()
|
||||
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, supports_lpcm_7_1);
|
||||
add_sound_mode(CELL_AUDIO_OUT_PRIMARY, CELL_AUDIO_OUT_CODING_TYPE_LPCM, CELL_AUDIO_OUT_CHNUM_8, CELL_AUDIO_OUT_FS_48KHZ, CELL_AUDIO_OUT_SPEAKER_LAYOUT_8CH_LREClrxy, supports_lpcm_7_1);
|
||||
[[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, supports_lpcm_5_1);
|
||||
add_sound_mode(CELL_AUDIO_OUT_PRIMARY, CELL_AUDIO_OUT_CODING_TYPE_LPCM, CELL_AUDIO_OUT_CHNUM_6, CELL_AUDIO_OUT_FS_48KHZ, CELL_AUDIO_OUT_SPEAKER_LAYOUT_6CH_LREClr, supports_lpcm_5_1);
|
||||
|
||||
// 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, supports_ac3);
|
||||
add_sound_mode(CELL_AUDIO_OUT_PRIMARY, CELL_AUDIO_OUT_CODING_TYPE_AC3, CELL_AUDIO_OUT_CHNUM_6, CELL_AUDIO_OUT_FS_48KHZ, CELL_AUDIO_OUT_SPEAKER_LAYOUT_6CH_LREClr, supports_ac3);
|
||||
|
||||
// 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, supports_dts);
|
||||
add_sound_mode(CELL_AUDIO_OUT_PRIMARY, CELL_AUDIO_OUT_CODING_TYPE_DTS, CELL_AUDIO_OUT_CHNUM_6, CELL_AUDIO_OUT_FS_48KHZ, CELL_AUDIO_OUT_SPEAKER_LAYOUT_6CH_LREClr, supports_dts);
|
||||
break;
|
||||
}
|
||||
case audio_format::automatic: // Automatic based on supported formats
|
||||
{
|
||||
if (supports_lpcm_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, supports_lpcm_7_1);
|
||||
add_sound_mode(CELL_AUDIO_OUT_PRIMARY, CELL_AUDIO_OUT_CODING_TYPE_LPCM, CELL_AUDIO_OUT_CHNUM_8, CELL_AUDIO_OUT_FS_48KHZ, CELL_AUDIO_OUT_SPEAKER_LAYOUT_8CH_LREClrxy, supports_lpcm_7_1);
|
||||
}
|
||||
|
||||
if (supports_lpcm_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, supports_lpcm_5_1);
|
||||
add_sound_mode(CELL_AUDIO_OUT_PRIMARY, CELL_AUDIO_OUT_CODING_TYPE_LPCM, CELL_AUDIO_OUT_CHNUM_6, CELL_AUDIO_OUT_FS_48KHZ, CELL_AUDIO_OUT_SPEAKER_LAYOUT_6CH_LREClr, supports_lpcm_5_1);
|
||||
}
|
||||
|
||||
if (supports_ac3) // 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, supports_ac3);
|
||||
add_sound_mode(CELL_AUDIO_OUT_PRIMARY, CELL_AUDIO_OUT_CODING_TYPE_AC3, CELL_AUDIO_OUT_CHNUM_6, CELL_AUDIO_OUT_FS_48KHZ, CELL_AUDIO_OUT_SPEAKER_LAYOUT_6CH_LREClr, supports_ac3);
|
||||
}
|
||||
|
||||
if (supports_dts) // 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, supports_dts);
|
||||
add_sound_mode(CELL_AUDIO_OUT_PRIMARY, CELL_AUDIO_OUT_CODING_TYPE_DTS, CELL_AUDIO_OUT_CHNUM_6, CELL_AUDIO_OUT_FS_48KHZ, CELL_AUDIO_OUT_SPEAKER_LAYOUT_6CH_LREClr, supports_dts);
|
||||
}
|
||||
|
||||
break;
|
||||
@ -152,27 +144,29 @@ audio_out_configuration::audio_out_configuration()
|
||||
const u32 selected_formats = g_cfg.audio.formats;
|
||||
|
||||
if (selected_formats & static_cast<u32>(audio_format_flag::lpcm_7_1_48khz)) // 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, supports_lpcm_7_1);
|
||||
add_sound_mode(CELL_AUDIO_OUT_PRIMARY, CELL_AUDIO_OUT_CODING_TYPE_LPCM, CELL_AUDIO_OUT_CHNUM_8, CELL_AUDIO_OUT_FS_48KHZ, CELL_AUDIO_OUT_SPEAKER_LAYOUT_8CH_LREClrxy, supports_lpcm_7_1);
|
||||
|
||||
if (selected_formats & static_cast<u32>(audio_format_flag::lpcm_5_1_48khz)) // 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, supports_lpcm_5_1);
|
||||
add_sound_mode(CELL_AUDIO_OUT_PRIMARY, CELL_AUDIO_OUT_CODING_TYPE_LPCM, CELL_AUDIO_OUT_CHNUM_6, CELL_AUDIO_OUT_FS_48KHZ, CELL_AUDIO_OUT_SPEAKER_LAYOUT_6CH_LREClr, supports_lpcm_5_1);
|
||||
|
||||
if (selected_formats & static_cast<u32>(audio_format_flag::ac3)) // 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, supports_ac3);
|
||||
add_sound_mode(CELL_AUDIO_OUT_PRIMARY, CELL_AUDIO_OUT_CODING_TYPE_AC3, CELL_AUDIO_OUT_CHNUM_6, CELL_AUDIO_OUT_FS_48KHZ, CELL_AUDIO_OUT_SPEAKER_LAYOUT_6CH_LREClr, supports_ac3);
|
||||
|
||||
if (selected_formats & static_cast<u32>(audio_format_flag::dts)) // 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, supports_dts);
|
||||
add_sound_mode(CELL_AUDIO_OUT_PRIMARY, CELL_AUDIO_OUT_CODING_TYPE_DTS, CELL_AUDIO_OUT_CHNUM_6, CELL_AUDIO_OUT_FS_48KHZ, CELL_AUDIO_OUT_SPEAKER_LAYOUT_6CH_LREClr, supports_dts);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// 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, true);
|
||||
// Always add Linear PCM 2 Ch. to the primary output
|
||||
add_sound_mode(CELL_AUDIO_OUT_PRIMARY, CELL_AUDIO_OUT_CODING_TYPE_LPCM, CELL_AUDIO_OUT_CHNUM_2, CELL_AUDIO_OUT_FS_48KHZ, CELL_AUDIO_OUT_SPEAKER_LAYOUT_2CH, true);
|
||||
|
||||
ensure(!primary_modes.empty());
|
||||
ensure(!secondary_modes.empty());
|
||||
ensure(initial_mode_selected);
|
||||
// The secondary output only supports Linear PCM 2 Ch.
|
||||
add_sound_mode(CELL_AUDIO_OUT_SECONDARY, CELL_AUDIO_OUT_CODING_TYPE_LPCM, CELL_AUDIO_OUT_CHNUM_2, CELL_AUDIO_OUT_FS_48KHZ, CELL_AUDIO_OUT_SPEAKER_LAYOUT_2CH, true);
|
||||
|
||||
ensure(!primary_modes.empty() && initial_mode_selected.at(CELL_AUDIO_OUT_PRIMARY));
|
||||
ensure(!secondary_modes.empty() && initial_mode_selected.at(CELL_AUDIO_OUT_SECONDARY));
|
||||
|
||||
for (const CellAudioOutSoundMode& mode : primary_modes)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user