summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2018-08-03 17:00:56 +0200
committerGitHub <noreply@github.com>2018-08-03 17:00:56 +0200
commitb6d61abd78ffd2c02d8aa6d8b6d455fbebb4c48f (patch)
treec7d7688c07ae32168e2b290d11388c847d51f437
parentMerge pull request #898 from lioncash/mig (diff)
parentsink_details: Deduplicate long std::function repetition (diff)
downloadyuzu-b6d61abd78ffd2c02d8aa6d8b6d455fbebb4c48f.tar
yuzu-b6d61abd78ffd2c02d8aa6d8b6d455fbebb4c48f.tar.gz
yuzu-b6d61abd78ffd2c02d8aa6d8b6d455fbebb4c48f.tar.bz2
yuzu-b6d61abd78ffd2c02d8aa6d8b6d455fbebb4c48f.tar.lz
yuzu-b6d61abd78ffd2c02d8aa6d8b6d455fbebb4c48f.tar.xz
yuzu-b6d61abd78ffd2c02d8aa6d8b6d455fbebb4c48f.tar.zst
yuzu-b6d61abd78ffd2c02d8aa6d8b6d455fbebb4c48f.zip
-rw-r--r--src/audio_core/sink_details.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/audio_core/sink_details.h b/src/audio_core/sink_details.h
index aa8aae1a9..ea666c554 100644
--- a/src/audio_core/sink_details.h
+++ b/src/audio_core/sink_details.h
@@ -6,6 +6,7 @@
#include <functional>
#include <memory>
+#include <utility>
#include <vector>
namespace AudioCore {
@@ -13,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_)
- : id(id_), factory(factory_), list_devices(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;