if (CurrentLine == rs.transport.edit_pos.line) then
return <<--------------------------------------- RETURN!!!
else
CurrentLine = rs.transport.edit_pos.line
-- here launch the desired function
end
Ok, this matter is solved already!!! :o :o :o
Thank you very much for the help, Danoise and 4Tey!!!
However, it does not solve a very strange reading problem. I explain…
You imagine a complex piano melody written using the 12 note columns, occupying several patterns.When the tool is working, it illuminates the buttons correctly (each button represents a note column).An image of support:
[sharedmedia=core:attachments:7374]
But a concrete failure always occurs:
When Renoise read the first line of each pattern (line 001 of each note column), if the line is empty, it sometimes "read the same note (change the characteristics of the button) as the first line of the previous pattern. It happens almost 90% of the time.It is a subtle error very annoying. Always the same. If I move the note of the previous pattern on line number 002, the error no longer occurs.
A ) Example of error :-------------------------------------------------------------------------
---------------- Pattern 01, note column 03
C-0 line 001
D-2 line 002
…
---------------- Pattern 02, note column 03
nocing line 001 <------- ERROR, here read a C-0 (As the same note from the previous pattern (same line 001)
… line 002
B ) Example not error-------------------------------------------------------------------
---------------- Pattern 01, note column 03
nocing line 001
D-2 line 002
…
---------------- Pattern 02, note column 03
nocing line 001 <------- NOT ERROR, because in the previous patter in line 001 is empty )
… line 002
…
This is the function that executes once each time a line starts:
function change_buttons( song, spi, sti, stpl )
song = renoise.song()
spi, sti, stpl = song.selected_pattern_index, song.selected_track_index, song.transport.playback_pos.line
if song.selected_track.type == renoise.Track.TRACK_TYPE_SEQUENCER then
-- note column 1
if song:pattern( spi ):track( sti ):line( stpl ):note_column( 1 ).note_string ~= '---' then
vb.views["TNC_NC_01"].text = song:pattern( spi ):track( sti ):line( stpl ):note_column( 1 ).note_string
vb.views["TNC_NC_01"].color = tnc_tr_color()--{ 0x00,0x70,0x00 }
end
if song:pattern( spi ):track( sti ):line( stpl ):note_column( 1 ).note_string == 'OFF' then
vb.views["TNC_NC_01"].color = { 0x40,0x00,0x00 }
end
-- note column 2
if song:pattern( spi ):track( sti ):line( stpl ):note_column( 2 ).note_string ~= '---' then
vb.views["TNC_NC_02"].text = song:pattern( spi ):track( sti ):line( stpl ):note_column( 2 ).note_string
vb.views["TNC_NC_02"].color = tnc_tr_color()--{ 0x00,0x70,0x00 }
end
if song:pattern( spi ):track( sti ):line( stpl ):note_column( 2 ).note_string == 'OFF' then
vb.views["TNC_NC_02"].color = { 0x40,0x00,0x00 }
end
-- note column 3
if song:pattern( spi ):track( sti ):line( stpl ):note_column( 3 ).note_string ~= '---' then
vb.views["TNC_NC_03"].text = song:pattern( spi ):track( sti ):line( stpl ):note_column( 3 ).note_string
vb.views["TNC_NC_03"].color = tnc_tr_color()--{ 0x00,0x70,0x00 }
end
if song:pattern( spi ):track( sti ):line( stpl ):note_column( 3 ).note_string == 'OFF' then
vb.views["TNC_NC_03"].color = { 0x40,0x00,0x00 }
end
-- note column 4
if song:pattern( spi ):track( sti ):line( stpl ):note_column( 4 ).note_string ~= '---' then
vb.views["TNC_NC_04"].text = song:pattern( spi ):track( sti ):line( stpl ):note_column( 4 ).note_string
vb.views["TNC_NC_04"].color = tnc_tr_color()--{ 0x00,0x70,0x00 }
end
if song:pattern( spi ):track( sti ):line( stpl ):note_column( 4 ).note_string == 'OFF' then
vb.views["TNC_NC_04"].color = { 0x40,0x00,0x00 }
end
-- note column 5
if song:pattern( spi ):track( sti ):line( stpl ):note_column( 5 ).note_string ~= '---' then
vb.views["TNC_NC_05"].text = song:pattern( spi ):track( sti ):line( stpl ):note_column( 5 ).note_string
vb.views["TNC_NC_05"].color = tnc_tr_color()--{ 0x00,0x70,0x00 }
end
if song:pattern( spi ):track( sti ):line( stpl ):note_column( 5 ).note_string == 'OFF' then
vb.views["TNC_NC_05"].color = { 0x40,0x00,0x00 }
end
-- note column 6
if song:pattern( spi ):track( sti ):line( stpl ):note_column( 6 ).note_string ~= '---' then
vb.views["TNC_NC_06"].text = song:pattern( spi ):track( sti ):line( stpl ):note_column( 6 ).note_string
vb.views["TNC_NC_06"].color = tnc_tr_color()--{ 0x00,0x70,0x00 }
end
if song:pattern( spi ):track( sti ):line( stpl ):note_column( 6 ).note_string == 'OFF' then
vb.views["TNC_NC_06"].color = { 0x40,0x00,0x00 }
end
-- note column 7
if song:pattern( spi ):track( sti ):line( stpl ):note_column( 7 ).note_string ~= '---' then
vb.views["TNC_NC_07"].text = song:pattern( spi ):track( sti ):line( stpl ):note_column( 7 ).note_string
vb.views["TNC_NC_07"].color = tnc_tr_color()--{ 0x00,0x70,0x00 }
end
if song:pattern( spi ):track( sti ):line( stpl ):note_column( 7 ).note_string == 'OFF' then
vb.views["TNC_NC_07"].color = { 0x40,0x00,0x00 }
end
-- note column 8
if song:pattern( spi ):track( sti ):line( stpl ):note_column( 8 ).note_string ~= '---' then
vb.views["TNC_NC_08"].text = song:pattern( spi ):track( sti ):line( stpl ):note_column( 8 ).note_string
vb.views["TNC_NC_08"].color = tnc_tr_color()--{ 0x00,0x70,0x00 }
end
if song:pattern( spi ):track( sti ):line( stpl ):note_column( 8 ).note_string == 'OFF' then
vb.views["TNC_NC_08"].color = { 0x40,0x00,0x00 }
end
-- note column 9
if song:pattern( spi ):track( sti ):line( stpl ):note_column( 9 ).note_string ~= '---' then
vb.views["TNC_NC_09"].text = song:pattern( spi ):track( sti ):line( stpl ):note_column( 9 ).note_string
vb.views["TNC_NC_09"].color = tnc_tr_color()--{ 0x00,0x70,0x00 }
end
if song:pattern( spi ):track( sti ):line( stpl ):note_column( 9 ).note_string == 'OFF' then
vb.views["TNC_NC_09"].color = { 0x40,0x00,0x00 }
end
-- note column 10
if song:pattern( spi ):track( sti ):line( stpl ):note_column( 10 ).note_string ~= '---' then
vb.views["TNC_NC_10"].text = song:pattern( spi ):track( sti ):line( stpl ):note_column( 10 ).note_string
vb.views["TNC_NC_10"].color = tnc_tr_color()--{ 0x00,0x70,0x00 }
end
if song:pattern( spi ):track( sti ):line( stpl ):note_column( 10 ).note_string == 'OFF' then
vb.views["TNC_NC_10"].color = { 0x40,0x00,0x00 }
end
-- note column 11
if song:pattern( spi ):track( sti ):line( stpl ):note_column( 11 ).note_string ~= '---' then
vb.views["TNC_NC_11"].text = song:pattern( spi ):track( sti ):line( stpl ):note_column( 11 ).note_string
vb.views["TNC_NC_11"].color = tnc_tr_color()--{ 0x00,0x70,0x00 }
end
if song:pattern( spi ):track( sti ):line( stpl ):note_column( 11 ).note_string == 'OFF' then
vb.views["TNC_NC_11"].color = { 0x40,0x00,0x00 }
end
-- note column 12
if song:pattern( spi ):track( sti ):line( stpl ):note_column( 12 ).note_string ~= '---' then
vb.views["TNC_NC_12"].text = song:pattern( spi ):track( sti ):line( stpl ):note_column( 12 ).note_string
vb.views["TNC_NC_12"].color = tnc_tr_color()--{ 0x00,0x70,0x00 }
end
if song:pattern( spi ):track( sti ):line( stpl ):note_column( 12 ).note_string == 'OFF' then
vb.views["TNC_NC_12"].color = { 0x40,0x00,0x00 }
end
--- ---
vb.views['TN_NC_NM_01'].text = string.format(" %s", song:pattern( spi ):track( sti ):line( stpl ):note_column( 1 ).note_string )
vb.views['TN_NC_NM_02'].text = string.format(" %s", song:pattern( spi ):track( sti ):line( stpl ):note_column( 2 ).note_string )
vb.views['TN_NC_NM_03'].text = string.format(" %s", song:pattern( spi ):track( sti ):line( stpl ):note_column( 3 ).note_string )
vb.views['TN_NC_NM_04'].text = string.format(" %s", song:pattern( spi ):track( sti ):line( stpl ):note_column( 4 ).note_string )
vb.views['TN_NC_NM_05'].text = string.format(" %s", song:pattern( spi ):track( sti ):line( stpl ):note_column( 5 ).note_string )
vb.views['TN_NC_NM_06'].text = string.format(" %s", song:pattern( spi ):track( sti ):line( stpl ):note_column( 6 ).note_string )
vb.views['TN_NC_NM_07'].text = string.format(" %s", song:pattern( spi ):track( sti ):line( stpl ):note_column( 7 ).note_string )
vb.views['TN_NC_NM_08'].text = string.format(" %s", song:pattern( spi ):track( sti ):line( stpl ):note_column( 8 ).note_string )
vb.views['TN_NC_NM_09'].text = string.format(" %s", song:pattern( spi ):track( sti ):line( stpl ):note_column( 9 ).note_string )
vb.views['TN_NC_NM_10'].text = string.format(" %s", song:pattern( spi ):track( sti ):line( stpl ):note_column( 10 ).note_string )
vb.views['TN_NC_NM_11'].text = string.format(" %s", song:pattern( spi ):track( sti ):line( stpl ):note_column( 11 ).note_string )
vb.views['TN_NC_NM_12'].text = string.format(" %s", song:pattern( spi ):track( sti ):line( stpl ):note_column( 12 ).note_string )
--- ---
end
end
It can probably be reduced.But, what can this error be?All notes already written on line 001 are well read, except the strange case above, which seems to read a note that is not written in the pattern editor…Really strange!!!
I’ll look to create a separate tool for them to you see…