From 37fb8940ec8d58b6b79354ec948ce6cb47138c58 Mon Sep 17 00:00:00 2001 From: breel Date: Wed, 11 Mar 2026 09:22:48 -0600 Subject: [PATCH] rename note to tone for syn --- src/main.rs | 2 +- src/syn.rs | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main.rs b/src/main.rs index 0e4b7b7..58ef8d0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,7 +13,7 @@ fn main() { flags.sample_rate, ); // Play some tones (middle C, E, G). // 16 channels actually // 60=c 64=e 67=g //up to 128velocity though dont go below 50 tbh // 12 tones per octave - syn.note_on(0, tone::new("c").i32(), 127); + syn.tone_on(0, tone::new("c").i32(), 127); play(syn, flags.sample_rate, flags.bpm, flags.smallest_note); } diff --git a/src/syn.rs b/src/syn.rs index 5ef8750..970aac9 100644 --- a/src/syn.rs +++ b/src/syn.rs @@ -29,11 +29,11 @@ impl Syn { Syn::Real(synthesizer) } - pub fn note_on(&mut self, a: i32, b: i32, c: i32) { + pub fn tone_on(&mut self, a: i32, b: i32, c: i32) { match self { Syn::Real(syn) => syn.note_on(a, b, c), Syn::Text{m, ..} => { - eprintln!("note_on({:?}, {:?}, {:?})", a, b, c); + eprintln!("tone_on({:?}, {:?}, {:?})", a, b, c); match m.get_mut(&a) { Some(m2) => { m2.insert(b, c); }, None => { @@ -46,11 +46,11 @@ impl Syn { }; } - pub fn note_off(&mut self, a: i32, b: i32) { + pub fn tone_off(&mut self, a: i32, b: i32) { match self { Syn::Real(syn) => syn.note_off(a, b), Syn::Text{m, ..} => { - eprintln!("note_off({:?}, {:?})", a, b); + eprintln!("tone_off({:?}, {:?})", a, b); match m.get_mut(&a) { Some(m) => { m.remove(&b); }, None => {}, @@ -79,10 +79,10 @@ mod test { fn test_new_real() { let mut syn = Syn::new(false, "super_small_font.sf2".to_string(), 44100); - syn.note_on(1, 2, 3); - syn.note_on(2, 3, 4); + syn.tone_on(1, 2, 3); + syn.tone_on(2, 3, 4); - syn.note_off(2, 3); + syn.tone_off(2, 3); let mut buffer1 = Vec::::new(); let mut buffer2 = Vec::::new(); @@ -93,10 +93,10 @@ mod test { fn test_text() { let mut syn = Syn::new(true, ".sf2".to_string(), 1); - syn.note_on(1, 2, 3); - syn.note_on(2, 3, 4); + syn.tone_on(1, 2, 3); + syn.tone_on(2, 3, 4); - syn.note_off(2, 3); + syn.tone_off(2, 3); let mut buffer1 = Vec::::new(); let mut buffer2 = Vec::::new();