IT IS MUSIC

This commit is contained in:
2026-03-11 12:58:02 -06:00
parent c0930d1ccc
commit b2095c4229
3 changed files with 25 additions and 6 deletions

View File

@@ -31,14 +31,28 @@ impl Syn {
Syn::Real(synthesizer)
}
pub fn tone_on(&mut self, b: tone::Tone) {
pub fn set(&mut self, b: tone::Tone) {
let a = 0 as i32;
match self {
// channel=[0..16)
// velocity=[0..128)
Syn::Real(syn) => {
syn.note_off_all_channel(a, false);
},
Syn::Text{m, ..} => {
m.clear();
},
};
self.tone_on(b);
}
fn tone_on(&mut self, b: tone::Tone) {
let a = 0 as i32;
match self {
// channel=[0..16)
// velocity=[0..128)
Syn::Real(syn) => syn.note_on(a, b.i32(), 127),
Syn::Text{m, ..} => {
eprintln!("tone_on({:?}, {:?}, {:?})", a, b.i32(), 127);
match m.get_mut(&a) {
Some(m2) => { m2.insert(b.i32(), 127); },
None => {
@@ -51,12 +65,11 @@ impl Syn {
};
}
pub fn tone_off(&mut self, b: tone::Tone) {
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, ..} => {
eprintln!("tone_off({:?}, {:?})", a, b.i32());
match m.get_mut(&a) {
Some(m) => { m.remove(&b.i32()); },
None => {},