Last active
May 10, 2016 21:10
-
-
Save bjorn-nesby/0be894c6940031710946 to your computer and use it in GitHub Desktop.
Using xRules to take control of an XYPad device in Renoise
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
----------------------------------------------------------- | |
-- Ruleset definition for xRules | |
-- More info @ http://www.renoise.com/tools/xrules | |
----------------------------------------------------------- | |
return { | |
osc_enabled = true, | |
manage_voices = false, | |
description = "\"Automapping\" an XY Pad: the function will pass value 1+2 into any \nselected XY Pad - automation can be recorded too (enable edit mode)\n", | |
{ | |
osc_pattern = { | |
pattern_in = "/accxyz %f %f %f", | |
pattern_out = "", | |
}, | |
name = "Tilt → XY Pad", | |
actions = { | |
{ | |
call_function = [[--rprint(values) | |
local dev = rns.selected_device | |
if dev and (dev.name == "*XY Pad") then | |
local param_x = dev.parameters[1] | |
local param_y = dev.parameters[2] | |
local track_idx = rns.selected_track_index | |
local y = xLib.scale_value(values[1],1,-1,0,1) | |
local x = xLib.scale_value(values[2],-1,1,0,1) | |
x = xLib.clamp_value(x,0,1 | |
y = xLib.clamp_value(y,0,1) | |
if rns.transport.edit_mode then | |
record_automation(track_idx,param_x,x) | |
record_automation(track_idx,param_y,y) | |
else | |
if not has_automation(track_idx,param_x) then | |
param_x.value = x | |
end | |
if not has_automation(track_idx,param_y) then | |
param_y.value = y | |
end | |
end | |
end | |
]], | |
}, | |
}, | |
conditions = {}, | |
match_any = true, | |
midi_enabled = false, | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment