Skip to content

Instantly share code, notes, and snippets.

@Neurogami
Last active August 22, 2017 05:22
Show Gist options
  • Save Neurogami/05094732eff92c161f4ee99df62365f4 to your computer and use it in GitHub Desktop.
Save Neurogami/05094732eff92c161f4ee99df62365f4 to your computer and use it in GitHub Desktop.
Examples of custom OSC handlers for use in GlobalOscActions.lua (Renoise)
-- Assumes messages are sent from TouchOSC buttons and include extraneous values
-- The values are parsed by Renise but ignore by the handler code
local global_current_set_pattern = 1
local function set_pattern_loop(pattern_num)
renoise.song().transport:set_scheduled_sequence(pattern_num)
renoise.song().transport.loop_pattern = true
end
add_global_action {
pattern = "/ng/transport/loop_first_pattern",
description = "Set the first pattern to be the next loop",
arguments = { argument("ignore", "number") },
handler = function(ignore)
global_current_set_pattern = 1
set_pattern_loop(global_current_set_pattern)
end
}
add_global_action {
pattern = "/ng/transport/loop_next_pattern",
description = "Set the next pattern to be the next loop",
arguments = { argument("ignore", "number") },
handler = function(ignore)
global_current_set_pattern = global_current_set_pattern + 1
if (global_current_set_pattern > #(song().patterns) ) then
global_current_set_pattern = #(song().patterns)
end
set_pattern_loop(global_current_set_pattern)
end
}
add_global_action {
pattern = "/ng/transport/loop_prev_pattern",
description = "Set the previous pattern to be the next loop",
arguments = { argument("ignore", "number") },
handler = function(ignore)
global_current_set_pattern = global_current_set_pattern - 1
if (global_current_set_pattern < 1 ) then
global_current_set_pattern = 1
end
set_pattern_loop(global_current_set_pattern)
end
}
-- For more stuff on Renoise OSC scripting see http://jamesbritt.com/posts/renoise-send-track-scripting-with-lua-and-osc.html
-- See also my book, OSC for Artists http://osc.justthebestparts.com/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment