diff --git a/rs/main/examples/hello.rs b/rs/main/examples/hello.rs index 0e0ca28..ad95587 100644 --- a/rs/main/examples/hello.rs +++ b/rs/main/examples/hello.rs @@ -1,69 +1,8 @@ use glicol::Engine; -// use glicol::{EngineError, get_error_info}; - -// use glicol::GlicolNodeInfo; -// use std::collections::HashMap; - fn main() { - let mut engine = Engine::<32>::new(); + let mut engine = Engine::<8>::new(); engine - .update_with_code(r#"o: constsig 1.0 >> pan 0.9"#) + .update_with_code(r#"o: constsig 42 >> pan 0.9"#) .unwrap(); - // engine.update_with_code(r#"o: [0.1=>100, 1/2=> 1.0]"#); - // engine.update_with_code(r#"o: sin 440"#); - // engine.update_with_code(r#"// a sawtooth osc chained with a onepole filter - // // the first meta is to write a saw manually - // out: meta ` - // f = 220.; - // output.pad(128, 0.0); - // for i in 0..128 { - // output[i] = p * 2. - 1.; - // p += f / sr; - // }; - // if p > 1.0 { p -= 1.0 }; - // output - // ` >> meta ` - // r = 1./2000.; - // if phase == 0.0 { - // z = 0.0 - // } - // output.pad(128, 0.0); - // b = (-2.0 * PI() * r).exp(); - // a = 1.0 - b; - // for i in 0..128 { - // y = input[i] * a + b * z; - // output[i] = y; - // z = y; - // }; - // output - // ` - // // if the script has an input, you can use the "input" variable - // // the "input" is a 128-size array in web audio"#); - // match engine.update("o: imp 100 >> mul ~mod - // ~mo: sin 1 >> mul 0.5 >> add 0.5") { - // Ok(_) => {}, - // Err(e) => { - // println!("{:?}", e); - // // match e { - // // EngineError::ParsingError(e) => { - // // println!("{:?}", get_error_info(e)) - // // }, - // // _ => unimplemented!() - // // } - // } - // }; - // println!("refpairlist {:?}", engine.refpairlist); - // engine.update("o: saw 500 >> lpf 100.0 1.0; - - // ~mod: sin 0.2 >> mul 200.0 >> add 500.0"); - // engine.add_sample("\\bb", &[1.0], 1); - // engine.update(r#"o: imp 1 >> sp \808_0 >> delayms ~mod - - // ~mod: sin 0.2 >> mul 100 >> add 200"#); - // for e in engine.context.graph.edges(engine.context.destination) { - // println!("destinations {:?}", e); - // } println!("next block {:?}", engine.next_block(vec![])); - // engine.send_msg("o", 0, (0, "1.")); - // engine.next_block(); } diff --git a/rs/synth/src/node/effect/pan.rs b/rs/synth/src/node/effect/pan.rs index 279578e..8bc11df 100644 --- a/rs/synth/src/node/effect/pan.rs +++ b/rs/synth/src/node/effect/pan.rs @@ -1,6 +1,5 @@ use crate::{Buffer, Input, Message, Node}; use hashbrown::HashMap; -// use std::f32::consts::PI; #[derive(Debug, Clone)] pub struct Pan { @@ -31,7 +30,7 @@ impl Node for Pan { let (left, right) = output.split_at_mut(1); for ((left, right), sample) in left[0] .iter_mut() - .zip(right[1].iter_mut()) + .zip(right[0].iter_mut()) .zip(input_buffers[0].iter()) { *left = left_gain * sample; // Left channel