Call card_destroy_callback() when an ALSA element is removed

This commit is contained in:
Geoffrey D. Bennett
2025-02-21 00:21:12 +10:30
parent c7357c0539
commit ed4f9cbaa7

View File

@@ -811,12 +811,18 @@ static gboolean alsa_card_callback(
printf("card_callback_error %d\n", err); printf("card_callback_error %d\n", err);
exit(1); exit(1);
} }
if (snd_ctl_event_get_type(event) != SND_CTL_EVENT_ELEM) if (snd_ctl_event_get_type(event) != SND_CTL_EVENT_ELEM)
return 1; return 1;
int numid = snd_ctl_event_elem_get_numid(event); int numid = snd_ctl_event_elem_get_numid(event);
unsigned int mask = snd_ctl_event_elem_get_mask(event); unsigned int mask = snd_ctl_event_elem_get_mask(event);
if (mask == SND_CTL_EVENT_MASK_REMOVE) {
card_destroy_callback(card);
return 0;
}
if (!(mask & (SND_CTL_EVENT_MASK_VALUE | SND_CTL_EVENT_MASK_INFO))) if (!(mask & (SND_CTL_EVENT_MASK_VALUE | SND_CTL_EVENT_MASK_INFO)))
return 1; return 1;