As I’ve mentioned here, I’m trying to make a plugin that automatically adjusts the quality parameters of all VST plugins in a song. I’m new to both Lua and XRNX development, so I might have gone about this problem the wrong way, since the performance of the below code is horrible. Can anyone spot a problem and nudge me in the right direction? Does a better way to enumerate all plugin parameters exist?
for t = 1, table.getn(renoise.song().tracks) do
local track = renoise.song().tracks[t]
print(track.name)
for d = 1, table.getn(track.devices) do
local device = track.devices[d]
print((" %s (%s)"):format(device.name, device.device_path))
if (device.is_active) then
for p = 1, table.getn(device.parameters) do
local parameter = device.parameters[p]
print((" %s: %d, min(%d), $max(%d), quantum(%d), default(%d)."):format(
parameter.name,
parameter.value,
parameter.value_min,
parameter.value_max,
parameter.value_quantum,
parameter.value_default
))
end
end
end
end
Removing the print statements doesn’t improve the performance. I know this can be an enormous amount of data to go through, but I don’t know how else I’m going to find the device parameters I’m interested in manipulating. I could add if statements inside each loop and not perform parameter iteration on unknown devices, but I would preferably like to list “known devices” in one column and “unknown devices” in another, which still requires me to loop through all parameters of all devices of all tracks. What can be done to optimize this?
Thanks!