mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-30 03:32:55 +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_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.");
|
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{};
|
CellAudioOutSoundMode mode{};
|
||||||
mode.type = type;
|
mode.type = type;
|
||||||
mode.channel = channel;
|
mode.channel = channel;
|
||||||
mode.fs = fs;
|
mode.fs = fs;
|
||||||
mode.layout = layout;
|
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)
|
if (!selected && supported)
|
||||||
{
|
|
||||||
add_sound_mode(primary_modes, type, channel, fs, layout);
|
|
||||||
add_sound_mode(secondary_modes, type, channel, fs, layout);
|
|
||||||
|
|
||||||
if (!initial_mode_selected && supported)
|
|
||||||
{
|
{
|
||||||
// Pre-select the first available sound mode
|
// Pre-select the first available sound mode
|
||||||
primary_output.channels = primary_modes.front().channel;
|
output.channels = channel;
|
||||||
primary_output.encoder = primary_modes.front().type;
|
output.encoder = type;
|
||||||
secondary_output.channels = secondary_modes.front().channel;
|
|
||||||
secondary_output.encoder = secondary_modes.front().type;
|
|
||||||
|
|
||||||
// Set the initially selected configuration
|
// Set the initially selected configuration
|
||||||
primary_output.config.channel = primary_output.channels;
|
output.config.channel = channel;
|
||||||
primary_output.config.encoder = primary_output.encoder;
|
output.config.encoder = type;
|
||||||
primary_output.config.downMixer = CELL_AUDIO_OUT_DOWNMIXER_NONE;
|
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;
|
|
||||||
|
|
||||||
initial_mode_selected = true;
|
selected = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -108,41 +100,41 @@ audio_out_configuration::audio_out_configuration()
|
|||||||
case audio_format::surround_7_1:
|
case audio_format::surround_7_1:
|
||||||
{
|
{
|
||||||
// Linear PCM 7.1 Ch. 48 kHz
|
// 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
|
[[fallthrough]]; // Also add all available 5.1 formats in case the game doesn't like 7.1
|
||||||
}
|
}
|
||||||
case audio_format::surround_5_1:
|
case audio_format::surround_5_1:
|
||||||
{
|
{
|
||||||
// Linear PCM 5.1 Ch. 48 kHz
|
// 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.
|
// 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.
|
// 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;
|
break;
|
||||||
}
|
}
|
||||||
case audio_format::automatic: // Automatic based on supported formats
|
case audio_format::automatic: // Automatic based on supported formats
|
||||||
{
|
{
|
||||||
if (supports_lpcm_7_1) // Linear PCM 7.1 Ch.
|
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.
|
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.
|
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.
|
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;
|
break;
|
||||||
@ -152,27 +144,29 @@ audio_out_configuration::audio_out_configuration()
|
|||||||
const u32 selected_formats = g_cfg.audio.formats;
|
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
|
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
|
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.
|
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.
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Always add Linear PCM 2 Ch.
|
// Always add Linear PCM 2 Ch. to the primary output
|
||||||
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);
|
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());
|
// The secondary output only supports Linear PCM 2 Ch.
|
||||||
ensure(!secondary_modes.empty());
|
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(initial_mode_selected);
|
|
||||||
|
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)
|
for (const CellAudioOutSoundMode& mode : primary_modes)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user