Compare commits

...

2 Commits

Author SHA1 Message Date
Bel LaPointe
05b49a3777 accept multiple -p=STRING for chord 2026-03-11 15:40:08 -06:00
Bel LaPointe
bd0a6007f7 drop tone off 2026-03-11 15:37:05 -06:00
3 changed files with 6 additions and 22 deletions

View File

@@ -15,7 +15,7 @@ pub struct Flags {
pub sound_font: String,
#[arg(short, long, default_value = "c 2e+")]
pub play: Option<String>,
pub play: Vec<String>,
}
impl Flags {

View File

@@ -7,15 +7,17 @@ mod tone;
fn main() {
let flags = flags::Flags::new();
if flags.debug {
eprintln!("{:?}", flags);
}
let mut syn_seq = seq::new_syn(syn::Syn::new(
flags.debug,
flags.sound_font,
flags.sample_rate,
));
syn_seq.append(1, "3c1");
if let Some(play) = flags.play {
syn_seq.append(0, play);
for i in 0..flags.play.len() {
syn_seq.append(i as i32, flags.play[i].clone());
}
play(syn_seq, flags.sample_rate, flags.bpm);

View File

@@ -70,20 +70,6 @@ impl Syn {
};
}
fn tone_off(&mut self, ch: i32, b: tone::Tone) {
match self {
Syn::Real(syn) => syn.note_off(ch, b.i32()),
Syn::Text { m, .. } => {
match m.get_mut(&ch) {
Some(m) => {
m.remove(&b.i32());
}
None => {}
};
}
};
}
pub fn render(&mut self, a: &mut [f32], b: &mut [f32]) {
match self {
Syn::Real(syn) => syn.render(a, b),
@@ -106,8 +92,6 @@ mod test {
syn.tone_on(0, tone::new("c"));
syn.tone_on(0, tone::new("d"));
syn.tone_off(0, tone::new("d"));
let mut buffer1 = Vec::<f32>::new();
let mut buffer2 = Vec::<f32>::new();
syn.render(&mut buffer1, &mut buffer2);
@@ -120,8 +104,6 @@ mod test {
syn.tone_on(0, tone::new("c"));
syn.tone_on(0, tone::new("d"));
syn.tone_off(0, tone::new("d"));
let mut buffer1 = Vec::<f32>::new();
let mut buffer2 = Vec::<f32>::new();
syn.render(&mut buffer1, &mut buffer2);