Panic with this variation
chaosprint opened this issue · 3 comments
chaosprint commented
~gate: speed 2.2
>> seq ~a _~a _~a 72;
~a: choose 48 69 67 72 0 0 0
~amp: ~gate >> envperc 0.001 0.1
~pit: ~gate >> mul 261.63 >> mul 1.0
~lead: saw ~pit >> mul ~amp >> lpf ~mod 1.0
>> meta `
output = input.map(|x| x* sin(PI) );
output
`
~mod: sin 0.2 >> mul 1300 >> add 1500;
out: ~lead >> add ~drum >> plate 0.1 // optional semicolon
~drum: speed 4.4 >> seq 60 >> sp \808bd;
// live drag and drop your sample ^^^
chaosprint commented
guess there is sth wrong with sin(PI)
Jengamon commented
It's the PI
as replacing PI
with 0.1
doesn't crash the engine
Jengamon commented
Yup, with the current features rhai is used, using this code:
use rhai::{Engine, EvalAltResult};
pub fn main() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
let result = engine.eval::<f32>("PI")?;
println!("Answer: {result}");
Ok(())
}
I get Error: ErrorVariableNotFound("PI", 1:1)
EDIT: To fix it, you have to call it like a function:
use rhai::{Engine, EvalAltResult};
pub fn main() -> Result<(), Box<EvalAltResult>> {
let engine = Engine::new();
let result = engine.eval::<f32>("PI()")?;
println!("Answer: {result}");
Ok(())
}
and I've verified that this works in glicol today.