Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions src-tauri/src/audio/plugins/au_host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -727,10 +727,14 @@ fn param_info(unit: AudioUnit, id: u32) -> Option<PluginParamInfo> {
max: info.maxValue as f64,
default: info.defaultValue as f64,
value: value as f64,
stepped: matches!(
step: if matches!(
info.unit,
AudioUnitParameterUnit::Indexed | AudioUnitParameterUnit::Boolean
),
) {
1.0
} else {
0.0
},
read_only: !info
.flags
.contains(AudioUnitParameterOptions::Flag_IsWritable),
Expand Down Expand Up @@ -1271,7 +1275,7 @@ mod tests {
assert_eq!((gain.min, gain.max), (-96.0, 24.0));
assert!(!gain.read_only);
assert!(
params.iter().any(|p| p.stepped),
params.iter().any(|p| p.step > 0.0),
"no stepped parameter found"
);

Expand Down
6 changes: 5 additions & 1 deletion src-tauri/src/audio/plugins/clap_host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,11 @@ impl ClapInstance {
max: info.max_value,
default: info.default_value,
value,
stepped: info.flags.contains(ParamInfoFlags::IS_STEPPED),
step: if info.flags.contains(ParamInfoFlags::IS_STEPPED) {
1.0
} else {
0.0
},
read_only: info.flags.contains(ParamInfoFlags::IS_READONLY),
});
}
Expand Down
5 changes: 3 additions & 2 deletions src-tauri/src/audio/plugins/host_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ pub struct PluginParamInfo {
pub max: f64,
pub default: f64,
pub value: f64,
/// Stepped params (int/enum/toggle) render as discrete steps, not a slider.
pub stepped: bool,
/// One step in the `min..max` units for stepped params (int/enum/toggle),
/// 0 for continuous ones.
pub step: f64,
/// Read-only params are shown but not editable.
pub read_only: bool,
}
Expand Down
12 changes: 8 additions & 4 deletions src-tauri/src/audio/plugins/vst3_host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ impl Vst3Instance {
pub fn params(&self) -> Vec<PluginParamInfo> {
use vst3::Steinberg::Vst::ParameterInfo;
use vst3::Steinberg::Vst::ParameterInfo_::ParameterFlags_::{
kIsHidden, kIsList, kIsProgramChange, kIsReadOnly,
kIsHidden, kIsProgramChange, kIsReadOnly,
};

let mut out = Vec::new();
Expand All @@ -228,7 +228,11 @@ impl Vst3Instance {
max: 1.0,
default: info.defaultNormalizedValue,
value: self.controller.getParamNormalized(info.id),
stepped: info.stepCount > 0 || info.flags & kIsList != 0,
step: if info.stepCount > 0 {
1.0 / info.stepCount as f64
} else {
0.0
},
read_only: info.flags & kIsReadOnly != 0,
});
}
Expand Down Expand Up @@ -584,7 +588,7 @@ mod tests {
let Some(param) = instance
.params()
.into_iter()
.find(|p| !p.read_only && !p.stepped)
.find(|p| !p.read_only && p.step == 0.0)
else {
panic!("{name} has no continuous writable parameter");
};
Expand Down Expand Up @@ -650,7 +654,7 @@ mod tests {
let param = before
.params()
.into_iter()
.find(|p| !p.read_only && !p.stepped)
.find(|p| !p.read_only && p.step == 0.0)
.expect("a continuous parameter");
let target = if param.value > 0.5 { 0.25 } else { 0.75 };
before.set_param(param.id, target);
Expand Down
2 changes: 1 addition & 1 deletion src/lib/modules/audio/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export interface PluginParam {
max: number;
default: number;
value: number;
stepped: boolean;
step: number;
readOnly: boolean;
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/modules/flow/ui/effect/plugin.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
value={p.value}
min={p.min}
max={p.max}
step={p.stepped ? 1 : p.max > p.min ? (p.max - p.min) / 100 : 0.01}
step={p.step || (p.max > p.min ? (p.max - p.min) / 100 : 0.01)}
defaultValue={p.default}
onChange={(v) => setParam(p, v)} />
{/each}
Expand Down
Loading