Misc. defaults function - where to call from?

For stuff like showing the adv.edit panel, setting stuff to default values, like the base octave to 4, the cursor step to 1, etc etc… where should i call this function from, if i want it to load at startup of Renoise? – and preferably BEFORE any file(s) specified on the commandline are loaded?

(directly in the script’s global scope says the window isn’t yet created or something to that effect)

Hi delt, I’ve been taught to use an observable to run a function that sets these. Here’s what I’ve found from Paketti:

  
function startup_()  
 local s=renoise.song()  
 renoise.app().window:select_preset(1)  
  
 renoise.song().instruments[s.selected_instrument_index].active_tab=1  
 if renoise.app().window.active_middle_frame==0 and s.selected_sample.sample_buffer_observable:has_notifier(sample_loaded_change_to_sample_editor) then   
 s.selected_sample.sample_buffer_observable:remove_notifier(sample_loaded_change_to_sample_editor)  
 else  
 return  
 end  
end  
  
if not renoise.tool().app_new_document_observable:has_notifier(startup_)   
 then renoise.tool().app_new_document_observable:add_notifier(startup_)  
 else renoise.tool().app_new_document_observable:remove_notifier(startup_)  
end  
  

hope this helps…

from Renoise.Application.API.lua:

  
renoise.app().window.pattern_advanced_edit_is_visible  
  

All the other vars that you name like edit step, kb octave… they are bound to a Renoise.Song object, namely renoise.song() when a song is loaded. But it seems to me you just want some defaults you can also set up into your ‘Song Template’:

  • File->New
  • make changes like set base oct to 3 and edit step to 0 or whatever you like
  • go to Song Properties in the bottom and at the right hand side in the Template Song box click Save
  • obviously click Yes if you need to overwrite

So, as long as you keep the scripting to the renoise.app().window stuff like set adv. edit visible etc, you can do that before any song is loaded. The other stuff needs to be in a ‘new_document_observable’ listener function…
For adv. edit: oooooorrrr, you can customize the “saved Views” that are accessible in the 1-8 buttons at the top right of the Renoise win. Left click loads a view (as do F1-F8 in default setup), right click overwrites. I believe #1 is what will be loaded when Renoise starts but I’m not sure about that.