Is there some way of distinguishing, inside of a renoise.song().tracks[].devices_observable function, between
a DSP being added from the box on the left (double clicking “Chorus”, “Filter”, etc.)
a device being pasted into the device chain
?
Something like this code:
local function devices_changed(change)
if (change.type == "insert") then
if (--[[device was copy-pasted]]) then
--do something
elseif (--[[device was added normally]]) then
--do something else
end
end
end
renoise.song().tracks[1].devices_observable:add_notifier(devices_changed)
No and i doubt it is possible to create such trigger.
With the instrument related devices you can somehow perform an educated guess by looking at the linked instrument:If it is linked, you can guess that the device was copied. However a device referencing to no instrument can also still be copy/pasted.
What would you like to achieve? perhaps there is another way to do that.
Currently, when using my DSP custom init tool, DSPs are initialized to a user-specified preset whenever they are added (triggered by devices_observable). Whenever a device is pasted into the chain, it gets initialized as well, which is annoying: you can’t copy/paste any devices that you’ve set custom init settings for. Since distinguishing between a paste and a normal device add isn’t possible, I’ll have to come up with a workaround. The only idea I can think of is having my tool provide some sort of special copy/paste menu entries…
Yep, it messes with the functionality of those as well. Whenever a device is added in any way (aside from loading songs, that doesn’t trigger the devices_observable), it will initialize that device to the custom init setting, if the user has specified one. This is more problematic than I realized.
That seems to be just about the only way of fully solving this. I can’t think of anything else.
Another way that might perhaps work is fetching the paremeters for the device and compare it to the initial values. If they are factory default, they are most likely inserted, if they are neither factory neither custom, they are copied for sure.
That however does mean that you need to put up a sophisticated routine that creates factory-parameter-profiles of each plugin when they are inserted if there is no factory profile. That is a bit of work.
And it might slow down the process if a plugin has a lot of parameters. (Some have a thousand)
Not too much work actually, as the tool only adds this functionality for native DSPs. Since right now I’m using the device.active_preset_data value to store DSP configurations, it wouldn’t be too hard to check added devices to see if they are in the default init configuration. Still bad behavior when someone tries to copy-paste devices in their normal init configuration, but better than nothing I suppose.
I expect devices having either custom init values or changed parameters when copy/pasted, they won’t come with factory defaults from the tracks unless the user decided to hit the ordinary “init” profile later after the device has been added to the track.