Dsp Devices, Am I Missing Something?

I’m worried that the handling of dsp devices is a bit inconsistent in the lua API. To insert a device I can use:

renoise.song().tracks[1]:insert_device_at("Audio/Effects/ Native/Bus Compressor", 2)  

The available devices that can be put between “” can be found in renoise.song().tracks[1].available_devices for example.

So far so good. The problem is that I can’t find this same string in renoise.song().tracks[1].devices[2]. .name will only say “Bus Compressor”.

Does this mean that it’s currently not possible to make a safe and future proof “copy dsp” tool? I will have to rely on string.find and hope there are no duplicates.

available_devices is what you can select for the specific track
renoise.song().tracks[1].devices[2].name is simply the name of the second device in the chain. If you want to check for duplicates you enumerate all device names to an array and then compare if there is a duplicate around.
note the following snippet is untested: (written in a texteditor)

  
local scanned_device = {}  
for x = 1, #renoise.song().tracks[1].devices[] do  
 local scanned_device[x] = renoise.song().tracks[1].devices[x].name  
 local count = 0  
 for y = 1, #renoise.song().tracks[1].devices[] do  
 if renoise.song().tracks[1].devices[x].name == scanned_device[x] then  
 count = count + 1  
 end  
 end  
 if count > 1 then  
 print(scanned_device[x].." effect appears "..tostring(count).." times")  
 end  
end  
  
  

I think i was very unclear with what i meant.

The thing is that the name (string) that’s being used when inserting a device is later not found anywhere in the device object. This causes problems.

Yes, it’s been acknowledged to be a hack.

Source: Tabs In `renoise.Song().Tracks[].Available_Devices`

The thing is that its you are inserting with an id, not a name, so its not necessarily inconsistent.

I think it’s pretty safe to split the string and take the end text after the last slash.

Thanks for your answer Conner.

Imo the ID that was used when inserting a device should also be available later in the device array. Searching for renoise.song().tracks[].devices[].name in renoise.song().tracks[].available_devices seems a bit unsafe. What happens if there is a VST named “Bus compressor”?

Or did I miss some golden value available someplace?

I think I have concluded that there is no safe way to match tracks[].devices[].name with .available_devices

For example device name “VST: mda: SubSynth” corresponds with “[307] => Audio/Effects/VST/mda SubSynth”, but there is no consistent pattern for this when it comes to VSTs. This means that the best you can do is to search for the last portion of the string, which is very unsafe (consider terms like “compressor” for example). Neither there is a :copy_from when it comes to dsps.

I just hope this issue will be addressed in a future API update.

We’ll try to add this in the next round. There are indeed no real workarounds for this yet.