Problem with MainBlock Data Structure

April 27, 2010 Problems 0 Comments

Well, I've encountered a rather nasty problem with the MainBlock structure tonight during my attempts to get the new renderer working.  Here's how the structure works at the moment:

  • Each generative module is allowed to output an unlimited number of generative tracks, each with its own patch setting
  • The main structure keeps track of how many generative modules are loaded
  • The main structure keeps track of how many generative tracks have been outputted (>= the number of generative modules)

Unfortunately, this (poorly-thought-out) system creates a problem: generative tracks are "orphaned" from their parent generative modules.  That is, there is no way, unless the module-to-track mapping happens to be 1-to-1, to determine which generative track belongs to which modules in a given data structure.  Thus, the renderer cannot figure out how to assign instrument information to the tracks.

There are a few ways around this:

  • Enforce strict patch output in modules
    • Limit the "instrument" field to a certain number of instruments (piano, guitar, etc)
    • Default to piano
    • Eliminates the need to know the track's part
  • For each module, record the number of tracks outputted
  • For each track, record the ID of the parent module

The first fix, of course, is the most intuitive.  Tracks should, ideally, be completely independent of the modules that created them.  Unfortunately, this would require recompiling almost every plugin in existence, making sure that they all output proper patch information.  The other two are rather simple but hacky fixes.