Lua: get a plugin's current preset

In Lua, is it possible to retrieve information about the preset currently loaded in a given Plugin object?

I need a PresetRecord, for passing to a Plugin:load_preset() call, but that PresetRecord could be looked up via the preset name/label or URI so either of the latter would suffice I think. I’m not finding anything in the class reference documentation that would give me any of those things.

I’ll take the lack of response to mean it’s not possible. Fair enough. I have two more Lua questions which I’ll add here because I’m not sure which is the worse behaviour: creating/spamming multiple topics or adding questions to an existing topic that are not related to its title.

  1. The question in the first post.

  2. It is possible to get/set plugin parameter values via the get/set_plugin_insert_param() functions, and the set of those parameters seems to be the same set shown by the “Edit with generic controls” action in the mixer, all of which are numerical.

Is it possible, and if so: how, to get/set the ones not in that “edit” list. E.g. The currently selected “bank” (name?) of a Dragonfly Reverb, such as “Large Dark Hall”.

  1. Is it possible to select a track/route via Lua? Documentation suggests that it is but I’m getting a Fatal Error when I do this…

    local r = Session:route_by_name(“Audio 1”) - - the route to select
    local rtav = Editort:rtav_from_route(r) - - get its RouteTimeAxisView
    local sl = ArdourUI.SelectionList()
    Editor:set_selection(sl, ArdourUI.SelectionOp.Set)

Result is a Fatal Error saying “programming error: unknown selectable type passed to Selection:add()”. According to the manual’s Lua class reference, RouteTimeAxisView is a RouteUI which is a Selectable which is what set_selection() requires. So this error was unexpected. Am I doing something wrong?

This is in Mixbus32c, if that’s relevant.

P.S. Thank you devs for the Lua interface. I’m very much enjoying this ability to script behaviour. Thumbs up. And thanks again for Ardour/Mixbus while I’m at it.

I’ve just added bindings for the first two (available since 6.7-27, will be in the next update of Harrison Mixbus).

As for (2), you can query a list of scale-points (‘name’ → value pairs eg. “Large Hall” : 5).

There is currently no direct API to lookup values for given name, or directly get a list from a processor (without first querying the parameter-descriptor), but we can add some convenience wrappers if needed.

I do not know about (3). The code you have posted looks fine…

Thank you very much Robin. I’ll revisit this when the Mixbus update comes. And I’ll raise 3 as a bug in case it truly is.

I just realized that Editor:set_selection is exclusively for items that are only visible on the editor-timeline.

Track/Bus selection is synced with the Mixer and control-surfaces.

It is not currently possible to select track from Lua scripts, and there are some technical issues with exposing that API.

Okay, thanks for the update.

Those bindings are now present in Mixbus v7.1, thanks Robin.

However, I now see that the answer to question 2 isn’t quite what I was after. To use that Dragonfly example, the problem is that its “Bank” setting isn’t a parameter as such. I.e. It does not show up as a parameter when doing an Edit With Generic Controls, and neither does it show up in Lua when iterating through the plugin’s parameters/descriptors. So the question is, is there any way to get access to such settings in Lua, so its current value can be retrieved and set?

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.