]> git.sesse.net Git - nageru/blobdiff - input_mapping.cpp
When outputting debug messages for an audio device, refer to the device spec instead...
[nageru] / input_mapping.cpp
index deef92343c75c542b5aa9ecc698e8a4d94dec591..f894c95643cd6940e088f047e8d005193d9ffcad 100644 (file)
 using namespace std;
 using namespace google::protobuf;
 
+string spec_to_string(DeviceSpec device_spec)
+{
+       char buf[256];
+
+       switch (device_spec.type) {
+       case InputSourceType::SILENCE:
+               return "<silence>";
+       case InputSourceType::CAPTURE_CARD:
+               snprintf(buf, sizeof(buf), "Capture card %u", device_spec.index);
+               return buf;
+       case InputSourceType::ALSA_INPUT:
+               snprintf(buf, sizeof(buf), "ALSA input %u", device_spec.index);
+               return buf;
+       default:
+               assert(false);
+       }
+}
+
 bool save_input_mapping_to_file(const map<DeviceSpec, DeviceInfo> &devices, const InputMapping &input_mapping, const string &filename)
 {
        InputMappingProto mapping_proto;