Skip to content

Commit 0b47594

Browse files
committed
Some fixes
1 parent f738893 commit 0b47594

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

alsawork/alsadevice.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,6 @@ void AlsaDevice::setMute(bool enabled)
368368

369369
bool AlsaDevice::getMute()
370370
{
371-
bool isMute = true;
372371
if (!currentMixerName_.empty()) {
373372
snd_mixer_t *handle = getMixerHanlde(id_);
374373
snd_mixer_elem_t* elem = initMixerElement(handle, currentMixerName_.c_str());
@@ -378,20 +377,22 @@ bool AlsaDevice::getMute()
378377
|| snd_mixer_selem_has_playback_switch_joined(elem)) {
379378
int value = 0;
380379
checkError(snd_mixer_selem_get_playback_switch(elem, channel, &value));
381-
isMute = bool(value);
380+
checkError(snd_mixer_close(handle));
381+
return bool(value);
382382
}
383383
if (snd_mixer_selem_has_capture_switch(elem)
384384
|| snd_mixer_selem_has_common_switch(elem)
385385
|| snd_mixer_selem_has_capture_switch_joined(elem)
386386
|| snd_mixer_selem_has_capture_switch_exclusive(elem)) {
387387
int value = 0;
388388
checkError(snd_mixer_selem_get_capture_switch(elem, channel, &value));
389-
isMute = bool(value);
389+
checkError(snd_mixer_close(handle));
390+
return bool(value);
390391
}
391392
}
392393
checkError(snd_mixer_close(handle));
393394
}
394-
return isMute;
395+
return true;
395396
}
396397

397398
std::string AlsaDevice::formatCardName(long long int id)

0 commit comments

Comments
 (0)