Renoise.Devicepameter Questions

I just noticed that renoise.song().tracks[].devices[].parameters[] array does not contain “Linked instrument” parameter for a MidiCcDevice instance.

Is there any specific reason for this lack? I understand that this parameter cannot be changed with a pattern command because of the 0…F range limitation, but why should this prevent scripting from accessing it?

also noticed that the name of the parameters are read-only and there is no way to set the CC values.

in general, I see that MidiCcDevice has been treated as any other device, although it has special abilities.

related:

maybe it’s just too late in the night of a tiring day, but how can I use observable notifiers in order to get the new value of a parameter?

  
 someRenoiseDeviceParameter.value_observable:add_notifier(  
 function(new_value)  
  
 --blabla with new_value  
  
 end  
)  
  

if i try like this, new_value is nil

renoise.DeviceParameter is part of the generic interface to a DSP device in Renoise. Basically it’s what Renoise offers automation for, what you see in Renoises UI as slider in a device and what’s offered in the automation view.

But DSP Devices are not just this, they also have non automateable data, or data which can not be easily wrapped into such a “single value” interface. Like for example the LFO Device’s envelope.
For the MidiCcDevice, the reason that the Linked instrument is not a device parameter is that it can not be automated. For the other parameter in the CC device we excluded them because we didn’t wanted to create more than 15 parameters to keep all of them automatable in the pattern.

In order to allow access to all those parameter in Lua, we’d have to publish specialized interfaces for each single device via the Lua API. This of course is possible, but simply quite a lot of work with all the devices we have. We should do so at some point, starting the all meta devices first, cause those are the devices which are most interesting to script, aren’t they?

You can’t. Only notifiers in views do right now pass the value in the notifier function. Would be nice if any observable would, but due to some technical internal problem we could not offer this so far…

yes, I understand and it is what I thought it was the problem

argh, this pretty much ruins my plans…

This indeed is not nice, but its no show stopper. There are many workarounds for this.

For example local function do memorize all their upvalues:

  
local parameter = someRenoiseDeviceParameter  
parameter.value_observable:add_notifier(function()  
 local new_value = parameter.value  
end)  
  

add_notifier also allows passing a context that is passed to the notifier as first argument

  
  
function parameter_changed(parameter)  
 local new_value = parameter.value  
end  
  
-- passed "context" can be any table or class object  
some_parameter.value_observable:add_notifier(parameter_changed, some_parameter)  
  

I thought about this solution but didn’t dare to try :)

now the show can go on, thanks!