Skip to content
Snippets Groups Projects
Commit 2bc4ab39 authored by Lioncash's avatar Lioncash
Browse files

sink_details: Deduplicate long std::function repetition

We can just use type aliases to avoid needing to write the same long
type twice
parent 89ebef65
No related branches found
No related tags found
No related merge requests found
......@@ -14,16 +14,18 @@ namespace AudioCore {
class Sink;
struct SinkDetails {
SinkDetails(const char* id_, std::function<std::unique_ptr<Sink>(std::string)> factory_,
std::function<std::vector<std::string>()> list_devices_)
using FactoryFn = std::function<std::unique_ptr<Sink>(std::string)>;
using ListDevicesFn = std::function<std::vector<std::string>()>;
SinkDetails(const char* id_, FactoryFn factory_, ListDevicesFn list_devices_)
: id(id_), factory(std::move(factory_)), list_devices(std::move(list_devices_)) {}
/// Name for this sink.
const char* id;
/// A method to call to construct an instance of this type of sink.
std::function<std::unique_ptr<Sink>(std::string device_id)> factory;
FactoryFn factory;
/// A method to call to list available devices.
std::function<std::vector<std::string>()> list_devices;
ListDevicesFn list_devices;
};
extern const std::vector<SinkDetails> g_sink_details;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment