Fix: MIDI precision
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -131,7 +131,7 @@ pub(super) const WORDS: &[Word] = &[
|
||||
aliases: &[],
|
||||
category: "Sample",
|
||||
stack: "(v.. --)",
|
||||
desc: "Set duration",
|
||||
desc: "Set MIDI note duration (for audio, use gate)",
|
||||
example: "0.5 dur",
|
||||
compile: Param,
|
||||
varargs: true,
|
||||
|
||||
Reference in New Issue
Block a user