{"id":844,"date":"2013-08-27T02:40:46","date_gmt":"2013-08-26T17:40:46","guid":{"rendered":"http:\/\/mirror.boy.jp\/?p=844"},"modified":"2013-08-27T02:41:56","modified_gmt":"2013-08-26T17:41:56","slug":"javascript-in-max-%e3%81%ae-templete-maxmsp-javascript","status":"publish","type":"post","link":"https:\/\/mirror.boy.jp\/?p=844","title":{"rendered":"JavaScript in Max \u306e Templete : Max\/MSP, JavaScript"},"content":{"rendered":"<p>[javascript]<br \/>\n&quot;use_strict&quot;;<br \/>\ninlets = 2;<br \/>\noutlets = 1;<br \/>\nautowatch = 1;<\/p>\n<p>var foo = 100;<br \/>\ndeclareattribute(&quot;foo&quot;,null,null,1);<\/p>\n<p>function loadbang(){<\/p>\n<p>\tout(messagename);<br \/>\n}<\/p>\n<p>function bang(){<\/p>\n<p>\tif(inlet == 0){<\/p>\n<p>\t\tout(messagename);<br \/>\n\t}<\/p>\n<p>\tfoo++;<br \/>\n\tpost(&quot;foo: &quot; + foo);<br \/>\n\tpost();<br \/>\n}<\/p>\n<p>function msg_int(num){<\/p>\n<p>\tout(num);<br \/>\n}<\/p>\n<p>function msg_float(num){<\/p>\n<p>\tout(num);<br \/>\n}<\/p>\n<p>function message(){<\/p>\n<p>  var a = arrayfromargs(messagename,arguments);<\/p>\n<p>  out(a);\t<\/p>\n<p>}<\/p>\n<p>function list(){<\/p>\n<p>  var a = arrayfromargs(messagename,arguments);<\/p>\n<p>  out(a);<br \/>\n};<\/p>\n<p>function anything()<br \/>\n{<br \/>\n  var a = arrayfromargs(messagename,arguments);<\/p>\n<p>  out(a);<br \/>\n}<\/p>\n<p>\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<\/p>\n<p>function init(){<\/p>\n<p>\tpost(&quot;jsarguments:&quot;);<br \/>\n\tfor(var i = 0 ; i &lt; jsarguments.length ; i++){<\/p>\n<p>\t\tpost(jsarguments[i]);<br \/>\n\t\tpost();<br \/>\n\t}<br \/>\n}<\/p>\n<p>function out(){<\/p>\n<p>\tpost(messagename + &quot; :&quot;);<\/p>\n<p>\tfor(var i = 0 ; i &lt; arguments.length ; i++){<\/p>\n<p>\t\tpost(arguments[i] + &quot; &quot;);<br \/>\n\t\toutlet(0,arguments[i]);<br \/>\n\t}<\/p>\n<p>\tpost();<br \/>\n}<\/p>\n<p>\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/<\/p>\n<p>function save(){<\/p>\n<p>\tpost(&quot;save&quot;);<br \/>\n\tpost();<\/p>\n<p>\t\/\/When the js object containing this script is recreated, the function numchairs will be called<br \/>\n\tembedmessage(&quot;init&quot;);<br \/>\n}<\/p>\n<p>\/\/Assistance for Inlet<br \/>\nfunction describe_inlet(num){<\/p>\n<p>\tassist(&quot;this is inlet number : &quot; + num,num);<br \/>\n}<br \/>\nsetinletassist(-1,describe_inlet);<\/p>\n<p>\/\/Assistance for Outlet<br \/>\nfunction describe_outlet(num){<br \/>\n\tassist(&quot;this is outlet number : &quot; + num,num);<br \/>\n}<br \/>\nsetoutletassist(-1,describe_outlet);<\/p>\n<p>[\/javascript]<\/p>\n<p>js\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u5185\u3067\u8a18\u8ff0\u3059\u308b JavaScript in Max \u306e\u66f8\u304d\u65b9\u3092\u5fd8\u308c\u304c\u3061\u306a\u306e\u3067\u3001\u81ea\u5206\u7528\u306bTemplete\u3092\u3064\u304f\u308a\u307e\u3057\u305f\u3002js\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3092\u30c0\u30d6\u30eb\u30af\u30ea\u30c3\u30af\u3067\u958b\u304f\u30a8\u30c7\u30a3\u30bf\u306b\u30b3\u30d4\u30da\u3057\u3066\u3001\u3054\u5229\u7528\u304f\u3060\u3055\u3044\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>[javascript] &quot;use_strict&quot;; inlets = 2; outlets = 1; autowatch = 1; var foo = 100; declareattribute(&#038; &hellip; <a href=\"https:\/\/mirror.boy.jp\/?p=844\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">JavaScript in Max \u306e Templete : Max\/MSP, JavaScript<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,28,26],"tags":[],"_links":{"self":[{"href":"https:\/\/mirror.boy.jp\/index.php?rest_route=\/wp\/v2\/posts\/844"}],"collection":[{"href":"https:\/\/mirror.boy.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mirror.boy.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mirror.boy.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mirror.boy.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=844"}],"version-history":[{"count":2,"href":"https:\/\/mirror.boy.jp\/index.php?rest_route=\/wp\/v2\/posts\/844\/revisions"}],"predecessor-version":[{"id":846,"href":"https:\/\/mirror.boy.jp\/index.php?rest_route=\/wp\/v2\/posts\/844\/revisions\/846"}],"wp:attachment":[{"href":"https:\/\/mirror.boy.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=844"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mirror.boy.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=844"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mirror.boy.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=844"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}