mirror of
https://github.com/Lime3DS/Lime3DS
synced 2024-12-27 01:22:37 -06:00
Merge pull request #2296 from MerryMage/auto_is_auto
audio_core: SelectSink should default to auto if sink_id is invalid
This commit is contained in:
commit
42edd7911e
1 changed files with 7 additions and 12 deletions
|
@ -56,22 +56,17 @@ void AddAddressSpace(Kernel::VMManager& address_space) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SelectSink(std::string sink_id) {
|
void SelectSink(std::string sink_id) {
|
||||||
if (sink_id == "auto") {
|
|
||||||
// Auto-select.
|
|
||||||
// g_sink_details is ordered in terms of desirability, with the best choice at the front.
|
|
||||||
const auto& sink_detail = g_sink_details.front();
|
|
||||||
DSP::HLE::SetSink(sink_detail.factory());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto iter =
|
auto iter =
|
||||||
std::find_if(g_sink_details.begin(), g_sink_details.end(),
|
std::find_if(g_sink_details.begin(), g_sink_details.end(),
|
||||||
[sink_id](const auto& sink_detail) { return sink_detail.id == sink_id; });
|
[sink_id](const auto& sink_detail) { return sink_detail.id == sink_id; });
|
||||||
|
|
||||||
if (iter == g_sink_details.end()) {
|
if (sink_id == "auto" || iter == g_sink_details.end()) {
|
||||||
LOG_ERROR(Audio, "AudioCore::SelectSink given invalid sink_id");
|
if (sink_id != "auto") {
|
||||||
DSP::HLE::SetSink(std::make_unique<NullSink>());
|
LOG_ERROR(Audio, "AudioCore::SelectSink given invalid sink_id %s", sink_id.c_str());
|
||||||
return;
|
}
|
||||||
|
// Auto-select.
|
||||||
|
// g_sink_details is ordered in terms of desirability, with the best choice at the front.
|
||||||
|
iter = g_sink_details.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
DSP::HLE::SetSink(iter->factory());
|
DSP::HLE::SetSink(iter->factory());
|
||||||
|
|
Loading…
Reference in a new issue