]> git.sesse.net Git - nageru/blobdiff - nageru/audio_mixer.cpp
When the delay analyzer wants audio from an ALSA card, temporarily auto-enable captur...
[nageru] / nageru / audio_mixer.cpp
index e441aac19ff9bd1bb73c3c2b5a7094270ed0a31f..a04d204f21f0b765b5a6f8855d2c6c0c0f52f122 100644 (file)
@@ -1291,6 +1291,16 @@ InputMapping AudioMixer::get_input_mapping() const
        return input_mapping;
 }
 
+void AudioMixer::set_extra_devices(const set<DeviceSpec> &devices)
+{
+       lock_guard<timed_mutex> lock(audio_mutex);
+       extra_devices = devices;
+       for (unsigned card_index = 0; card_index < MAX_ALSA_CARDS; ++card_index) {
+               const DeviceSpec device_spec{InputSourceType::ALSA_INPUT, card_index};
+               start_or_stop_alsa_capture(device_spec);
+       }
+}
+
 unsigned AudioMixer::num_buses() const
 {
        lock_guard<timed_mutex> lock(audio_mutex);
@@ -1329,7 +1339,7 @@ void AudioMixer::start_or_stop_alsa_capture(DeviceSpec device_spec)
        assert(device_spec.type == InputSourceType::ALSA_INPUT);
        AudioDevice *device = find_audio_device(device_spec);
        bool previously_held = alsa_pool.device_is_held(device_spec.index);
-       bool should_be_held = !device->interesting_channels.empty();
+       bool should_be_held = !device->interesting_channels.empty() || extra_devices.count(device_spec);
        if (should_be_held) {
                alsa_pool.hold_device(device_spec.index);
        } else {