2017-01-20 19:39:05 +00:00
|
|
|
use std::borrow::Cow;
|
|
|
|
|
|
|
|
pub mod softmixer;
|
|
|
|
|
|
|
|
pub trait Mixer {
|
2017-01-25 21:22:53 +00:00
|
|
|
fn init(&self);
|
|
|
|
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-25 21:56:06 +00:00
|
|
|
fn get_stream_editor(&self) -> Option<Box<StreamEditor + 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
|
|
|
}
|
|
|
|
|
|
|
|
pub trait StreamEditor {
|
|
|
|
fn modify_stream<'a>(&self, data: &'a [i16]) -> Cow<'a, [i16]>;
|
2017-01-25 21:49:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
pub fn find(s: &str) -> Option<Box<Mixer + Send>> {
|
|
|
|
match s {
|
|
|
|
"SoftMixer" => Some(Box::new(softmixer::SoftMixer::new())),
|
|
|
|
_ => None,
|
|
|
|
}
|
2017-01-20 19:39:05 +00:00
|
|
|
}
|