[SOLVED] Sneaking Suspicion(s) (pattern selection via LUA)

Ok, I’m going to pose a few suspicions that I woke up with today.
I’d like to confirm/deny these first, then start hacking at them ;)

Suspicion#1:

  1. It IS possible to read where the cursor is in the pattern (from LUA)

  2. it IS possible to modify cursor position in the pattern (via LUA)

  3. it IS possible to create a keyboard shortcut which takes the cursor from pattern editor row#32(or any other than row#0) to pattern editor row#0 (via LUA)

  4. it IS possible to then make a function in the keyboard shortcut - a “if/elseif” kind of behaviour, which states that if the cursor is already on row#0 - then this keyboard shortcut will take the cursor to row#0 of “first track”.

  5. and it IS possible to create the same behaviour for going from the first row(=any row other than last row) to pattern’s last row, and on repeat-press, take you to the last Send’s last row.

Suspicion#2:

  1. it ISN’T currently possible to use LUA to select a channel’s content
  2. it then ISN’T possible to use LUA to detect that the channel has been selected - and when “true”, then select the contents of the whole pattern.

Are these more or less correct? I can think of no other way to enable IT2-like “home + home” doublepresses, “end + end” doublepresses and “alt-L+alt-L” doublepresses. (=Would select track-cursor is on, second press would select the whole pattern).

But even having home+home would be amazing.

I’m not too familiar with the actual IT based keybindings but couldn’t you do something like the following psuedocode:

function select_track_or_pattern()  
 if pattern_editor.selection == pattern_editor.current_track then  
 pattern_editor.selection = pattern_editor.whole_pattern  
 else  
 pattern_editor.selection = pattern_editor.current_track  
 end  
end  

This function will set the selection to the whole pattern if the selection is already set to the current track else set the selection to the current track.

Thus, binding a key to this function would perform one of two actions depending upon the current selection.

Hope this helps, the alternative keybindings tool looks interesting. If you need any assistance/questions, feel free to get in touch.

Thanks. I’ll study this along with api list and hope to make some headway :)

Yes. However, not in realtime (yet?) since _observable isn’t available for that.

For sure.

Yes.

Yes.

Yes.

It isn’t possible to set a graphical block selection via LUA (yet?). However, all pattern data is accessible read/write in arrays so you can of course manipulate any pattern data you want.

It is possible to detect what track the cursor is in, but as stated before it isn’t possible to set a normal block selection. A bad solution is to make your custom selection routine which just tells the user via statusbar what the end and start of your “selection” is.

All of these variables and functions are kind of basic so if you need any help you can PM me.

Yes you can (the Epic Arpeggio and the Strum tools are using API calls to detect selections.). Simply add the .is_selected node behind the specific track data column content that you are scanning…
but doing the selections yourself:no, in that regard the user remains to have full and the only power over this.

Bantai posts HomeHome-tool
slight alteration to make it IT-like

Ok, first stab at endend: ( edit - second stab at endend, both functionalities! :) )
Added to v0.39

  
local function endend()  
local song_pos = renoise.song().transport.edit_pos  
local last = renoise.song().sequencer_track_count  
if (song_pos.line < renoise.song().selected_pattern.number_of_lines) then  
 renoise.song().transport.follow_player = false  
 renoise.song().transport.loop_block_enabled=false  
 song_pos.line = renoise.song().selected_pattern.number_of_lines  
 renoise.song().transport.edit_pos = song_pos  
 return  
 end  
 if (renoise.song().selected_track_index < renoise.song().sequencer_track_count) then  
 renoise.song().transport.follow_player = false  
 renoise.song().selected_track_index= last  
 --renoise.song().sequencer_track_count  
 return  
 end  
 renoise.app():show_status("[Phew, you escape!]")  
 renoise.song().transport.follow_player = false  
 renoise.song().transport.loop_block_enabled=false  
  
 end  

Hi. It just transpired in a different thread that there is a way of at least showing if the row your cursor is currently on, is selected.:

  
>>> rprint (renoise.song().selected_note_column.is_selected)  
false  

Wouldn’t this allow for going through all the rows of a track and detecting which of them are selected?

These are the “iterator” functions that you speak of.
There are some iterator snippets in the scripting.renoise.com site.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.