{"id":4041,"date":"2014-10-25T02:20:18","date_gmt":"2014-10-24T17:20:18","guid":{"rendered":"http:\/\/mirror.boy.jp\/?p=2098"},"modified":"2014-10-25T02:20:18","modified_gmt":"2014-10-24T17:20:18","slug":"max-external%e9%96%8b%e7%99%ba-simplemax%e3%82%aa%e3%83%96%e3%82%b8%e3%82%a7%e3%82%af%e3%83%88%e3%81%ae%e3%82%b5%e3%83%b3%e3%83%97%e3%83%ab%e3%82%b3%e3%83%bc%e3%83%89%e3%82%92%e8%aa%ad%e3%81%bf","status":"publish","type":"post","link":"https:\/\/inage.ksd6700.net\/?p=4041","title":{"rendered":"Max External\u958b\u767a simplemax\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9\u3092\u8aad\u307f\u89e3\u304f #maxmsp"},"content":{"rendered":"<p><a href=\"http:\/\/mirror.boy.jp\/wp-content\/uploads\/2014\/10\/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88-2014-10-25-2.08.50.jpeg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/mirror.boy.jp\/wp-content\/uploads\/2014\/10\/%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%BC%E3%83%B3%E3%82%B7%E3%83%A7%E3%83%83%E3%83%88-2014-10-25-2.08.50.jpeg\" alt=\"\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8 2014-10-25 2.08.50\" width=\"586\" height=\"373\" class=\"alignnone size-full wp-image-2103\" \/><\/a><br \/>\nMax\u3067\u3082openFrameworks\u307f\u305f\u3044\u306bC\u3084C++\u306e\u8cc7\u7523\u3092\u6d3b\u7528\u3057\u305f\u3044\uff01aka.leapmotion\u3092\u53c2\u8003\u306bLeapMotion v2.\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3082\u958b\u767a\u3057\u3066\u308b\u306e\u3067\u3001\u305d\u306e\u3046\u3061\u516c\u958b\u3057\u305f\u3044\uff01\u3068\u3044\u3046\u3053\u3068\u3067\u3001\u4e45\u3057\u3076\u308a\u306bMax External\u52c9\u5f37\u3057\u3066\u307e\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001<a href=\"http:\/\/cycling74.com\/downloads\/sdk\/\">MaxSDK<\/a>\u3092\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3059\u308b\u3068\u4ed8\u3044\u3066\u6765\u308bXcode\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u30b5\u30f3\u30d7\u30eb\u304b\u3089\u3001simplemax\u306e\u30b3\u30fc\u30c9\u3092\u8aad\u3093\u3067\u307f\u307e\u3059\u3002\u3061\u306a\u307f\u306b Yosemite \/ Xcode6\u3067\u3084\u3063\u3066\u307e\u3059\u3002<\/p>\n<h2>\u30a4\u30f3\u30af\u30eb\u30fc\u30c9<\/h2>\n<\/p>\n<pre class=\"crayon-plain-tag\">#include &quot;ext.h&quot;\t\/\/ standard Max include, always required\r\n#include &quot;ext_obex.h&quot;\t\/\/ required for new style Max object<\/pre>\n<p>\u3053\u306e\uff12\u3064\u306f\u5927\u62b5\u306e\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3067\u30a4\u30f3\u30af\u30eb\u30fc\u30c9\u3057\u307e\u3059\u3002C\u8a00\u8a9e\u306e\u5165\u9580\u66f8\u306b\u304a\u307e\u3058\u306a\u3044\u3063\u3066\u66f8\u3044\u3066\u3042\u308b\u3084\u3064\u3067\u3059\u306d\u3002<\/p>\n<h2>Max\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306e\u69cb\u9020\u4f53\u5b9a\u7fa9<\/h2>\n<\/p>\n<pre class=\"crayon-plain-tag\">\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ object struct\r\ntypedef struct _simplemax \r\n{\r\n\tt_object\tob;\t\/\/ the object itself (must be first)\r\n} t_simplemax;<\/pre>\n<p>\u30d7\u30e9\u30a4\u30d9\u30fc\u30c8\u5909\u6570\u3084\u30d7\u30ed\u30ad\u30b7\u3092\u5229\u7528\u3059\u308b\u5834\u5408\u306f\u3001\u69cb\u9020\u4f53\u30e1\u30f3\u30d0\u3068\u3057\u3066\u5b9a\u7fa9\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u305d\u3046\u3067\u3059\u3002MaxAPI Document\u53c2\u7167\u3002<\/p>\n<h2>\u95a2\u6570\u30d7\u30ed\u30c8\u30bf\u30a4\u30d7\u5ba3\u8a00<\/h2>\n<\/p>\n<pre class=\"crayon-plain-tag\">\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ function prototypes\r\n\/\/\/\/ standard set\r\nvoid *simplemax_new(t_symbol *s, long argc, t_atom *argv);\r\nvoid simplemax_free(t_simplemax *x);\r\nvoid simplemax_assist(t_simplemax *x, void *b, long m, long a, char *s);<\/pre>\n<p>\uff08Max\u5074\u304b\u3089\u547c\u3073\u51fa\u3057\u305f\u3044\uff09\u767b\u9332\u3057\u305f\u3044\u30e1\u30bd\u30c3\u30c9\u306f\u3001\u3053\u3053\u3067\u30d7\u30ed\u30c8\u30bf\u30a4\u30d7\u5ba3\u8a00\u3057\u3068\u3044\u3066main\u95a2\u6570\u3067\u767b\u9332\u3059\u308b\u3002maxsimple\u304c\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5316\u3059\u308b\u6642\u306b\u5fc5\u8981\u306anew\u3068\u89e3\u653e\u3059\u308b\uff08\u6d88\u3059\uff09\u6642\u306b\u5fc5\u8981\u306afree\u306f\u5fc5\u9808\u3002assist\u95a2\u6570\u306f\u3001\u5fc5\u305a\u5fc5\u8981\u306a\u3082\u306e\u3067\u306f\u7121\u3044\u3088\u3046\u3067\u3059\u3002<\/p>\n<h2>\u30af\u30e9\u30b9\u306e\u767b\u9332<\/h2>\n<\/p>\n<pre class=\"crayon-plain-tag\">\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/ global class pointer variable\r\nvoid *simplemax_class;\r\n\r\n\r\nint C74_EXPORT main(void)\r\n{\t\r\n\t\/\/ object initialization, NEW STYLE\r\n\tt_class *c;\r\n\t\r\n\tc = class_new(&quot;simplemax&quot;, (method)simplemax_new, (method)simplemax_free, (long)sizeof(t_simplemax), \r\n\t\t\t\t  0L \/* leave NULL!! *\/, A_GIMME, 0);\r\n\t\r\n\t\/* you CAN'T call this from the patcher *\/\r\n        class_addmethod(c, (method)simplemax_assist,&quot;assist&quot;,A_CANT, 0);  \r\n\t\r\n\tclass_register(CLASS_BOX, c); \/* CLASS_NOBOX *\/\r\n\tsimplemax_class = c;\r\n\r\n\tpost(&quot;I am the simplemax object&quot;);\r\n\treturn 0;\r\n}<\/pre>\n<p>C74_EXPORT\u306f\u3001\u304a\u307e\u3058\u306a\u3044\u3067Max\u304b\u3089\u3053\u306emain\u95a2\u6570\u304c\u547c\u3079\u308b\u3088\u3046\u306b\u306a\u308b\u30de\u30af\u30ed\u306e\u3088\u3046\u3067\u3059\u3002t_class *c\u306e\u30dd\u30a4\u30f3\u30bf\u306bclass_new\u3067\u30af\u30e9\u30b9\u3092\u751f\u6210\u3057\u3066\u3044\u307e\u3059\u3002simplemax_new \/ simplemax_free \u306f\u3001\u30d7\u30ed\u30c8\u30bf\u30a4\u30d7\u5ba3\u8a00\u3057\u3066\u3042\u308b\u306e\u3067\u3053\u3053\u3067\u95a2\u6570\u30dd\u30a4\u30f3\u30bf\u3092\u6e21\u3057\u3066\u30af\u30e9\u30b9\u30e1\u30bd\u30c3\u30c9\u3068\u3057\u3066\u767b\u9332\u3057\u3066\u3044\u307e\u3059\u306d\u3002\u3055\u3089\u306b\u305d\u306eclass\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u306bsimplemax_assist\u30e1\u30bd\u30c3\u30c9\u3092\u767b\u9332\u3057\u3066\u3044\u307e\u3059\u3002\u3053\u306e\u30e1\u30bd\u30c3\u30c9\u306f\u3001inlet\u3084outlet\u306b\u30de\u30a6\u30b9\u30dd\u30a4\u30f3\u30bf\u3092\u5408\u308f\u305b\u308b\u3068\u30dd\u30c3\u30d7\u30a2\u30c3\u30d7\u3067\u8aac\u660e\u304c\u3067\u3066\u304f\u308b\u30bf\u30a4\u30d7\u306e\u30e1\u30bd\u30c3\u30c9\u3002class_register\u3067CLASS_BOX\u3078\u30af\u30e9\u30b9\u306e\u767b\u9332\u3092\u3059\u308b\u3053\u3068\u3067Max\u304b\u3089simplemax\u30af\u30e9\u30b9\u304c\u63a2\u305b\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002\u3053\u306emain\u95a2\u6570\u3067\u4e00\u5ea6\u4f5c\u6210\u3057\u767b\u9332\u3057\u305f\u30af\u30e9\u30b9\u306f\u3001\u30b0\u30ed\u30fc\u30d0\u30eb\u5909\u6570\u306esimplemax_class\u306b\u30dd\u30a4\u30f3\u30bf\u3092\u4fdd\u5b58\u3057\u3066\u304a\u304f\u307f\u305f\u3044\u3002\u305f\u3076\u3093Max\u8d77\u52d5\u6642\u306b\u4e00\u5ea6\u3060\u3051\u3053\u306eMain\u95a2\u6570\u304c\u547c\u3070\u308c\u3066\u30af\u30e9\u30b9\u3060\u3051\u767b\u9332\u3057\u3066\u304a\u3044\u3066\u3001simplemax\u304c\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5316\u3055\u308c\u308b\u5834\u5408\u306f\u4f7f\u3044\u307e\u308f\u3057\u3066\u3044\u308b\u3002<\/p>\n<h2>\u30e1\u30bd\u30c3\u30c9\u306e\u5b9f\u88c5<\/h2>\n<\/p>\n<pre class=\"crayon-plain-tag\">void *simplemax_new(t_symbol *s, long argc, t_atom *argv)\r\n{\r\n\tt_simplemax *x = NULL;\r\n        long i;\r\n    \r\n\t\/\/ object instantiation, NEW STYLE\r\n\tif ((x = (t_simplemax *)object_alloc(simplemax_class))) {\r\n        object_post((t_object *)x, &quot;a new %s object was instantiated: %p&quot;, s-&gt;s_name, x);\r\n        object_post((t_object *)x, &quot;it has %ld arguments&quot;, argc);\r\n        \r\n        for (i = 0; i &lt; argc; i++) {\r\n            if ((argv + i)-&gt;a_type == A_LONG) {\r\n                object_post((t_object *)x, &quot;arg %ld: long (%ld)&quot;, i, atom_getlong(argv+i));\r\n            } else if ((argv + i)-&gt;a_type == A_FLOAT) {\r\n                object_post((t_object *)x, &quot;arg %ld: float (%f)&quot;, i, atom_getfloat(argv+i));\r\n            } else if ((argv + i)-&gt;a_type == A_SYM) {\r\n                object_post((t_object *)x, &quot;arg %ld: symbol (%s)&quot;, i, atom_getsym(argv+i)-&gt;s_name);\r\n            } else {\r\n                object_error((t_object *)x, &quot;forbidden argument&quot;);\r\n            }\r\n        }\r\n\t}\r\n\treturn (x);\r\n}\r\n\r\nvoid simplemax_free(t_simplemax *x)\r\n{\r\n\t;\r\n}\r\n\r\nvoid simplemax_assist(t_simplemax *x, void *b, long m, long a, char *s)\r\n{\r\n\tif (m == ASSIST_INLET) { \/\/ inlet\r\n\t\tsprintf(s, &quot;I am inlet %ld&quot;, a);\r\n\t} \r\n\telse {\t\/\/ outlet\r\n\t\tsprintf(s, &quot;I am outlet %ld&quot;, a); \t\t\t\r\n\t}\r\n}<\/pre>\n<p>simplemax_new\u306f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5316\u3055\u308c\u308b\u5834\u5408\u306b\u547c\u3070\u308c\u308b\u3002\u3053\u306e\u30b5\u30f3\u30d7\u30eb\u306f\u3001\u6e21\u3055\u308c\u305f\u5f15\u6570\u3092\u3072\u305f\u3059\u3089MaxWindow\u306b\u30dd\u30b9\u30c8\u3057\u3066\u304f\u308c\u3066\u308b\u3002argv\u306b\u30a2\u30fc\u30ae\u30e5\u30e1\u30f3\u30c8\u304cargc\u500b\u5165\u3063\u3066\u3044\u3066\u3001t_atom\u578b\u306fa_type\u30e1\u30f3\u30d0\u3092\u307f\u308b\u3068\u578b\u304c\u66f8\u3044\u3066\u3042\u308b\u3088\u3046\u3002atom\u578b\u306f\u30b2\u30c3\u30c8\u95a2\u6570\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u308b\u3002\u30e1\u30f3\u30d0\u5909\u6570\u306a\u3069\u306e\u521d\u671f\u5316\u306f\u3001\u3053\u3053\u306b\u66f8\u3051\u3070\u826f\u3055\u305d\u3046\u3002<\/p>\n<p>simplemax_free\u306e\u65b9\u306f\u7279\u306b\u4f55\u3082\u3057\u3066\u306a\u3044\u3051\u3069\u3001\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5316\u3057\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u81ea\u4f53\u306f\u88cf\u3067\u52dd\u624b\u306b\u958b\u653e\u3057\u3066\u304f\u308c\u3066\u3044\u308b\u306e\u304b\u306a\uff1f\u3002\u81ea\u5206\u3067\u30a4\u30f3\u30b9\u30bf\u30f3\u30b9\u5316\u3057\u305f\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u304c\u3042\u308c\u3070\u3053\u3053\u3067\u958b\u653e\u3057\u305f\u3044\u3002simplemax_assist\u306f\u3001\u30a2\u30b7\u30b9\u30c8\u8868\u793a\u3092\u4f7f\u3046\u3068\u304d\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u306e\u3088\u3046\u3067\u3059\u3002<\/p>\n<h2>\u30e1\u30bd\u30c3\u30c9\u8ffd\u52a0\uff08\u4f59\u8ac7)<\/h2>\n<\/p>\n<pre class=\"crayon-plain-tag\">void simplemax_bang(t_simplemax*x)\r\n{\r\n    post(&quot;bang&quot;);\r\n}\r\n\r\nclass_addmethod(c,(method)simplemax_bang,&quot;bang&quot;, A_SYM,0);<\/pre>\n<p>\u3053\u306esimplemax\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u306f\u3001\u3069\u3093\u306a\u30e1\u30c3\u30bb\u30fc\u30b8\u306b\u3082\u53cd\u5fdc\u3057\u306a\u3044\u30b5\u30f3\u30d7\u30eb\u3068\u3057\u3066\u306f\u304b\u306a\u308a\u99c4\u76ee\u306a\u5b50\u3067\u3059\u3002\u305d\u3053\u3067\u30e1\u30bd\u30c3\u30c9\u3092\u5b9a\u7fa9\u3057\u3066\u3001\u30af\u30e9\u30b9\u306b\u767b\u9332\u3057\u3066\u307f\u305f\u3089\u3061\u3083\u3093\u3068\u52d5\u304d\u307e\u3057\u305f\u3002\u30c8\u30c3\u30d7\u7d75\u306fbang\u3092\u9001\u3063\u3066\u52d5\u4f5c\u3055\u305b\u3066\u308b\u69d8\u5b50\u3067\u3059\u3002C\u8a00\u8a9e\u3060\u3051\u3069\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u601d\u8003\u306e\u5302\u3044\u304c\u3059\u308b\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Max&#12391;&#12418;openFrameworks&#12415;&#12383;&#12356;&#12395;C&#12420;C++&#12398;&#36039;&#29987;&#12434;&#27963;&#29992;&#12375; &#8230;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"_links":{"self":[{"href":"https:\/\/inage.ksd6700.net\/index.php?rest_route=\/wp\/v2\/posts\/4041"}],"collection":[{"href":"https:\/\/inage.ksd6700.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/inage.ksd6700.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/inage.ksd6700.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/inage.ksd6700.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4041"}],"version-history":[{"count":0,"href":"https:\/\/inage.ksd6700.net\/index.php?rest_route=\/wp\/v2\/posts\/4041\/revisions"}],"wp:attachment":[{"href":"https:\/\/inage.ksd6700.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4041"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/inage.ksd6700.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4041"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/inage.ksd6700.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4041"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}