diff options
Diffstat (limited to 'src/monitor.rs')
-rw-r--r-- | src/monitor.rs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/monitor.rs b/src/monitor.rs new file mode 100644 index 0000000..bef3fbc --- /dev/null +++ b/src/monitor.rs @@ -0,0 +1,36 @@ +use super::*; +use synth::SampleBuffer; +use std::collections::HashMap; + +pub struct VoiceDatum { + pitch: Pitch, + ampl: f32, +} + +pub enum Datum { + Voices(Vec<VoiceDatum>), + Samples(SampleBuffer), + Playtime(f32, f32), +} + +pub enum DatumKind { + Voices, + Samples, + Playtime, +} + +impl<'a> From<&'a Datum> for DatumKind { + fn from(d: &'a Datum) -> DatumKind { + match *d { + Datum::Voices(_) => DatumKind::Voices, + Datum::Samples(_) => DatumKind::Samples, + Datum::Playtime(_, _) => DatumKind::Playtime, + } + } +} + +pub type Data = HashMap<DatumKind, Datum>; + +pub trait Monitor { + fn process(&mut self, data: &Data); +} |