]> git.sesse.net Git - nageru/commitdiff
Fix a race during startup.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 5 Nov 2016 17:19:20 +0000 (18:19 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 5 Nov 2016 17:19:20 +0000 (18:19 +0100)
Doesn't actually matter in practice (only comes into play if pointer
reads/writes are non-atomic), but it's nice to make Helgrind happy.

audio_mixer.cpp
mainwindow.cpp

index e4d4cff4b86222e41d6b0d8181b8d519a1f1b6a1..38d80c6bb4405e489e8e064ac49e749a19a9a0ba 100644 (file)
@@ -170,8 +170,6 @@ AudioMixer::AudioMixer(unsigned num_cards)
          limiter(OUTPUT_FREQUENCY),
          correlation(OUTPUT_FREQUENCY)
 {
-       global_audio_mixer = this;
-
        for (unsigned bus_index = 0; bus_index < MAX_BUSES; ++bus_index) {
                locut[bus_index].init(FILTER_HPF, 2);
                eq[bus_index][EQ_BAND_BASS].init(FILTER_LOW_SHELF, 1);
@@ -184,7 +182,6 @@ AudioMixer::AudioMixer(unsigned num_cards)
        }
        set_limiter_enabled(global_flags.limiter_enabled);
        set_final_makeup_gain_auto(global_flags.final_makeup_gain_auto);
-       alsa_pool.init();
 
        if (!global_flags.input_mapping_filename.empty()) {
                current_mapping_mode = MappingMode::MULTICHANNEL;
@@ -210,6 +207,9 @@ AudioMixer::AudioMixer(unsigned num_cards)
        // hlen=16 is pretty low quality, but we use quite a bit of CPU otherwise,
        // and there's a limit to how important the peak meter is.
        peak_resampler.setup(OUTPUT_FREQUENCY, OUTPUT_FREQUENCY * 4, /*num_channels=*/2, /*hlen=*/16, /*frel=*/1.0);
+
+       global_audio_mixer = this;
+       alsa_pool.init();
 }
 
 void AudioMixer::reset_resampler(DeviceSpec device_spec)
index 4127f917cf35d77013d8bf76ec08a0c289300b1d..37b3af11659c700a1d3cf674d20999024157e1c1 100644 (file)
@@ -251,7 +251,6 @@ MainWindow::MainWindow()
        }
        midi_mapper.refresh_highlights();
        midi_mapper.refresh_lights();
-       midi_mapper.start_thread();
 }
 
 void MainWindow::resizeEvent(QResizeEvent* event)
@@ -366,6 +365,7 @@ void MainWindow::mixer_created(Mixer *mixer)
 
        midi_mapper.refresh_highlights();
        midi_mapper.refresh_lights();
+       midi_mapper.start_thread();
 
        struct sigaction act;
        memset(&act, 0, sizeof(act));