43 lines
1.8 KiB
JSON
43 lines
1.8 KiB
JSON
{
|
|
"source": "JSON",
|
|
"data": "BLOCK",
|
|
"version": "0.0.1",
|
|
"type": "javascript.mulsoundfloat",
|
|
"language": "javascript",
|
|
"extension": "webaudio",
|
|
"help": " Mul Sound Float",
|
|
"label": "Mul Sound Float",
|
|
"color": "#D3C124",
|
|
"group": "Sound",
|
|
"codes": [
|
|
{
|
|
"name": "function",
|
|
"code": "\nMulSoundFloat = function(context, float_value) {\n var that = this;\n this.float = float_value;\n this.context = context;\n this.node = context.createScriptProcessor(1024, 1, 1);\n this.node.onaudioprocess = function(e) { that.process(e) };\n}\n\nMulSoundFloat.prototype.process = function(e) {\n var in0 = e.inputBuffer.getChannelData(0);\n var out = e.outputBuffer.getChannelData(0);\n for (var i = 0; i < in0.length; ++i) {\n out[i] = in0[i] * this.float;\n }\n}\n"
|
|
},
|
|
{
|
|
"name": "declaration",
|
|
"code": "\n// block_$id$ = $label$\n\nvar block_$id$_float = 1;\nvar block_$id$_obj = new MulSoundFloat(context, block_$id$_float);\n\nvar $port[float_input]$ = function(value){\n block_$id$_float = parseFloat(value);\n block_$id$_obj.float = block_$id$_float;\n return true;\n };\n\nvar $port[sound_input]$ = block_$id$_obj.node;\nvar $port[output]$ = block_$id$_obj.node;\n"
|
|
}
|
|
],
|
|
"properties": [],
|
|
"ports": [
|
|
{
|
|
"conn_type": "input",
|
|
"name": "sound_input",
|
|
"label": "Sound",
|
|
"type": "javascript.sound"
|
|
},
|
|
{
|
|
"conn_type": "input",
|
|
"name": "float_input",
|
|
"label": "Float Value",
|
|
"type": "javascript.float"
|
|
},
|
|
{
|
|
"conn_type": "output",
|
|
"name": "output",
|
|
"label": "Sound",
|
|
"type": "javascript.sound"
|
|
}
|
|
]
|
|
} |