2017-01-27 13:20:31 +00:00
|
|
|
use self::softmixer::SoftMixer;
|
2017-01-20 19:39:05 +00:00
|
|
|
|
|
|
|
pub mod softmixer;
|
|
|
|
|
|
|
|
pub trait Mixer {
|
2017-01-25 21:22:53 +00:00
|
|
|
fn start(&self);
|
|
|
|
fn stop(&self);
|
|
|
|
fn set_volume(&self, volume: u16);
|
2017-01-20 19:39:05 +00:00
|
|
|
fn volume(&self) -> u16;
|
2017-01-27 13:20:31 +00:00
|
|
|
fn get_audio_filter(&self) -> Option<Box<AudioFilter + Send>> {
|
2017-01-25 21:22:53 +00:00
|
|
|
None
|
2017-01-20 19:39:05 +00:00
|
|
|
}
|
2017-01-25 21:22:53 +00:00
|
|
|
}
|
|
|
|
|
2017-01-27 13:20:31 +00:00
|
|
|
pub trait AudioFilter {
|
2017-02-01 21:16:28 +00:00
|
|
|
fn modify_stream(&self, data: &mut [i16]);
|
2017-01-25 21:49:18 +00:00
|
|
|
}
|
|
|
|
|
2017-01-27 13:20:31 +00:00
|
|
|
pub fn find<T: AsRef<str>>(name: Option<T>) -> Option<Box<Mixer + Send>> {
|
|
|
|
match name {
|
|
|
|
_ => Some(Box::new(SoftMixer::new())),
|
2017-01-25 21:49:18 +00:00
|
|
|
}
|
2017-01-20 19:39:05 +00:00
|
|
|
}
|