simplify instrument making by restricting it to range -1..1

This commit is contained in:
Breval Ferrari 2025-05-30 10:44:28 +02:00
parent 11788900b9
commit f39306e3d6
Signed by: breval
GPG key ID: 5310EC237FE283D1

View file

@ -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::<BTreeMap<_, _>>();
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);