Sinippet: Toggling Dsp Devices Using Midi Mapping

2479 com.vvoois.ToggleDevice_Rns270_V1.xrnx

It is pretty much simple to toggle a device on or off using a midi mapping.
If you install this tool you get two new entries, one in the Tools menu and if you open up the Midi mapping dialoge, you will find an entry in the “List” (If you unfold it!) named “com.vvoois.toggledevice”. Select that one and make Renoise learn your controller.

The example will toggle the second device of the current selected track.
If you have no device on that track, it will fire an error.

But it all boils down to one function being called if your midi controller is triggering the mapping event that you attached to it:

  
local function toggle_device_state()  
  
 --Set the device state of DSP device 2, reversed to what it is set to  
 --If it is true, set it to false and vice versa.  
 local device_state = renoise.song().tracks[renoise.song().selected_track_index].devices[2].is_active  
 renoise.song().tracks[renoise.song().selected_track_index].devices[2].is_active = not device_state  
  
end  
  

I think this should help you along the way.
You can also easily do this in the scripting terminal:
renoise.song().tracks[renoise.song().selected_track_index].devices[2].is_active = false
renoise.song().tracks[renoise.song().selected_track_index].devices[2].is_active = true