pub trait Mixer: Send { fn open(Option) -> Self where Self: Sized; fn start(&self); fn stop(&self); fn set_volume(&self, volume: u16); fn volume(&self) -> u16; fn get_audio_filter(&self) -> Option> { None } } pub trait AudioFilter { fn modify_stream(&self, data: &mut [i16]); } #[cfg(feature = "alsa-backend")] pub mod alsamixer; #[cfg(feature = "alsa-backend")] use self::alsamixer::AlsaMixer; pub mod softmixer; use self::softmixer::SoftMixer; fn mk_sink(device: Option) -> Box { Box::new(M::open(device)) } pub fn find>(name: Option) -> Option) -> Box> { match name.as_ref().map(AsRef::as_ref) { None | Some("softvol") => Some(mk_sink::), #[cfg(feature = "alsa-backend")] Some("alsa") => Some(mk_sink::), _ => None, } }