sink_details.h 1009 B

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright 2018 yuzu Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #pragma once
  5. #include <functional>
  6. #include <memory>
  7. #include <string>
  8. #include <string_view>
  9. #include <utility>
  10. #include <vector>
  11. namespace AudioCore {
  12. class Sink;
  13. struct SinkDetails {
  14. using FactoryFn = std::function<std::unique_ptr<Sink>(std::string)>;
  15. using ListDevicesFn = std::function<std::vector<std::string>()>;
  16. SinkDetails(const char* id_, FactoryFn factory_, ListDevicesFn list_devices_)
  17. : id(id_), factory(std::move(factory_)), list_devices(std::move(list_devices_)) {}
  18. /// Name for this sink.
  19. const char* id;
  20. /// A method to call to construct an instance of this type of sink.
  21. FactoryFn factory;
  22. /// A method to call to list available devices.
  23. ListDevicesFn list_devices;
  24. };
  25. extern const std::vector<SinkDetails> g_sink_details;
  26. const SinkDetails& GetSinkDetails(std::string_view sink_id);
  27. } // namespace AudioCore