[Touchosc] Set Device Parameter

Hi,
I am totally new to OSC, and using TouchOsc on iphone.
I’ve checked here and there and managed to make it properly “talk” to Renoise’s built-in OSC Server but now I’ve got a problem.

So, we’ve got the OSC string
/renoise/song/track/XXX/device/XXX/set_parameter_by_name(string, number)
and I’ve mapped a dial on TouchOsc to send
/renoise/song/track/001/device/001/set_parameter_by_name

But said dial will only send one numerical value.
That could still be ok, if somehow I were able to pre-set the other value (the device’s name, a string) to a constant, say “Cutoff”.
Is there any way to do so, is it an inherent limit, or will I have to add another brand new command into the Osc mapping lua script?

Thanks in advance

How about:
/song/track/XXX/device/XXX/set_parameter_by_index

Sorry, you are having trouble with the amount of arguments being send…

There could be a way to set the device by adding a local variable called “selected_parameter_index” on top of the OSC mapping lua script and then create two functions that each accepts one figure:
/song/track/XXX/device/XXX/set_selected_parameter

the other one could be
/song/track/XXX/device/XXX/set_selected_parameter_value
which would contain the code from the set_parameter_by_XXXX function in which you remove the first argument and internally apply the selected_parameter_index variable that you have set with the first one.

  
local selected_parameter_index = nil  
  
add_device_action {   
 pattern = "/set_selected_parameter",  
 description = "Set current selected parameter value of an device\n"..  
 "XXX is the device index, -1 the currently selected device",  
  
 arguments = { argument("number"),   
 argument("value", "number") },  
 handler = function(value)  
 selected_parameter_index = value  
 end  
}  
  
  
add_device_action {   
 pattern = "/set_selected_parameter_value",  
 description = "Set parameter value of a device [0 - 1]\n"..  
 "XXX is the device index, -1 the currently selected device",  
  
 arguments = { argument("number"),   
 argument("value","number") },  
 handler = function(track_index, device_index, value)  
 local tracks = song().tracks  
  
 if (track_index >= 1 and track_index <= #tracks) then  
 local devices = tracks[track_index].devices  
  
 if (device_index >= 1 and device_index <= #devices) then  
 local parameters = devices[device_index].parameters  
  
 if (parameter_index >= 1 and selected_parameter_index <= #parameters) then  
 local parameter = parameters[parameter_index]  
  
 local parameter_value = value * (parameter.value_max -   
 parameter.value_min) + parameter.value_min  
  
 parameter.value = clamp_value(parameter_value,   
 parameter.value_min, parameter.value_max)  
 end  
 end  
 end  
 end  
}  
  

Perhaps it is better to set the selected_parameter_index value to 1 by default instead of nil

Good idea! But, silly question… How are the XXX parameters interpreted into indices, exactly?
Because, I was thinking… what about
/song/track/XXX/device/XXX/parameter/XXX ?

If I write a new handler how do I interpret the XXX after /parameter as a indices into the parameters array of the given device?

Then you would need to add and change a lot of stuff in the available_messages and process_messages and need a complete new add_action function accepting one parameter to perform this for you.

What i did was creating one new function to set the parameter value you want to change and using an existing function to create a new one and make one change to it to allow only one argument instead of two to use the set parameter.
That is quite a no-brainer intervention whereas the other you have to trail and error to see if it works out, but your suggestion saves you the requirement of calling two OSC actions.