what aspects are laggy, updating the piano roll tool with the note-events out of the pattern editor while playing back a song?
I’ve found the place in code which make dragging notes lag. It’s when note positions and length is gathered from track. Maybe I can show it
Click to view contents
noteTone = {}
noteLength = {}
noteLine = {}
noteColumn = {}
lineValues = song.selected_pattern.tracks[trackId].lines
local columns = song.tracks[trackId].visible_note_columns
for c = 1, columns do
for s = 1, steps do
local note = lineValues[s].note_columns[c].note_value
if note < 120 then --120 is off, 121 is empty
table.insert(noteTone, note)
table.insert(noteLine, s)
table.insert(noteColumn, c)
end
end
end
This runs every time something is changed in track. And it lags even with small number of rows and columns which is strange. Apparently I should make iterations less frequent.
Maybe I should make track change only on mouse release or it will not be convenient for user?
Wow, great work, seems you are a Lua expert to begin with:). If the piano roll works well then I think making it like FL Studio piano roll features would be a general good direction.
Actually I’m not Lua expert. This tool and the one I tried to make couple of years ago, were my only experience. I’m more experienced in c#.
As for features, I’d like to add, is selection and dragging multiple notes, drawing line of notes with fixed length.
But I’m more eager to add some unusual features like pitchbend visually shown and edited on piano roll. Although I don’t know how to visualize it, not beeing able to draw diagonal lines or stretching images.
One more thing that is first on my list after the problem with lags is solved, is a feature which normally doesn’t belong to piano rolls. So that you could change track playback position with a click in play mode. Independent from global play position. It shouldn’t be that hard.