Hi!I’m a bit confused with a function to do the following:
The function (you can copy to test):
function check_note( song, spi, sti, sli, snci )
song = renoise.song()
spi, sti, sli, snci = song.selected_pattern_index, song.selected_track_index, song.selected_line_index, song.selected_note_column_index
--song.patterns[spi]:add_line_notifier(check_note)
--if song.patterns[spi].tracks[sti].lines[sli].note_columns[snci].is_empty == true then
if song.patterns[spi].tracks[sti].lines[sli].note_columns[snci].note_value ~= 0 then --> C-0
vb.views['XXX_BT_01'].color = { 0x70,0x00,0x00 } --red
print("red")
else
vb.views['XXX_BT_01'].color = { 0x00,0x70,0x00 } --green
print("green")
end
--if song.patterns[spi]:has_line_notifier(check_note) then
--song.patterns[spi]:remove_line_notifier(check_note)
--end
end
--renoise.song().patterns[renoise.song().selected_pattern_index]:add_line_notifier(check_note)
renoise.tool().app_new_document_observable:add_notifier(check_note)
XXX_BT_01 = vb:button {
id = 'XXX_BT_01',
tooltip = 'C-0',
width = 32,--13,
height = 32,
--color = { 0x00,0x00,0x70 },
--pressed = function() end,
--released = function() end,
}
--------------------------------------------------------------------------------
-- GUI - TOOL 09
--------------------------------------------------------------------------------
TL09 =
vb:column {
--- ---
vb:horizontal_aligner {
vb:text { text = 'Check Notes' }
},
--- ---
XXX_BT_01
}
What I want to do is a function “check_note” that chases notes written in the pattern editor in the selected note column with the follow player is enabled,with the objective of changing the color of a button “XXX_BT_01”. Something simple.
For the moment, the “check_note” function detects correctly the note (is configured to detect the note with “0” value, the “C-0”).When the cursor of the pattern editor is selecting a row with the note C-0 already written previously, the “XXX_BT_01” button changes to green.If it is another note or empty value, the “XXX_BT_01” button is red.
The problem is that it only works when the tool (with this function) is loaded (“Tools/Reload all Tools” Menu), not in real time, while playing the pattern editor.What lines are missing for the “notifier” to work well?
It is necessary to use these lines?
--song.patterns[spi]:add_line_notifier(check_note)
&
--if song.patterns[spi]:has_line_notifier(check_note) then
--song.patterns[spi]:remove_line_notifier(check_note)
--end
How would it be correct?
If the function works properly, I could solve many options that I have in mind…
Note : how it should work properly, to check:
- Run the function (the tool)
- Write randomly several notes inside a track.Some notes should be the “C-0” (note value = 0).
- Play the pattern editor with follow player activated (the cursor follows the playback).
- What should happen:If the notes are different from C-0, the button is red color. If the notes are = C-0, the button change to green in real time.
My intention is a little broader: check in real time the 12 note colums on selected track, basically chase the notes inside only a track (for good performance)…
Please, help!!!
Thanks!