Renoise.Selectionblock Object

it’s been some days since I first thought such kind of object is necessary, but I preferred to wait for beta time in order to avoid adding stress to stress.

I think that a SelectionBlock is needed, in order to let the scripts act on selected area only.
The question is: how to effectively describe the block as an object?
The simple answer is: by the mean of its upper left and lower right corners.
This is surely right, but maybe there is some better way? For example, the object could have iterators do loop through all of its lines, tracks and columns, so that scripts could apply the same branch of code to a loop of entities.

With zero LUA or Renoise scripting experience I’d imagine imagine it would be useful as something like this:

(Some random pseudolanguage I made up)

  
int Step = 255/SelectionBlock.Length;  
 for (i=0; i<selectionblock.length i></selectionblock.length> {  
 for (ii=0; ii<selectionblock.line ii></selectionblock.line> {  
 Selectionblock.Line[i].Track[1].Column[ii].Volume = intToHex(Step*i);  
 }  
  
Selectionblock.Line[i].Track[1].EffectColumn[1] = 900+intToHex(Step*i);  
}  
  

Propably contains some errors, didn’t put much thought to the actual script, but you should get the point.

Might be it’s something that would definitely not work with Renoise or LUA, but would make sense to me to handle everything as arrays and using Array.Length to figure out the selected area (like Track.Length being the amount of tracks selected, Line.Length amount of lines and so on)

If you fumble with these two API functions you can get a long way:

  
-- true, when this column is selected in the pattern_editors current pattern  
renoise.song().patterns[].tracks[].lines[].note_columns[].is_selected ->  
 [read-only, boolean]  
  
renoise.song().patterns[].tracks[].lines[].effect_columns[].is_selected ->  
 [read-only, boolean]  
  

I do this with a custom Iterator class in the Notes Randomizer script.

Pretty basic, really. Look for “contrain to selected” or something (script not in front of me right now)

Yes, but this only queries IF a column is selected, you right now can not change a selection.

I think this is what IT meant…

well, knowing the boundaries of a selection would at least be something. Certainly vV’s method works, but it’s a bit tedious to read. Basically my idea was to easily access the current selection block in order, for example, to perform an enhanced note delay humanization which takes in count negative values by moving notes up in the lines array.

of course, being able to define a custom selection would open lots of other doors

Oh!

Controlling the selection (ability to move it around) would be cool.

Yes, this would allow for the age-old Alt-D behaviour (first Alt-D calculates LPB and maps 4 rows, second 8 rows, third 16 rows, etc). It was a great way of selecting things :dribble:

So, it is not possible to create or change a selection with the current api? We can only check if something is selected?

please add this. and the ability to use copy and paste with the API

would be really useful if we could access selections and copy/paste

+1