mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-27 20:14:17 +01:00
Merge pull request #4120 from FearlessTobi/port-895
Port #895 from yuzu: "sink_details: std::move std::function instances "
This commit is contained in:
commit
c824564fcf
@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace AudioCore {
|
namespace AudioCore {
|
||||||
@ -13,16 +14,18 @@ namespace AudioCore {
|
|||||||
class Sink;
|
class Sink;
|
||||||
|
|
||||||
struct SinkDetails {
|
struct SinkDetails {
|
||||||
SinkDetails(const char* id_, std::function<std::unique_ptr<Sink>(std::string)> factory_,
|
using FactoryFn = std::function<std::unique_ptr<Sink>(std::string)>;
|
||||||
std::function<std::vector<std::string>()> list_devices_)
|
using ListDevicesFn = std::function<std::vector<std::string>()>;
|
||||||
: id(id_), factory(factory_), list_devices(list_devices_) {}
|
|
||||||
|
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.
|
/// Name for this sink.
|
||||||
const char* id;
|
const char* id;
|
||||||
/// A method to call to construct an instance of this type of sink.
|
/// 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.
|
/// 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;
|
extern const std::vector<SinkDetails> g_sink_details;
|
||||||
|
Loading…
Reference in New Issue
Block a user