X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=nageru%2Faudio_mixer.cpp;fp=nageru%2Faudio_mixer.cpp;h=a04d204f21f0b765b5a6f8855d2c6c0c0f52f122;hb=5156378d4ad09d54791083e4067cf002e5431cb5;hp=e441aac19ff9bd1bb73c3c2b5a7094270ed0a31f;hpb=9768e380472e6ad68c8fc06efde3fa20f18bfc00;p=nageru diff --git a/nageru/audio_mixer.cpp b/nageru/audio_mixer.cpp index e441aac..a04d204 100644 --- a/nageru/audio_mixer.cpp +++ b/nageru/audio_mixer.cpp @@ -1291,6 +1291,16 @@ InputMapping AudioMixer::get_input_mapping() const return input_mapping; } +void AudioMixer::set_extra_devices(const set &devices) +{ + lock_guard 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 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 {