1 #ifndef _INPUT_MAPPING_H
2 #define _INPUT_MAPPING_H 1
9 enum class InputSourceType { SILENCE, CAPTURE_CARD, ALSA_INPUT };
14 bool operator== (const DeviceSpec &other) const {
15 return type == other.type && index == other.index;
18 bool operator< (const DeviceSpec &other) const {
19 if (type != other.type)
20 return type < other.type;
21 return index < other.index;
25 std::string display_name;
26 unsigned num_channels;
27 std::string alsa_name, alsa_info, alsa_address; // ALSA devices only, obviously.
30 static inline uint64_t DeviceSpec_to_key(const DeviceSpec &device_spec)
32 return (uint64_t(device_spec.type) << 32) | device_spec.index;
35 static inline DeviceSpec key_to_DeviceSpec(uint64_t key)
37 return DeviceSpec{ InputSourceType(key >> 32), unsigned(key & 0xffffffff) };
44 int source_channel[2] { -1, -1 }; // Left and right. -1 = none.
47 std::vector<Bus> buses;
50 bool save_input_mapping_to_file(const std::map<DeviceSpec, DeviceInfo> &devices,
51 const InputMapping &mapping,
52 const std::string &filename);
53 bool load_input_mapping_from_file(const std::map<DeviceSpec, DeviceInfo> &devices,
54 const std::string &filename,
55 InputMapping *mapping);
57 #endif // !defined(_INPUT_MAPPING_H)