I want to get the string representation from a device parameter value (not its float or int value) and display it in the log. I'm talking about the string string displayed in the device GUI in Ableton Live (like +1.5 db or 750 hz).
I see in Reactions there's not an action to get the string value in the Live Object Model. There is only "re enable automation" and "set value" under Device Parameter. So I look into this Live API: https://nsuspray.github.io/Live_API_Doc/11.0.0.xml
Under the DeviceParameter Class I found a str_for_value() method, just like re_enable_automation() which CSS has.
Is there a way to use this method in a Reaction? It supposedly returns a string, so I put something like this in the code:
parameter = self.song().view.selected_track.view.selected_device.parameters[1]
newValue = self.song().view.selected_track.view.selected_device.parameters[1].value
valueString =
self.song().view.selected_track.view.selected_device.parameters[1].str_for_value(parameter, newValue)
self.log_message("csslog: " + str(valueString))
But it gives me the error "Python argument types in " and nothing else. I also tried typing str_for_value() without arguments and gives me the same error.
How can I use this str_for_value() method in a Reaction to get the string?
Comments
OK, I got it. The method only needs one argument, not two. The argument is the float value of the parameter. It would be like this:
x = the number of the parameter
newValue = self.song().view.selected_track.view.selected_device.parameters[x].value
Then create a variable for the string (I'm abbreviating the path):
value string = {.....device.parameters{x}.str_for_value(newValue)
And then print it to the log:
self.log_message("csslog: " + str(valueString))