summaryrefslogtreecommitdiff
path: root/src/monitor.rs
diff options
context:
space:
mode:
authorGraham Northup <grissess@nexusg.org>2017-10-03 14:50:18 -0400
committerGraham Northup <grissess@nexusg.org>2017-10-03 14:50:18 -0400
commit22dd5bc5862e91330c8da0d5f141998cdbe546fb (patch)
tree253cb9f6b080caaad18b2df9f63004266bf73c27 /src/monitor.rs
parent145e2771c0d1ad30748da6e6ef1fabbd4cc2478c (diff)
Finished clientside parsing, starting graphics
Diffstat (limited to 'src/monitor.rs')
-rw-r--r--src/monitor.rs36
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);
+}