]> git.sesse.net Git - nageru/blobdiff - audio_mixer.h
Prepare InputMappingDialog for arbitrary kinds of input source types, by storing...
[nageru] / audio_mixer.h
index 5ea79dea73713c82c6400c7855d53380cd3d844f..d45fd438153de3b6c768d59e760bb4c6b64c16d1 100644 (file)
@@ -36,6 +36,10 @@ struct DeviceSpec {
        InputSourceType type;
        unsigned index;
 
+       bool operator== (const DeviceSpec &other) const {
+               return type == other.type && index == other.index;
+       }
+
        bool operator< (const DeviceSpec &other) const {
                if (type != other.type)
                        return type < other.type;
@@ -43,6 +47,16 @@ struct DeviceSpec {
        }
 };
 
+static inline uint64_t DeviceSpec_to_key(const DeviceSpec &device_spec)
+{
+       return (uint64_t(device_spec.type) << 32) | device_spec.index;
+}
+
+static inline DeviceSpec key_to_DeviceSpec(uint64_t key)
+{
+       return DeviceSpec{ InputSourceType(key >> 32), unsigned(key & 0xffffffff) };
+}
+
 struct InputMapping {
        struct Bus {
                std::string name;
@@ -67,7 +81,7 @@ public:
        void set_current_loudness(double level_lufs) { loudness_lufs = level_lufs; }
 
        void set_fader_volume(unsigned bus_index, float level_db) { fader_volume_db[bus_index] = level_db; }
-       std::vector<std::string> get_names() const;
+       std::map<DeviceSpec, std::string> get_names() const;
        void set_name(DeviceSpec device_spec, const std::string &name);
 
        void set_input_mapping(const InputMapping &input_mapping);