fix(alsa): Use proper speaker mixer name and soundcard

The old code causes a segmentation fault, if the speaker and headphone
soundcards differ.
This commit is contained in:
patrick96 2018-02-12 11:29:55 +01:00 committed by NBonaparte
parent 802a27177c
commit f531613723

View File

@ -240,7 +240,7 @@ namespace modules {
} }
if (m_mixer[mixer::SPEAKER] && !m_mixer[mixer::SPEAKER]->get_name().empty() && !headphones) { if (m_mixer[mixer::SPEAKER] && !m_mixer[mixer::SPEAKER]->get_name().empty() && !headphones) {
mixers.emplace_back(new mixer_t::element_type( mixers.emplace_back(new mixer_t::element_type(
string{m_mixer[mixer::SPEAKER]->get_name()}, string{m_mixer[mixer::HEADPHONE]->get_sound_card()})); string{m_mixer[mixer::SPEAKER]->get_name()}, string{m_mixer[mixer::SPEAKER]->get_sound_card()}));
} }
if (cmd.compare(0, strlen(EVENT_TOGGLE_MUTE), EVENT_TOGGLE_MUTE) == 0) { if (cmd.compare(0, strlen(EVENT_TOGGLE_MUTE), EVENT_TOGGLE_MUTE) == 0) {