Started implementation of 'patch' view

Things are moving quite fast because I want to start using old rubyk through mimas. I have spent some time trying to decipher how to make the patch appear as a view so that the same patterns can be used to create, remove or update elements in views or in the patch.

patch vs view

In case you wonder, the patch is the thing that represents the processing logic inside the server whereas the views just show controls to alter parameters inside this processing logic.

patch

In order to make the patch work, I implemented “to_hash” in oscit. This will also be used to save and restore patches.

I had some trouble understanding what to do view view-only information (like color, position) that is stored in the Node:

  • expose everything with methods ?
  • or keep this things hidden and use the controller to expose them in the patch view ?

After lots of hesitation, I decided to not clutter the method namespace with view elements and keep these two worlds separate. So now, if you dump a patch as Json, you will get something like this:

{
  "@view":{
    "widget":"Node",
    "x":0, "y":0, "width":60, "height":20, "hue":203
  },
  "@class":"/class/Metro",
  "out":{
    "bang":{"/v/value":{}}
  },
  "tempo":115
}

This example will probably change, but the main ideas are there: all information regarding view are stored in ’@view’. The “widget” attribute is used by the view to display the proper type of widget and the ”@class” attribute is used on object creation.

“out” lists the slots with outgoing links and all the other attributes are just serialization of the methods declared in the node/script.

patch_view

first patch view (no links inlets or outlets yet)

Gaspard Bucher

comments

  1. leave a comment