text
This commit is contained in:
@@ -23,6 +23,7 @@ fn main() {
|
||||
let synthesizer = Synthesizer::new(&sound_font, &settings).unwrap();
|
||||
|
||||
let mut syn = Syn::Real(synthesizer);
|
||||
let mut syn = Syn::Text(std::collections::HashMap::new());
|
||||
|
||||
// Play some notes (middle C, E, G). // 16 channels actually // 60=c 64=e 67=g //up to 128velocity though dont go below 50 tbh // 12 notes per octave
|
||||
syn.note_on(0, 64 + 12, 127);
|
||||
@@ -49,28 +50,28 @@ fn main() {
|
||||
|
||||
enum Syn {
|
||||
Real(Synthesizer),
|
||||
Text,
|
||||
Text(std::collections::HashMap<i32, (i32, i32)>),
|
||||
}
|
||||
|
||||
impl Syn {
|
||||
fn note_on(&mut self, a: i32, b: i32, c: i32) {
|
||||
match self {
|
||||
Syn::Real(syn) => syn.note_on(a, b, c),
|
||||
Syn::Text => eprintln!("note_on({:?}, {:?}, {:?})", a, b, c),
|
||||
Syn::Text(m) => eprintln!("note_on({:?}, {:?}, {:?})", a, b, c),
|
||||
};
|
||||
}
|
||||
|
||||
fn note_off(&mut self, a: i32, b: i32) {
|
||||
match self {
|
||||
Syn::Real(syn) => syn.note_off(a, b),
|
||||
Syn::Text => eprintln!("note_off({:?}, {:?})", a, b),
|
||||
Syn::Text(m) => eprintln!("note_off({:?}, {:?})", a, b),
|
||||
};
|
||||
}
|
||||
|
||||
fn render(&mut self, a: &mut [f32], b: &mut [f32]) {
|
||||
match self {
|
||||
Syn::Real(syn) => syn.render(a, b),
|
||||
Syn::Text => eprintln!("render(..., ...)"),
|
||||
Syn::Text(m) => eprintln!("render({:?})", m),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user