Song.patterns_observable sometimes missing some events?

I believe that patterns_observable sometimes can break, unless I made some rookie mistake.

My guess of possible cause, kind of: When using the duplicate sequence menu, while having “Keep sequence sorted” enabled, renoise will re-use any empty+non-used patterns that are found in between used patterns. This causes the patterns_observable not to reflect what really happened to the list. (?)

It can be reproduced by loading “DBlue - tension”, enable “keep sequence sorted” and duplicate sequence 15 with the code below (re)loaded.

-- extend table class
table.swap = function(t, index1, index2)
  t[index1], t[index2] = t[index2], t[index1]

class 'App'

function App:__init(args) =
  self.pattern_list = table.create()

  -- add newly inserted pattern to the internal list
  self.pattern_init = function(pattern_idx, pattern)
      self.pattern_list:insert(pattern_idx, pattern)

  -- update the internal list to reflect song.patterns
  self.update_pattern_list = function(event)
      if event.type == "insert" then
        local pattern =
        self.pattern_init(event.index, pattern)
      elseif event.type == "swap" then
        self.pattern_list:swap(event.index1, event.index2)
      elseif event.type == "remove" then

  -- initialize the internal list
  for pattern_idx, pattern in ipairs( do
    self.pattern_init(pattern_idx, pattern)
  -- add pattern list notifier


local app = App { song = }

Maybe this is related, I’m not sure: Uniqueness question

Thanks to 4tey for the heart.

1 Like

Okey cokey :slight_smile:

I don’t know myself if it related or not joule (probably not), but I thought I’d quickly mention it for reference :slight_smile:

The observable is the one that is used internally too, so it’s unlikely to miss some events, but the pattern object isn’t always available to lua within the notifier call. It should. I’ll check why it’s not…

1 Like