diff options
author | Graham Northup <grissess@nexusg.org> | 2017-10-03 14:50:18 -0400 |
---|---|---|
committer | Graham Northup <grissess@nexusg.org> | 2017-10-03 14:50:18 -0400 |
commit | 22dd5bc5862e91330c8da0d5f141998cdbe546fb (patch) | |
tree | 253cb9f6b080caaad18b2df9f63004266bf73c27 /src/monitor.rs | |
parent | 145e2771c0d1ad30748da6e6ef1fabbd4cc2478c (diff) |
Finished clientside parsing, starting graphics
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); +} |