diff options
| author | 2018-08-03 11:00:56 -0400 | |
|---|---|---|
| committer | 2018-08-03 11:00:56 -0400 | |
| commit | b6d61abd78ffd2c02d8aa6d8b6d455fbebb4c48f (patch) | |
| tree | c7d7688c07ae32168e2b290d11388c847d51f437 | |
| parent | Merge pull request #898 from lioncash/mig (diff) | |
| parent | sink_details: Deduplicate long std::function repetition (diff) | |
| download | yuzu-b6d61abd78ffd2c02d8aa6d8b6d455fbebb4c48f.tar.gz yuzu-b6d61abd78ffd2c02d8aa6d8b6d455fbebb4c48f.tar.xz yuzu-b6d61abd78ffd2c02d8aa6d8b6d455fbebb4c48f.zip | |
Merge pull request #895 from lioncash/sink
sink_details: std::move std::function instances
| -rw-r--r-- | src/audio_core/sink_details.h | 13 |
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 @@ | |||
| 6 | 6 | ||
| 7 | #include <functional> | 7 | #include <functional> |
| 8 | #include <memory> | 8 | #include <memory> |
| 9 | #include <utility> | ||
| 9 | #include <vector> | 10 | #include <vector> |
| 10 | 11 | ||
| 11 | namespace AudioCore { | 12 | namespace AudioCore { |
| @@ -13,16 +14,18 @@ namespace AudioCore { | |||
| 13 | class Sink; | 14 | class Sink; |
| 14 | 15 | ||
| 15 | struct SinkDetails { | 16 | struct SinkDetails { |
| 16 | SinkDetails(const char* id_, std::function<std::unique_ptr<Sink>(std::string)> factory_, | 17 | using FactoryFn = std::function<std::unique_ptr<Sink>(std::string)>; |
| 17 | std::function<std::vector<std::string>()> list_devices_) | 18 | using ListDevicesFn = std::function<std::vector<std::string>()>; |
| 18 | : id(id_), factory(factory_), list_devices(list_devices_) {} | 19 | |
| 20 | SinkDetails(const char* id_, FactoryFn factory_, ListDevicesFn list_devices_) | ||
| 21 | : id(id_), factory(std::move(factory_)), list_devices(std::move(list_devices_)) {} | ||
| 19 | 22 | ||
| 20 | /// Name for this sink. | 23 | /// Name for this sink. |
| 21 | const char* id; | 24 | const char* id; |
| 22 | /// A method to call to construct an instance of this type of sink. | 25 | /// A method to call to construct an instance of this type of sink. |
| 23 | std::function<std::unique_ptr<Sink>(std::string device_id)> factory; | 26 | FactoryFn factory; |
| 24 | /// A method to call to list available devices. | 27 | /// A method to call to list available devices. |
| 25 | std::function<std::vector<std::string>()> list_devices; | 28 | ListDevicesFn list_devices; |
| 26 | }; | 29 | }; |
| 27 | 30 | ||
| 28 | extern const std::vector<SinkDetails> g_sink_details; | 31 | extern const std::vector<SinkDetails> g_sink_details; |