{ "source": "JSON", "data": "BLOCK", "version": "0.0.1", "type": "channelmerger", "language": "javascript", "extension": "webaudio", "help": "Channel Merger", "label": "Channel Merger", "color": "50:150:250:150", "group": "Sound", "codes": { "function": "\nMerger = function(context) {\n var that = this;\n this.x = 0; // Initial sample number\n this.context = context;\n this.node = context.createScriptProcessor(1024, 1, 1);\n this.node.onaudioprocess = function(e) { that.process(e) };\n}\n\nMerger.prototype.process = function(e) {\n var in1 = e.inputBuffer.getChannelData(0);\n var out = e.outputBuffer.getChannelData(0);\n for (var i = 0; i < in1.length; ++i) {\n out[i] = in1[i];\n }\n}\n", "declaration": "\n// block_$id$ = Channel Merger\nvar block_$id$_obj = new Merger(context);\nvar $port[sound_output]$ = block_$id$_obj.node;\nvar $port[sound_input_1]$ = block_$id$_obj.node;\nvar $port[sound_input_2]$ = block_$id$_obj.node;\n" }, "properties": [], "ports": [ { "type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound", "label": "Sound Input 1", "conn_type": "Input", "name": "sound_input_1" }, { "type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound", "conn_type": "Input", "label": "Sound Input 2", "name": "sound_input_2" }, { "type": "mosaicode_lib_javascript_webaudio.extensions.ports.sound", "label": "Sound Output", "conn_type": "Output", "name": "sound_output" } ] }