diff options
author | Kelebek1 <eeeedddccc@hotmail.co.uk> | 2022-07-17 00:48:45 +0200 |
---|---|---|
committer | Kelebek1 <eeeedddccc@hotmail.co.uk> | 2022-07-22 02:11:32 +0200 |
commit | 458da8a94877677f086f06cdeecf959ec4283a33 (patch) | |
tree | 583166d77602ad90a0d552f37de8729ad80fd6c1 /src/audio_core/sink_details.cpp | |
parent | Merge pull request #8598 from Link4565/recv-dontwait (diff) | |
download | yuzu-458da8a94877677f086f06cdeecf959ec4283a33.tar yuzu-458da8a94877677f086f06cdeecf959ec4283a33.tar.gz yuzu-458da8a94877677f086f06cdeecf959ec4283a33.tar.bz2 yuzu-458da8a94877677f086f06cdeecf959ec4283a33.tar.lz yuzu-458da8a94877677f086f06cdeecf959ec4283a33.tar.xz yuzu-458da8a94877677f086f06cdeecf959ec4283a33.tar.zst yuzu-458da8a94877677f086f06cdeecf959ec4283a33.zip |
Diffstat (limited to '')
-rw-r--r-- | src/audio_core/sink/sink_details.cpp (renamed from src/audio_core/sink_details.cpp) | 27 |
1 files changed, 14 insertions, 13 deletions
diff --git a/src/audio_core/sink_details.cpp b/src/audio_core/sink/sink_details.cpp index c4cc66111..253c0fd1e 100644 --- a/src/audio_core/sink_details.cpp +++ b/src/audio_core/sink/sink_details.cpp @@ -5,21 +5,21 @@ #include <memory> #include <string> #include <vector> -#include "audio_core/null_sink.h" -#include "audio_core/sink_details.h" +#include "audio_core/sink/null_sink.h" +#include "audio_core/sink/sink_details.h" #ifdef HAVE_CUBEB -#include "audio_core/cubeb_sink.h" +#include "audio_core/sink/cubeb_sink.h" #endif #ifdef HAVE_SDL2 -#include "audio_core/sdl2_sink.h" +#include "audio_core/sink/sdl2_sink.h" #endif #include "common/logging/log.h" -namespace AudioCore { +namespace AudioCore::Sink { namespace { struct SinkDetails { using FactoryFn = std::unique_ptr<Sink> (*)(std::string_view); - using ListDevicesFn = std::vector<std::string> (*)(); + using ListDevicesFn = std::vector<std::string> (*)(bool); /// Name for this sink. const char* id; @@ -49,17 +49,18 @@ constexpr SinkDetails sink_details[] = { [](std::string_view device_id) -> std::unique_ptr<Sink> { return std::make_unique<NullSink>(device_id); }, - [] { return std::vector<std::string>{"null"}; }}, + [](bool capture) { return std::vector<std::string>{"null"}; }}, }; -const SinkDetails& GetSinkDetails(std::string_view sink_id) { +const SinkDetails& GetOutputSinkDetails(std::string_view sink_id) { auto iter = std::find_if(std::begin(sink_details), std::end(sink_details), [sink_id](const auto& sink_detail) { return sink_detail.id == sink_id; }); if (sink_id == "auto" || iter == std::end(sink_details)) { if (sink_id != "auto") { - LOG_ERROR(Audio, "AudioCore::SelectSink given invalid sink_id {}", sink_id); + LOG_ERROR(Audio, "AudioCore::Sink::GetOutputSinkDetails given invalid sink_id {}", + sink_id); } // Auto-select. // sink_details is ordered in terms of desirability, with the best choice at the front. @@ -79,12 +80,12 @@ std::vector<const char*> GetSinkIDs() { return sink_ids; } -std::vector<std::string> GetDeviceListForSink(std::string_view sink_id) { - return GetSinkDetails(sink_id).list_devices(); +std::vector<std::string> GetDeviceListForSink(std::string_view sink_id, bool capture) { + return GetOutputSinkDetails(sink_id).list_devices(capture); } std::unique_ptr<Sink> CreateSinkFromID(std::string_view sink_id, std::string_view device_id) { - return GetSinkDetails(sink_id).factory(device_id); + return GetOutputSinkDetails(sink_id).factory(device_id); } -} // namespace AudioCore +} // namespace AudioCore::Sink |