Slider Initial Value

I am trying to write a plugin that uses a variable initial value.


(setf variable 100.0)

;control slider "my slider" real "" variable -100 200

But it doesn’t work. I suspect this is because audacity is not able to resolve variables while creating the UI?

Is there a way to make this work?

Audacity and Nyquist are two separate programs. The Nyquist interpreter runs as a “subprogram” inside Audacity. The plugin header lines (starting with a semicolon at the top of the plugin code) are parsed by Audacity (not by Nyquist) while building the plugin GUI window. Audacity cannot recognize Nyquist variables, because at that time the Nyquist interpreter still is not running.

AFAIK there is no way to use variables for initializing slider or other values in the plugin header lines.

  • edgar

Thanks. I feared something like this.

What I am actually trying to do is use a variable stored in scratch from another pluton and use that. Can Audacity see the scratch variables at all? Is this a possible mechanism to get this to work?

No, Audacity can’t see scratch.

You can’t have a value of scratch display in the plug-in GUI, but you could have an option in the GUI to “Use scratch value if available”.
In the plug-in you can then test for the existence of your scratch variable, and if it exist, use that, else fall back to the GUI supplied value.