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,
|
self::AudioUser::Unknown,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
AlsaEvent::AlsaCardReload => {
|
||||||
|
invoke_handlers(
|
||||||
|
handlers,
|
||||||
|
self::AudioSignal::CardReload,
|
||||||
|
self::AudioUser::Unknown,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,6 +32,8 @@ pub enum AlsaEvent {
|
|||||||
AlsaCardDiconnected,
|
AlsaCardDiconnected,
|
||||||
/// The values of the mixer changed, including mute state.
|
/// The values of the mixer changed, including mute state.
|
||||||
AlsaCardValuesChanged,
|
AlsaCardValuesChanged,
|
||||||
|
/// Alsa needs to be reloaded due to recoverable error.
|
||||||
|
AlsaCardReload,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -236,8 +238,9 @@ extern "C" fn watch_cb(
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
glib_sys::G_IO_STATUS_NORMAL => {
|
glib_sys::G_IO_STATUS_NORMAL => {
|
||||||
error!("Alsa failed to clear the channel");
|
// BUG: https://github.com/nicklan/pnmixer/issues/182
|
||||||
cb(AlsaEvent::AlsaCardError);
|
warn!("Alsa failed to clear the channel");
|
||||||
|
cb(AlsaEvent::AlsaCardReload);
|
||||||
}
|
}
|
||||||
glib_sys::G_IO_STATUS_ERROR => (),
|
glib_sys::G_IO_STATUS_ERROR => (),
|
||||||
glib_sys::G_IO_STATUS_EOF => {
|
glib_sys::G_IO_STATUS_EOF => {
|
||||||
|
@ -49,6 +49,7 @@ pub enum AudioSignal {
|
|||||||
CardDisconnected,
|
CardDisconnected,
|
||||||
CardError,
|
CardError,
|
||||||
ValuesChanged,
|
ValuesChanged,
|
||||||
|
CardReload,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ where
|
|||||||
&apps.prefs.borrow(),
|
&apps.prefs.borrow(),
|
||||||
AudioUser::Unknown,
|
AudioUser::Unknown,
|
||||||
));
|
));
|
||||||
}
|
},
|
||||||
(AudioSignal::CardError, _) => {
|
(AudioSignal::CardError, _) => {
|
||||||
if run_audio_error_dialog(
|
if run_audio_error_dialog(
|
||||||
&apps.gui.popup_menu.menu_window,
|
&apps.gui.popup_menu.menu_window,
|
||||||
@ -84,7 +84,14 @@ where
|
|||||||
AudioUser::Unknown,
|
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