The Dance Between Selected_Note_Column/Selected_Effect_Column

Hi. I just made my first multipurpose usage for numpad + and - keys. If you are in the note_column, numpad + numpad - and shift-numpad+ and shift-numpad- control the delay value of the note. And if your cursor is in the effect_column, said 4 keys (+1, +1, -1, -10) control effect column amount_value.

So after some fiddling around I got these to work in such a way that they would cause no errors, and the locals wouldn’t cause issues as no directvalues were called, i.e., if note_column.bla didn’t exist because you’re in effect_column, you’d get an annoying error in the terminal.

I was also fiddling around with inserting “reverse” to the effect column, and got that to work. However, I couldn’t get it to work from the note_column, as I guess I’m going about this in a topsy-turvy way. I’m probably just missing something dead-obvious. Either way, I’m completely :panic: to be able to bind shortcuts into controlling this type of information. I’ve honestly lost minutes upon minutes tweaking the delay notes with these 4 binds, the delay values that I never liked trying to fix especially in played_in stuff, and stuff I’d never use if in the delay_value column or in the effect_column. LPB2 really comes to life!! And with that, hopefully less messy compositions! ;)

  
function revnote()  
local s = renoise.song()  
local efc = s.selected_effect_column  
--renoise.song().selected_effect_column_index=1  
-- if efc==nil then  
-- return  
-- else  
 if efc.number_value==11 then  
 renoise.song().selected_effect_column.number_value=00  
 renoise.song().selected_effect_column.amount_value=00  
 else  
 renoise.song().selected_effect_column.number_value=11  
 renoise.song().selected_effect_column.amount_value=00  
 end  
 --end  
 renoise.app().window.active_middle_frame = 1  
 renoise.app().window.lock_keyboard_focus=true  
  
end  
  
renoise.tool():add_keybinding {  
name = "Pattern Editor:Impulse:Reverse Sample effect 0B00 on/off",  
invoke = function() revnote()   
--renoise.song().selected_note_column_index=1  
end }  
  
function plusdelay(chg)  
 local s = renoise.song()  
 local t = s.selected_track  
 local nc = s.selected_note_column  
 local efc = s.selected_effect_column  
  
 if s.selected_note_column==nil then   
 s.selected_effect_column.amount_value = math.max(0, math.min(255, efc.amount_value +chg))   
 else  
 t.delay_column_visible=true  
 nc.delay_value = math.max(0, math.min(255, nc.delay_value + chg))  
 end  
 renoise.app().window.active_middle_frame = 1  
 renoise.app().window.lock_keyboard_focus=true  
end  
  
renoise.tool():add_keybinding {  
name = "Global:Impulse:Increase Delay +1",  
invoke = function() plusdelay(1) end }  
renoise.tool():add_keybinding {  
name = "Global:Impulse:Decrease Delay -1",  
invoke = function() plusdelay(-1) end }  
renoise.tool():add_keybinding {  
name = "Global:Impulse:Increase Delay +10",  
invoke = function() plusdelay(10) end }  
renoise.tool():add_keybinding {  
name = "Global:Impulse:Decrease Delay -10",  
invoke = function() plusdelay(-10) end }