[SOLVED] Startup notifier?

Hi, how would I go about creating a startup notifier that runs a couple of settings right whenever Renoise starts with a new document (at startup, or with “New song”)?
I’m basically looking to set “Keep Sequence Sorted” to false, and a few other things.

Also, how to modify the startup notifier to add another notifier that is run whenever a sample is recorded or loaded?

Ok, I got this to work

function startup_notifier()
local s=renoise.song()
renoise.song().sequencer.keep_sequence_sorted=false
end

if not renoise.tool().app_new_document_observable:has_notifier(startup_notifier) 
   then renoise.tool().app_new_document_observable:add_notifier(startup_notifier)
   else renoise.tool().app_new_document_observable:remove_notifier(startup_notifier)
end

so, everytime i start a new project, or load a new project i guess, it loads up with keep sequence sorted false.

but what I’m not making much headway is how to make Renoise show the sample that I just loaded, by using a notifier.

I tried this

function sample_loaded_change_to_sample_editor()
   renoise.app().window.active_middle_frame=5
end

if renoise.song().selected_sample == nil then return
else
if not renoise.song().selected_sample.sample_buffer_observable:has_notifier(sample_loaded_change_to_sample_editor) 
   then renoise.song().selected_sample.sample_buffer_observable:remove_notifier(sample_loaded_change_to_sample_editor)
   else renoise.song().selected_sample.sample_buffer_observable:add_notifier(sample_loaded_change_to_sample_editor)
end    

end

app_new_document_observable: will only run once about 10ms after loading a new song project. This allows many things, including restoring states in your tool.

You can iterate between all samples of the selected instrument for all observables.

It is better to think of this as if it were “a samples package”, not as if it were just one sample at a time.

Furthermore, this condition is contradictory:

It really is backwards (remove not):

  • If it doesn’t have a notifier, it doesn’t make sense use remove_.
  • If you have notifier, there is no point in using add_ (in fact this will return an error).

A healthy way to do this is to create a “queue function” that will be run every time you change samples. This function should remove all notifiers from all samples of the selected instrument.
So, it only remains to create another function that adds a single notifier in the selected sample.

1 Like

thanks! i removed the not altogether and it seems like it’s more sensible.
what really weirds me out is this:
if i’m in Sample Waveform, Keyzones, Modulation, FX, and i load a sample, i’m automatically in Waveform. if i’m in Phrase tab, Waveform doesn’t show. if i’m in pattern editor, the waveform doesn’t start displaying.

I used to have it so that if i’m in pattern editor and loaded a sample, i’d be moved to sample waveform tab.

what might have changed? i’m running 3.1.1

function sample_loaded_change_to_sample_editor_v2()
local w=renoise.app().window
if w.active_middle_frame == 1 then
w.active_middle_frame = renoise.ApplicationWindow.MIDDLE_FRAME_INSTRUMENT_SAMPLE_EDITOR
else end
renoise.song().selected_instrument.active_tab=1
renoise.app().window.active_middle_frame=5
 renoise.app():show_status("Transport to waveform successful")
end


function startup_notifier()
local s=renoise.song()
renoise.song().sequencer.keep_sequence_sorted=false
 renoise.app():show_status("Keep Sequence Sorted = False")
 
if renoise.song().selected_sample == nil then return
else
if renoise.song().selected_sample.sample_buffer_observable:has_notifier(sample_loaded_change_to_sample_editor_v2)
   then renoise.song().selected_sample.sample_buffer_observable:remove_notifier(sample_loaded_change_to_sample_editor_v2)
   else renoise.song().selected_sample.sample_buffer_observable:add_notifier(sample_loaded_change_to_sample_editor_v2)
end
end

 renoise.app():show_status("Keep Sequence Sorted = Falsadsgasdggasde")
end


if not renoise.tool().app_new_document_observable:has_notifier(startup_notifier) 
   then renoise.tool().app_new_document_observable:add_notifier(startup_notifier)
   else renoise.tool().app_new_document_observable:remove_notifier(startup_notifier)
end

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