diff options
| author | 2016-12-10 01:06:53 +0000 | |
|---|---|---|
| committer | 2016-12-10 01:26:22 +0000 | |
| commit | cef0f5b5a738c1e2ef32efd6c1010f5d97457d56 (patch) | |
| tree | 0aac24b1331c325c7e630fb1287e99661c495791 /src | |
| parent | Merge pull request #2241 from Subv/clang_format (diff) | |
| download | yuzu-cef0f5b5a738c1e2ef32efd6c1010f5d97457d56.tar.gz yuzu-cef0f5b5a738c1e2ef32efd6c1010f5d97457d56.tar.xz yuzu-cef0f5b5a738c1e2ef32efd6c1010f5d97457d56.zip | |
audio_core: SelectSink should default to auto if sink_id is invalid
Diffstat (limited to 'src')
| -rw-r--r-- | src/audio_core/audio_core.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/audio_core/audio_core.cpp b/src/audio_core/audio_core.cpp index 49260de7c..1065e2222 100644 --- a/src/audio_core/audio_core.cpp +++ b/src/audio_core/audio_core.cpp | |||
| @@ -56,22 +56,17 @@ void AddAddressSpace(Kernel::VMManager& address_space) { | |||
| 56 | } | 56 | } |
| 57 | 57 | ||
| 58 | void SelectSink(std::string sink_id) { | 58 | void SelectSink(std::string sink_id) { |
| 59 | if (sink_id == "auto") { | ||
| 60 | // Auto-select. | ||
| 61 | // g_sink_details is ordered in terms of desirability, with the best choice at the front. | ||
| 62 | const auto& sink_detail = g_sink_details.front(); | ||
| 63 | DSP::HLE::SetSink(sink_detail.factory()); | ||
| 64 | return; | ||
| 65 | } | ||
| 66 | |||
| 67 | auto iter = | 59 | auto iter = |
| 68 | std::find_if(g_sink_details.begin(), g_sink_details.end(), | 60 | std::find_if(g_sink_details.begin(), g_sink_details.end(), |
| 69 | [sink_id](const auto& sink_detail) { return sink_detail.id == sink_id; }); | 61 | [sink_id](const auto& sink_detail) { return sink_detail.id == sink_id; }); |
| 70 | 62 | ||
| 71 | if (iter == g_sink_details.end()) { | 63 | if (sink_id == "auto" || iter == g_sink_details.end()) { |
| 72 | LOG_ERROR(Audio, "AudioCore::SelectSink given invalid sink_id"); | 64 | if (sink_id != "auto") { |
| 73 | DSP::HLE::SetSink(std::make_unique<NullSink>()); | 65 | LOG_ERROR(Audio, "AudioCore::SelectSink given invalid sink_id %s", sink_id.c_str()); |
| 74 | return; | 66 | } |
| 67 | // Auto-select. | ||
| 68 | // g_sink_details is ordered in terms of desirability, with the best choice at the front. | ||
| 69 | iter = g_sink_details.begin(); | ||
| 75 | } | 70 | } |
| 76 | 71 | ||
| 77 | DSP::HLE::SetSink(iter->factory()); | 72 | DSP::HLE::SetSink(iter->factory()); |