need tone unset and rests

This commit is contained in:
2026-03-11 12:51:26 -06:00
parent fc91b666ce
commit c0930d1ccc
3 changed files with 44 additions and 14 deletions

View File

@@ -31,7 +31,8 @@ impl Syn {
Syn::Real(synthesizer)
}
pub fn tone_on(&mut self, a: i32, b: tone::Tone) {
pub fn tone_on(&mut self, b: tone::Tone) {
let a = 0 as i32;
match self {
// channel=[0..16)
// velocity=[0..128)
@@ -50,7 +51,8 @@ impl Syn {
};
}
pub fn tone_off(&mut self, a: i32, b: tone::Tone) {
pub fn tone_off(&mut self, b: tone::Tone) {
let a = 0 as i32;
match self {
Syn::Real(syn) => syn.note_off(a, b.i32()),
Syn::Text{m, ..} => {
@@ -83,10 +85,10 @@ mod test {
fn test_new_real() {
let mut syn = Syn::new(false, "super_small_font.sf2".to_string(), 44100);
syn.tone_on(1, tone::new("c"));
syn.tone_on(2, tone::new("d"));
syn.tone_on(tone::new("c"));
syn.tone_on(tone::new("d"));
syn.tone_off(2, tone::new("d"));
syn.tone_off(tone::new("d"));
let mut buffer1 = Vec::<f32>::new();
let mut buffer2 = Vec::<f32>::new();
@@ -97,10 +99,10 @@ mod test {
fn test_text() {
let mut syn = Syn::new(true, ".sf2".to_string(), 1);
syn.tone_on(1, tone::new("c"));
syn.tone_on(2, tone::new("d"));
syn.tone_on(tone::new("c"));
syn.tone_on(tone::new("d"));
syn.tone_off(2, tone::new("d"));
syn.tone_off(tone::new("d"));
let mut buffer1 = Vec::<f32>::new();
let mut buffer2 = Vec::<f32>::new();