From f39306e3d6cf20cff81b37bde6140b6cf78a7ade Mon Sep 17 00:00:00 2001 From: Breval Ferrari Date: Fri, 30 May 2025 10:44:28 +0200 Subject: [PATCH] simplify instrument making by restricting it to range -1..1 --- src/compiler.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/compiler.rs b/src/compiler.rs index 39e3c27..816b982 100644 --- a/src/compiler.rs +++ b/src/compiler.rs @@ -1,8 +1,5 @@ use std::{ - any::{Any, TypeId}, - collections::{BTreeMap, HashMap}, - fmt::Debug, - str::FromStr, + any::{Any, TypeId}, collections::{BTreeMap, HashMap}, f64, fmt::Debug, str::FromStr }; use cfg_if::cfg_if; @@ -393,7 +390,7 @@ impl Context { let mut map = self.namespace_generator().collect::>(); map.insert('n'.to_string(), note as f64); while self.current_length()? > *self.get('t')? - curr_t + (1f64 / SAMPLE_RATE as f64) { - result.push(self.eval_with(&self.instrument, &mut map)?); + result.push(self.eval_with(&self.instrument, &mut map)? * f64::MAX); self.tick()?; map = self.namespace_generator().fold(map, |mut acc, (k, v)| { acc.insert(k, v);