]> git.sesse.net Git - nageru/blobdiff - nageru/delay_analyzer.cpp
When the delay analyzer wants audio from an ALSA card, temporarily auto-enable captur...
[nageru] / nageru / delay_analyzer.cpp
index b3127c4630567db073871b7f1505218a1028999b..5ad72e0003e81c7f7a433d1be734ae304cd79fd2 100644 (file)
@@ -59,6 +59,11 @@ void DelayAnalyzer::grab_clicked()
        ui->peak_display_2->reset_base();
        ui->peak_display_1->audio_clip_updated();
        ui->peak_display_2->audio_clip_updated();
+
+       set<DeviceSpec> devices;
+       devices.insert(get_selected_device(ui->card_combo_1));
+       devices.insert(get_selected_device(ui->card_combo_2));
+       global_audio_mixer->set_extra_devices(devices);
 }
 
 void DelayAnalyzer::card_selected(QComboBox *card_combo, int selected_index)
@@ -154,6 +159,7 @@ void DelayAnalyzer::add_audio(DeviceSpec device_spec, const uint8_t *data, unsig
            clip2.get_length_seconds_after_base(base) >= 1.0) {
                post_to_main_thread([this] {
                        grab_timeout->stop();
+                       global_audio_mixer->set_extra_devices({});  // Put on another thread so that we don't get recursive locking.
                });
                grabbing = false;
 
@@ -184,5 +190,6 @@ void DelayAnalyzer::estimate_delay()
 void DelayAnalyzer::grab_timed_out()
 {
        grabbing = false;
+       global_audio_mixer->set_extra_devices({});
        ui->delay_estimate_label->setText("Could not capture audio (timed out).");
 }