IT IS MUSIC
This commit is contained in:
21
src/syn.rs
21
src/syn.rs
@@ -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 => {},
|
||||
|
||||
Reference in New Issue
Block a user