Orisu179 / AmatiPP

An audio plugin for live-coding effects in the Faust programming language. Based off of the Amati Project
MIT License
3 stars 1 forks source link

Slider `scale` metadata not interpreted #14

Closed hatchjaw closed 2 weeks ago

hatchjaw commented 1 month ago

Steps to Reproduce

import("stdfaust.lib");
freq = hslider("freq [scale:log]", 400, 20, 20000, .01);
gate = button("gate");
gain = hslider("gain", .5, 0, 1, .01);
process = os.square(freq),en.ar(.05, 1, gate) : *,gain : *;

Expected Behaviour

Actual behaviour

Here's how the freq slider looks in the Faust Web IDE: image

Thanks to the [scale:log] metadata, 400 (Hz) lies somewhere toward the middle of the slider.

Here's the equivalent for Amati++: image

NB. [scale:exp] and numerical metadata for setting the order of parameters in the UI (e.g. hslider("[10] myparam...) are also apparently not interpreted.

System

OS: Manjaro Linux Kernel: Linux 6.5.13-7-MANJARO Audio system: Pipewire (libpipewire 1.0.7)

Builds tested

sletz commented 1 month ago

Since the code used the APIUI helper class, I've just realised that the ratio related functions (which take the scale mapping in account) have to be used and not the setParamValue/getParamValueones.

Proper documentation added this morning in https://github.com/grame-cncm/faust/commit/c5d114f8ee61ab09445d50738b7099e9993c723f

And look at the new documentation here: https://github.com/grame-cncm/faust/blob/c5d114f8ee61ab09445d50738b7099e9993c723f/architecture/faust/gui/APIUI.h#L549

hatchjaw commented 1 month ago

Could juce::Slider::setSkewFactor help here?

sletz commented 1 month ago

Well the problem is to exactly reproduce what the Faust conversion functions currently do (see https://github.com/grame-cncm/faust/blob/master-dev/architecture/faust/gui/ValueConverter.h). So I think we should better use them to get a homogenous behaviour on every platform.