X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=audio_mixer.h;h=f2c77b91c8130cfba4a4edd3aa5200df87178b94;hb=95c6bc9d8e340b02112f713389390102d547cc4c;hp=93c9beb375768c3ed1707b8c8fec764bda017400;hpb=455786e07d6ea91bc8af639723f64ae367d6b4c6;p=nageru diff --git a/audio_mixer.h b/audio_mixer.h index 93c9beb..f2c77b9 100644 --- a/audio_mixer.h +++ b/audio_mixer.h @@ -35,7 +35,31 @@ enum class InputSourceType { SILENCE, CAPTURE_CARD }; 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; + return index < other.index; + } }; +struct DeviceInfo { + std::string name; + unsigned num_channels; +}; + +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 { @@ -61,7 +85,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 get_names() const; + std::map get_devices() const; void set_name(DeviceSpec device_spec, const std::string &name); void set_input_mapping(const InputMapping &input_mapping);