How To Remove Notifiers

I’ve a several notifiers on different tracks (prefx_volume, prefx_pan, mute_state, solo_state). Can i remove all this notifiers ON ALL tracks by one command? Now i’m using next code for each track:

one_track.prefx_volume.value_observable:remove_notifier(fn)

where fn - is separate function for each track. Troubles starting after i insert/remove tracks. It’s hard to code tracing channels movements (and looking for observed). Im prefer to kill all notifiers and setup new ones. Is it possible?

Please, help ! :)

Theres a syntax in Lua to call functions with variable names. (eg functions stored in global space)

  
function foo1()  
 print "Foo 1"  
end  
  
function foo2()  
 print "Foo 2"  
end  
  
function foo3()  
 print "Foo 3"  
end  
  
-- rprint(_G)  
for i=1,3 do  
 local x = 'foo' .. i  
 _G[x]()  
end  
  
  

maybe you can do something clever like

  
for i=1,#renoise.song().tracks do  
 -- Be clever?  
 if __REPLACE_ME__:has_notifier(_G[x]) then  
 __REPLACE_ME__:remove_notifier(_G[x])  
 end   
end  
  

Hope this helps.

Great. It’s really helps :) Thanx

Watch out when creating a new song - trying to removing a notifier which is attached to a gone song would result in an error.
In such a case, you can safely skip removing the notifiers, and just define new ones, as the old song will never trigger the now-obsolete ones…

2 Likes