Automatically reload sound system when alsa channel is skewed
Bug report: https://github.com/nicklan/pnmixer/issues/182
This commit is contained in:
parent
c7a200085b
commit
0a39aa82b6
@ -352,5 +352,12 @@ fn on_alsa_event(
|
||||
self::AudioUser::Unknown,
|
||||
);
|
||||
}
|
||||
AlsaEvent::AlsaCardReload => {
|
||||
invoke_handlers(
|
||||
handlers,
|
||||
self::AudioSignal::CardReload,
|
||||
self::AudioUser::Unknown,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,6 +32,8 @@ pub enum AlsaEvent {
|
||||
AlsaCardDiconnected,
|
||||
/// The values of the mixer changed, including mute state.
|
||||
AlsaCardValuesChanged,
|
||||
/// Alsa needs to be reloaded due to recoverable error.
|
||||
AlsaCardReload,
|
||||
}
|
||||
|
||||
|
||||
@ -236,8 +238,9 @@ extern "C" fn watch_cb(
|
||||
continue;
|
||||
}
|
||||
glib_sys::G_IO_STATUS_NORMAL => {
|
||||
error!("Alsa failed to clear the channel");
|
||||
cb(AlsaEvent::AlsaCardError);
|
||||
// BUG: https://github.com/nicklan/pnmixer/issues/182
|
||||
warn!("Alsa failed to clear the channel");
|
||||
cb(AlsaEvent::AlsaCardReload);
|
||||
}
|
||||
glib_sys::G_IO_STATUS_ERROR => (),
|
||||
glib_sys::G_IO_STATUS_EOF => {
|
||||
|
@ -49,6 +49,7 @@ pub enum AudioSignal {
|
||||
CardDisconnected,
|
||||
CardError,
|
||||
ValuesChanged,
|
||||
CardReload,
|
||||
}
|
||||
|
||||
|
||||
|
@ -72,7 +72,7 @@ where
|
||||
&apps.prefs.borrow(),
|
||||
AudioUser::Unknown,
|
||||
));
|
||||
}
|
||||
},
|
||||
(AudioSignal::CardError, _) => {
|
||||
if run_audio_error_dialog(
|
||||
&apps.gui.popup_menu.menu_window,
|
||||
@ -84,7 +84,14 @@ where
|
||||
AudioUser::Unknown,
|
||||
));
|
||||
}
|
||||
}
|
||||
},
|
||||
(AudioSignal::CardReload, _) => {
|
||||
try_w!(audio_reload(
|
||||
apps.audio.as_ref(),
|
||||
&apps.prefs.borrow(),
|
||||
AudioUser::Unknown,
|
||||
));
|
||||
},
|
||||
_ => (),
|
||||
}),
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user