I tried a bit, but I’m stumped. I have no way to query the column position of the cursor in the API?
The first part of the code is easy:
local rns = renoise.song()
-- Set variables: iter, insrtument_number
local iter = rns.pattern_iterator:lines_in_pattern_track(rns.selected_pattern_index, rns.selected_track_index)
local tmp = renoise.song().selected_instrument_index
renoise.song():capture_nearest_instrument_from_pattern()
local instrument_number = renoise.song().selected_instrument_index
renoise.song().selected_instrument_index = tmp
This uses capture_nearest_instrument_from_pattern()
to find the instrument. There’s a caveat is that it looks forward, not backwards. Don’t think this will affect the outcome of the script too much, but it would be nice to have a backwards option in the API.
Next I thought I would use:
renoise.song().selected_note_column
Which returns a renoise.NoteColumn object. But this object doens’t let me query the column number? E.g.
oprint(renoise.song().selected_note_column)
class: NoteColumn
properties:
delay_string
delay_value
instrument_string
instrument_value
is_empty
is_selected
note_string
note_value
panning_string
panning_value
volume_string
volume_value
methods:
__STRICT
__eq
__tostring
clear
copy_from
The only other option I see is:
renoise.song().patterns[].tracks[].lines[].note_columns[].is_selected
But this works on selection, not cursor, which would make the script stupid.
In order to write this script. The API needs a new feature. We need: Query cursor position. It should return { pattern, track, column }. The column is tricky because the cursor could be in the Effects, which is a renoise.EffectColumn() object. Someone smarter than me will have to chime in.
Or did I miss something in the API that would return the current column position of the cursor?