From 4a89ff48ed1aa5f4739302608ee952460d8bd2f1 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sat, 11 Feb 2017 19:41:21 +0100 Subject: [PATCH] Fix --input-mapping= crashing on startup. --- audio_mixer.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/audio_mixer.cpp b/audio_mixer.cpp index e4d95a4..63758f9 100644 --- a/audio_mixer.cpp +++ b/audio_mixer.cpp @@ -184,7 +184,18 @@ AudioMixer::AudioMixer(unsigned num_cards) set_limiter_enabled(global_flags.limiter_enabled); set_final_makeup_gain_auto(global_flags.final_makeup_gain_auto); + r128.init(2, OUTPUT_FREQUENCY); + r128.integr_start(); + + // 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(); + if (!global_flags.input_mapping_filename.empty()) { + // Must happen after ALSAPool is initialized, as it needs to know the card list. current_mapping_mode = MappingMode::MULTICHANNEL; InputMapping new_input_mapping; if (!load_input_mapping_from_file(get_devices(), @@ -201,16 +212,6 @@ AudioMixer::AudioMixer(unsigned num_cards) current_mapping_mode = MappingMode::MULTICHANNEL; } } - - r128.init(2, OUTPUT_FREQUENCY); - r128.integr_start(); - - // 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) -- 2.39.2