Views

From XDIF

Jump to: navigation, search

This is part of OSC Plug And Play.

Views are used to automatically display controls or map hardware controls in a controller to the controlled device. The view should be stored on the device itself to provide proper "plug and control" features.

Agreed standard

OSCit

In oscit all views live under the "/views" url and can be updated with Hash values, either to add new elements, update their attributes or remove them.

View example (/views/basic):

{
  "width":500, "height":270,
  "parts":{
    "1":{"class":"Slider", "x":10,  "y":50, "width":30,  "height":150, "hue":180, "connect":"/tempo"},
    "2":{"class":"Slider", "x":50,  "y":50, "width":30,  "height":150, "hue":130, "connect":"/other/deeply/nested/slider"},
    "3":{"class":"Button", "x":90,  "y":50, "width":30,  "height":30,  "hue":100, "connect":"/tempo", "value":100},
    "4":{"class":"Pad",    "x":130, "y":50, "width":150, "height":150, "hue":80,  "connect_x":"/tempo", "connect_y":"/other/deeply/nested/slider"},
    "5":{"class":"Slider", "x":290, "y":50, "width":20,  "height":100, "hue":0.0,   "connect":"/not_ready"}
    "6":{"class":"Slider", "x":10, "y":210, "width":300,  "height":30, "hue":200,   "connect":"/other/deeply/nested/slider"}
  }
}

To update the position of slider "5", the GUI sends the following Json encoded Hash:

{
  "parts":{
    "5":{"x":390, "y":60}
  }
}

and receives the equivalent in a "/.reply".

As you can see, this is very easy on resources: exchanged data is constant however big and complex the view becomes.

plans in Rubyk

Use the same Hash based content description to update the structure of a patch (max/MSP 'edit' mode). This would compensate for the lack of "POST" and "DELETE" operations on urls in OSC.

Patch description example:

{
  "width":500, "height":300,
  "parts":{
    "metro":{"class":"/rubyk/Metro", "x":40, "y":50, "tempo":120, "out":{"bang":["/singer/in/clic", "/transp/in/step"]}},
    "singer":{"class":"/rubyk/Lua", "x":40, "y":70, "script":"... script content ...", "out":{"notes":["/transp/in/notes"]}},
    "transp":{"class":"/joe/Transposer", "x":40, "y":90, "tuning":"Pythagorean", "out":{"notes":["/midi/notes"]}},
    "midi":{"class":"/rubyk/MidiOut", "x":40, "y":110, "port":"Live"},
  }
}
Personal tools