How To Observe When Notes Get Inserted Into Pattern

Hey all,

I can’t find anything observable that’ll tell me when a note has been inserted in to a pattern.

Am I going blind?

Is it possible to do this? Apols if I’ve missed something in the docs I’m a lua noob.

Cheers,
Tris

Via pattern:add_line_notifier(notifier_func)

Here’s an example on how to use it (copy and paste into testpad.lua):

[luabox]
– selected_pattern_lines_changed

function selected_pattern_lines_changed(pos)
rprint(pos) – test
end

– attach_to_selected_pattern

local attached_pattern = nil

function attach_to_selected_pattern()
if (attached_pattern) then
attached_pattern:remove_line_notifier(selected_pattern_lines_changed)
end

attached_pattern = renoise.song().selected_pattern
attached_pattern:add_line_notifier(selected_pattern_lines_changed)
end

– attach_to_song

function attach_to_song()
renoise.song().selected_pattern_observable:add_notifier(attach_to_selected_pattern)
end

– main

attach_to_song()
attach_to_selected_pattern()
[/luabox]

thanks taktik! works a treat. :)