]> git.sesse.net Git - nageru/commitdiff
Ask for the right number of channels when creating an ALSA device.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 18 Aug 2016 17:03:08 +0000 (19:03 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 19 Oct 2016 22:55:44 +0000 (00:55 +0200)
audio_mixer.cpp

index afff6f32fe4cec9beac774c75b2782d5cba01f2d..769dabfa74a0831cb6678a52f15d245d2c4ca6f2 100644 (file)
@@ -185,7 +185,8 @@ void AudioMixer::reset_alsa_mutex_held(DeviceSpec device_spec)
        if (device->interesting_channels.empty()) {
                device->alsa_device.reset();
        } else {
        if (device->interesting_channels.empty()) {
                device->alsa_device.reset();
        } else {
-               device->alsa_device.reset(new ALSAInput(available_alsa_cards[card_index].address.c_str(), OUTPUT_FREQUENCY, 2, bind(&AudioMixer::add_audio, this, device_spec, _1, _2, _3, _4)));
+               const ALSAInput::Device &alsa_dev = available_alsa_cards[card_index];
+               device->alsa_device.reset(new ALSAInput(alsa_dev.address.c_str(), OUTPUT_FREQUENCY, alsa_dev.num_channels, bind(&AudioMixer::add_audio, this, device_spec, _1, _2, _3, _4)));
                device->capture_frequency = device->alsa_device->get_sample_rate();
                device->alsa_device->start_capture_thread();
        }
                device->capture_frequency = device->alsa_device->get_sample_rate();
                device->alsa_device->start_capture_thread();
        }