proxy inlets that take symbols or lists that start with symbols?


    Nov 20 2017 | 6:24 pm
    Is there a way to have an inlet take in an arbitrary symbol, or a list that starts with a symbol? It seems that proxies that take in lists only accept lists that start with a number. Lists that start with symbols trigger a "doesn't understand "g"" error, where g is the first symbol in the list.
    (A set of external examples in the SDK that demonstrate different kinds of proxies (lists, symbols, etc) would be so helpful!)

    • Nov 24 2017 | 5:28 pm
      Hi there, it's actually pretty simple and I don't think external examples are needed. Here is how you ought to think about it: when you create a proxy inlet you create a general inlet that is able to accept any message selector, whether numeric (A_LONG or A_FLOAT) or a symbol (A_SYM). It doesn't matter if the message is made of a single atom or a list of atoms. You gotta look at the message selector only. (basically the first atom in a list)
      You need to implement two methods in your object, a "list" method and an "anything" method,
      class_addmethod(c, (method)yourobject_list, "list", A_GIMME, 0); class_addmethod(c, (method)yourobject_anything, "anything", A_GIMME, 0);
      The "list" method will be called in response to all lists that start with a numeric value. The "anything" method will be called in response to all lists that start with a symbol. You won't receive any more "doesn't understand xxx" errors. That's it.
      Hope this helps.
      - Luigi
    • Nov 25 2017 | 9:58 pm
      Aha! Thank you!