+// This is perhaps not the most user-friendly output, but it's at least better
+// than the raw index. It would be nice to have it identical to
+// Mixer::description_for_card for capture cards, though.
+string AudioMixer::spec_to_string(DeviceSpec device_spec) const
+{
+ char buf[256];
+
+ switch (device_spec.type) {
+ case InputSourceType::SILENCE:
+ return "<silence>";
+ case InputSourceType::CAPTURE_CARD: {
+ const AudioDevice *device = find_audio_device(device_spec);
+ if (device->card_type == CardType::FFMPEG_INPUT) {
+ snprintf(buf, sizeof(buf), "Virtual capture card %u (%s)", device_spec.index, device->display_name.c_str());
+ } else {
+ snprintf(buf, sizeof(buf), "Capture card %u (%s)", device_spec.index, device->display_name.c_str());
+ }
+ return buf;
+ }
+ case InputSourceType::ALSA_INPUT:
+ snprintf(buf, sizeof(buf), "ALSA input %u", device_spec.index);
+ return buf;
+ default:
+ assert(false);
+ }
+}
+
+