Fix: MIDI precision

This commit is contained in:
2026-03-18 02:16:05 +01:00
parent faf541e536
commit 30dfe7372d
24 changed files with 198 additions and 272 deletions

View File

@@ -1187,7 +1187,7 @@ impl Forth {
}
let dur = steps * ctx.step_duration();
cmd.set_param("fit", Value::Float(dur, None));
cmd.set_param("dur", Value::Float(dur, None));
cmd.set_param("gate", Value::Float(steps, None));
}
Op::At => {
@@ -1753,7 +1753,7 @@ fn cmd_param_float(cmd: &CmdRegister, name: &str) -> Option<f64> {
fn is_tempo_scaled_param(name: &str) -> bool {
matches!(
name,
"attack" | "decay" | "release" | "envdelay" | "hold" | "chorusdelay"
"attack" | "decay" | "release" | "envdelay" | "hold" | "chorusdelay" | "gate"
)
}
@@ -1769,7 +1769,7 @@ fn emit_output(
let mut out = String::with_capacity(128);
out.push('/');
let has_dur = params.iter().any(|(k, _)| *k == "dur");
let has_gate = params.iter().any(|(k, _)| *k == "gate");
let has_release = params.iter().any(|(k, _)| *k == "release");
let delaytime_idx = params.iter().position(|(k, _)| *k == "delaytime");
@@ -1806,11 +1806,11 @@ fn emit_output(
let _ = write!(&mut out, "delta/{delta_ticks}");
}
if !has_dur {
if !has_gate {
if !out.ends_with('/') {
out.push('/');
}
let _ = write!(&mut out, "dur/{}", step_duration * 4.0);
let _ = write!(&mut out, "gate/{}", step_duration * 4.0);
}
if !has_release {