populating umenu with output_routings


    Jul 16 2010 | 11:03 pm
    Hi,
    I am fairly new to max and am attempting to create a patch that allows control over track routing via a midi controller.
    The problem is i am unsure on how to go about populating the umenu or preferably the live.menu object with a list of output routings from live.object.
    I have tried using the iter object in conjunction with a prepend append object, which works to some extent but has problems with spaces in some items such as "Ext. Out" and "Sends Only". I know this probably isn't the correct way to go about it but it is the closest i have got so far.
    I have pasted the patch below for reference:
    {
    "boxes" : [ {
    "box" : {
    "maxclass" : "message",
    "text" : "set current_output_routing $1",
    "fontname" : "Arial Bold",
    "numinlets" : 2,
    "patching_rect" : [ 80.0, 417.0, 153.0, 16.0 ],
    "id" : "obj-59",
    "numoutlets" : 1,
    "fontsize" : 10.0,
    "outlettype" : [ "" ]
    }
    }
    , {
    "box" : {
    "maxclass" : "newobj",
    "text" : "iter",
    "fontname" : "Arial Bold",
    "numinlets" : 1,
    "patching_rect" : [ 30.0, 345.0, 26.0, 18.0 ],
    "id" : "obj-56",
    "numoutlets" : 1,
    "fontsize" : 10.0,
    "outlettype" : [ "" ]
    }
    }
    , {
    "box" : {
    "maxclass" : "message",
    "text" : "path live_set view selected_track",
    "fontname" : "Arial Bold",
    "numinlets" : 2,
    "patching_rect" : [ 39.0, 193.0, 168.0, 16.0 ],
    "id" : "obj-47",
    "numoutlets" : 1,
    "fontsize" : 10.0,
    "outlettype" : [ "" ]
    }
    }
    , {
    "box" : {
    "maxclass" : "umenu",
    "fontname" : "Arial Bold",
    "numinlets" : 1,
    "types" : [ ],
    "patching_rect" : [ 39.0, 396.0, 100.0, 18.0 ],
    "id" : "obj-27",
    "numoutlets" : 3,
    "fontsize" : 10.0,
    "outlettype" : [ "int", "", "" ],
    "items" : [ "Ext.", ",", "Out", ",", "Master", ",", "DRUMS", ",", "MISC", ",", "MELODY", ",", "PAD", ",", "BASS", ",", "RESAMPLE", ",", "3/4", ",", "Sends", ",", "Only" ]
    }
    }
    , {
    "box" : {
    "maxclass" : "newobj",
    "text" : "route output_routings",
    "fontname" : "Arial",
    "numinlets" : 1,
    "patching_rect" : [ 39.0, 323.0, 124.0, 20.0 ],
    "id" : "obj-16",
    "numoutlets" : 2,
    "fontsize" : 12.0,
    "outlettype" : [ "", "" ]
    }
    }
    , {
    "box" : {
    "maxclass" : "message",
    "text" : "clear",
    "fontname" : "Arial",
    "numinlets" : 2,
    "patching_rect" : [ 142.0, 371.0, 37.0, 18.0 ],
    "id" : "obj-15",
    "numoutlets" : 1,
    "fontsize" : 12.0,
    "outlettype" : [ "" ]
    }
    }
    , {
    "box" : {
    "maxclass" : "newobj",
    "text" : "prepend append",
    "fontname" : "Arial",
    "numinlets" : 1,
    "patching_rect" : [ 39.0, 367.0, 98.0, 20.0 ],
    "id" : "obj-11",
    "numoutlets" : 1,
    "fontsize" : 12.0,
    "outlettype" : [ "" ]
    }
    }
    , {
    "box" : {
    "maxclass" : "message",
    "text" : "get output_routings",
    "fontname" : "Arial",
    "numinlets" : 2,
    "patching_rect" : [ 39.0, 274.0, 113.0, 18.0 ],
    "id" : "obj-12",
    "numoutlets" : 1,
    "fontsize" : 12.0,
    "outlettype" : [ "" ]
    }
    }
    , {
    "box" : {
    "maxclass" : "newobj",
    "text" : "live.object",
    "fontname" : "Arial",
    "numinlets" : 2,
    "patching_rect" : [ 39.0, 298.0, 64.0, 20.0 ],
    "id" : "obj-13",
    "numoutlets" : 1,
    "fontsize" : 12.0,
    "outlettype" : [ "" ]
    }
    }
    , {
    "box" : {
    "maxclass" : "newobj",
    "text" : "t b l b",
    "fontname" : "Arial",
    "numinlets" : 1,
    "patching_rect" : [ 39.0, 247.0, 119.0, 20.0 ],
    "id" : "obj-3",
    "numoutlets" : 3,
    "fontsize" : 12.0,
    "outlettype" : [ "bang", "", "bang" ]
    }
    }
    , {
    "box" : {
    "maxclass" : "newobj",
    "text" : "live.path",
    "fontname" : "Arial",
    "numinlets" : 1,
    "patching_rect" : [ 39.0, 222.0, 55.0, 20.0 ],
    "id" : "obj-14",
    "numoutlets" : 3,
    "fontsize" : 12.0,
    "outlettype" : [ "", "", "" ]
    }
    }
    ],
    "lines" : [ {
    "patchline" : {
    "source" : [ "obj-59", 0 ],
    "destination" : [ "obj-13", 0 ],
    "hidden" : 0,
    "midpoints" : [ 89.5, 435.0, 16.0, 435.0, 16.0, 294.0, 48.5, 294.0 ]
    }
    }
    , {
    "patchline" : {
    "source" : [ "obj-27", 1 ],
    "destination" : [ "obj-59", 0 ],
    "hidden" : 0,
    "midpoints" : [ ]
    }
    }
    , {
    "patchline" : {
    "source" : [ "obj-3", 1 ],
    "destination" : [ "obj-13", 1 ],
    "hidden" : 0,
    "midpoints" : [ 98.5, 270.0, 161.0, 270.0, 161.0, 294.0, 93.5, 294.0 ]
    }
    }
    , {
    "patchline" : {
    "source" : [ "obj-3", 2 ],
    "destination" : [ "obj-15", 0 ],
    "hidden" : 0,
    "midpoints" : [ 148.5, 267.0, 175.0, 267.0, 175.0, 357.0, 151.5, 357.0 ]
    }
    }
    , {
    "patchline" : {
    "source" : [ "obj-3", 0 ],
    "destination" : [ "obj-12", 0 ],
    "hidden" : 0,
    "midpoints" : [ ]
    }
    }
    , {
    "patchline" : {
    "source" : [ "obj-14", 1 ],
    "destination" : [ "obj-3", 0 ],
    "hidden" : 0,
    "midpoints" : [ ]
    }
    }
    , {
    "patchline" : {
    "source" : [ "obj-13", 0 ],
    "destination" : [ "obj-16", 0 ],
    "hidden" : 0,
    "midpoints" : [ ]
    }
    }
    , {
    "patchline" : {
    "source" : [ "obj-16", 0 ],
    "destination" : [ "obj-56", 0 ],
    "hidden" : 0,
    "midpoints" : [ ]
    }
    }
    , {
    "patchline" : {
    "source" : [ "obj-56", 0 ],
    "destination" : [ "obj-11", 0 ],
    "hidden" : 0,
    "midpoints" : [ ]
    }
    }
    , {
    "patchline" : {
    "source" : [ "obj-11", 0 ],
    "destination" : [ "obj-27", 0 ],
    "hidden" : 0,
    "midpoints" : [ ]
    }
    }
    , {
    "patchline" : {
    "source" : [ "obj-47", 0 ],
    "destination" : [ "obj-14", 0 ],
    "hidden" : 0,
    "midpoints" : [ ]
    }
    }
    , {
    "patchline" : {
    "source" : [ "obj-15", 0 ],
    "destination" : [ "obj-27", 0 ],
    "hidden" : 0,
    "midpoints" : [ 151.5, 390.0, 48.5, 390.0 ]
    }
    }
    , {
    "patchline" : {
    "source" : [ "obj-12", 0 ],
    "destination" : [ "obj-13", 0 ],
    "hidden" : 0,
    "midpoints" : [ ]
    }
    }
    ]
    }

    • Jul 17 2010 | 12:14 am
      This is currently a limitation of the Live API, and there is an open feature request for there to be some way to better parse these values.
      -Ben
    • Jul 17 2010 | 5:00 pm
      Ok no worries, thanks for your reply anyway :)