kmixer: correct snd_mixer_selem_has_playback_channel() and snd_mixer_selem_has_capture_channel() return value checks

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-03-06 13:45:02 +02:00
parent d55b073025
commit 19136ed55b

View file

@ -244,93 +244,93 @@ QList<KSoundCard> KALSABackend::soundCards()
kchannel.m_cardid = alsacard; kchannel.m_cardid = alsacard;
if (kchannel.m_playback) { if (kchannel.m_playback) {
alsaresult = snd_mixer_selem_has_playback_channel(alsaelement, SND_MIXER_SCHN_FRONT_LEFT); alsaresult = snd_mixer_selem_has_playback_channel(alsaelement, SND_MIXER_SCHN_FRONT_LEFT);
if (alsaresult == 0) { if (alsaresult != 0) {
kchannel.m_type = KSoundChannel::KSoundChannelType::FrontLeft; kchannel.m_type = KSoundChannel::KSoundChannelType::FrontLeft;
kcard.m_channels.append(kchannel); kcard.m_channels.append(kchannel);
} }
alsaresult = snd_mixer_selem_has_playback_channel(alsaelement, SND_MIXER_SCHN_FRONT_RIGHT); alsaresult = snd_mixer_selem_has_playback_channel(alsaelement, SND_MIXER_SCHN_FRONT_RIGHT);
if (alsaresult == 0) { if (alsaresult != 0) {
kchannel.m_type = KSoundChannel::KSoundChannelType::FrontRight; kchannel.m_type = KSoundChannel::KSoundChannelType::FrontRight;
kcard.m_channels.append(kchannel); kcard.m_channels.append(kchannel);
} }
alsaresult = snd_mixer_selem_has_playback_channel(alsaelement, SND_MIXER_SCHN_REAR_LEFT); alsaresult = snd_mixer_selem_has_playback_channel(alsaelement, SND_MIXER_SCHN_REAR_LEFT);
if (alsaresult == 0) { if (alsaresult != 0) {
kchannel.m_type = KSoundChannel::KSoundChannelType::RearLeft; kchannel.m_type = KSoundChannel::KSoundChannelType::RearLeft;
kcard.m_channels.append(kchannel); kcard.m_channels.append(kchannel);
} }
alsaresult = snd_mixer_selem_has_playback_channel(alsaelement, SND_MIXER_SCHN_REAR_RIGHT); alsaresult = snd_mixer_selem_has_playback_channel(alsaelement, SND_MIXER_SCHN_REAR_RIGHT);
if (alsaresult == 0) { if (alsaresult != 0) {
kchannel.m_type = KSoundChannel::KSoundChannelType::RearRight; kchannel.m_type = KSoundChannel::KSoundChannelType::RearRight;
kcard.m_channels.append(kchannel); kcard.m_channels.append(kchannel);
} }
alsaresult = snd_mixer_selem_has_playback_channel(alsaelement, SND_MIXER_SCHN_FRONT_CENTER); alsaresult = snd_mixer_selem_has_playback_channel(alsaelement, SND_MIXER_SCHN_FRONT_CENTER);
if (alsaresult == 0) { if (alsaresult != 0) {
kchannel.m_type = KSoundChannel::KSoundChannelType::FrontCenter; kchannel.m_type = KSoundChannel::KSoundChannelType::FrontCenter;
kcard.m_channels.append(kchannel); kcard.m_channels.append(kchannel);
} }
alsaresult = snd_mixer_selem_has_playback_channel(alsaelement, SND_MIXER_SCHN_WOOFER); alsaresult = snd_mixer_selem_has_playback_channel(alsaelement, SND_MIXER_SCHN_WOOFER);
if (alsaresult == 0) { if (alsaresult != 0) {
kchannel.m_type = KSoundChannel::KSoundChannelType::Woofer; kchannel.m_type = KSoundChannel::KSoundChannelType::Woofer;
kcard.m_channels.append(kchannel); kcard.m_channels.append(kchannel);
} }
alsaresult = snd_mixer_selem_has_playback_channel(alsaelement, SND_MIXER_SCHN_SIDE_LEFT); alsaresult = snd_mixer_selem_has_playback_channel(alsaelement, SND_MIXER_SCHN_SIDE_LEFT);
if (alsaresult == 0) { if (alsaresult != 0) {
kchannel.m_type = KSoundChannel::KSoundChannelType::SideLeft; kchannel.m_type = KSoundChannel::KSoundChannelType::SideLeft;
kcard.m_channels.append(kchannel); kcard.m_channels.append(kchannel);
} }
alsaresult = snd_mixer_selem_has_playback_channel(alsaelement, SND_MIXER_SCHN_SIDE_RIGHT); alsaresult = snd_mixer_selem_has_playback_channel(alsaelement, SND_MIXER_SCHN_SIDE_RIGHT);
if (alsaresult == 0) { if (alsaresult != 0) {
kchannel.m_type = KSoundChannel::KSoundChannelType::SideRight; kchannel.m_type = KSoundChannel::KSoundChannelType::SideRight;
kcard.m_channels.append(kchannel); kcard.m_channels.append(kchannel);
} }
alsaresult = snd_mixer_selem_has_playback_channel(alsaelement, SND_MIXER_SCHN_REAR_CENTER); alsaresult = snd_mixer_selem_has_playback_channel(alsaelement, SND_MIXER_SCHN_REAR_CENTER);
if (alsaresult == 0) { if (alsaresult != 0) {
kchannel.m_type = KSoundChannel::KSoundChannelType::RearCenter; kchannel.m_type = KSoundChannel::KSoundChannelType::RearCenter;
kcard.m_channels.append(kchannel); kcard.m_channels.append(kchannel);
} }
} else if (hascapture) { } else if (hascapture) {
alsaresult = snd_mixer_selem_has_capture_channel(alsaelement, SND_MIXER_SCHN_FRONT_LEFT); alsaresult = snd_mixer_selem_has_capture_channel(alsaelement, SND_MIXER_SCHN_FRONT_LEFT);
if (alsaresult == 0) { if (alsaresult != 0) {
kchannel.m_type = KSoundChannel::KSoundChannelType::FrontLeft; kchannel.m_type = KSoundChannel::KSoundChannelType::FrontLeft;
kcard.m_channels.append(kchannel); kcard.m_channels.append(kchannel);
} }
alsaresult = snd_mixer_selem_has_capture_channel(alsaelement, SND_MIXER_SCHN_FRONT_RIGHT); alsaresult = snd_mixer_selem_has_capture_channel(alsaelement, SND_MIXER_SCHN_FRONT_RIGHT);
if (alsaresult == 0) { if (alsaresult != 0) {
kchannel.m_type = KSoundChannel::KSoundChannelType::FrontRight; kchannel.m_type = KSoundChannel::KSoundChannelType::FrontRight;
kcard.m_channels.append(kchannel); kcard.m_channels.append(kchannel);
} }
alsaresult = snd_mixer_selem_has_capture_channel(alsaelement, SND_MIXER_SCHN_REAR_LEFT); alsaresult = snd_mixer_selem_has_capture_channel(alsaelement, SND_MIXER_SCHN_REAR_LEFT);
if (alsaresult == 0) { if (alsaresult != 0) {
kchannel.m_type = KSoundChannel::KSoundChannelType::RearLeft; kchannel.m_type = KSoundChannel::KSoundChannelType::RearLeft;
kcard.m_channels.append(kchannel); kcard.m_channels.append(kchannel);
} }
alsaresult = snd_mixer_selem_has_capture_channel(alsaelement, SND_MIXER_SCHN_REAR_RIGHT); alsaresult = snd_mixer_selem_has_capture_channel(alsaelement, SND_MIXER_SCHN_REAR_RIGHT);
if (alsaresult == 0) { if (alsaresult != 0) {
kchannel.m_type = KSoundChannel::KSoundChannelType::RearRight; kchannel.m_type = KSoundChannel::KSoundChannelType::RearRight;
kcard.m_channels.append(kchannel); kcard.m_channels.append(kchannel);
} }
alsaresult = snd_mixer_selem_has_capture_channel(alsaelement, SND_MIXER_SCHN_FRONT_CENTER); alsaresult = snd_mixer_selem_has_capture_channel(alsaelement, SND_MIXER_SCHN_FRONT_CENTER);
if (alsaresult == 0) { if (alsaresult != 0) {
kchannel.m_type = KSoundChannel::KSoundChannelType::FrontCenter; kchannel.m_type = KSoundChannel::KSoundChannelType::FrontCenter;
kcard.m_channels.append(kchannel); kcard.m_channels.append(kchannel);
} }
alsaresult = snd_mixer_selem_has_capture_channel(alsaelement, SND_MIXER_SCHN_WOOFER); alsaresult = snd_mixer_selem_has_capture_channel(alsaelement, SND_MIXER_SCHN_WOOFER);
if (alsaresult == 0) { if (alsaresult != 0) {
kchannel.m_type = KSoundChannel::KSoundChannelType::Woofer; kchannel.m_type = KSoundChannel::KSoundChannelType::Woofer;
kcard.m_channels.append(kchannel); kcard.m_channels.append(kchannel);
} }
alsaresult = snd_mixer_selem_has_capture_channel(alsaelement, SND_MIXER_SCHN_SIDE_LEFT); alsaresult = snd_mixer_selem_has_capture_channel(alsaelement, SND_MIXER_SCHN_SIDE_LEFT);
if (alsaresult == 0) { if (alsaresult != 0) {
kchannel.m_type = KSoundChannel::KSoundChannelType::SideLeft; kchannel.m_type = KSoundChannel::KSoundChannelType::SideLeft;
kcard.m_channels.append(kchannel); kcard.m_channels.append(kchannel);
} }
alsaresult = snd_mixer_selem_has_capture_channel(alsaelement, SND_MIXER_SCHN_SIDE_RIGHT); alsaresult = snd_mixer_selem_has_capture_channel(alsaelement, SND_MIXER_SCHN_SIDE_RIGHT);
if (alsaresult == 0) { if (alsaresult != 0) {
kchannel.m_type = KSoundChannel::KSoundChannelType::SideRight; kchannel.m_type = KSoundChannel::KSoundChannelType::SideRight;
kcard.m_channels.append(kchannel); kcard.m_channels.append(kchannel);
} }
alsaresult = snd_mixer_selem_has_capture_channel(alsaelement, SND_MIXER_SCHN_REAR_CENTER); alsaresult = snd_mixer_selem_has_capture_channel(alsaelement, SND_MIXER_SCHN_REAR_CENTER);
if (alsaresult == 0) { if (alsaresult != 0) {
kchannel.m_type = KSoundChannel::KSoundChannelType::RearCenter; kchannel.m_type = KSoundChannel::KSoundChannelType::RearCenter;
kcard.m_channels.append(kchannel); kcard.m_channels.append(kchannel);
} }