mosaicode/extensions/javascript/blocks/webaudio/Sound/Gain.json

58 lines
1.5 KiB
JSON

{
"source": "JSON",
"data": "BLOCK",
"version": "0.0.1",
"type": "javascript.gain",
"language": "javascript",
"extension": "webaudio",
"help": "Sound output",
"label": "Gain",
"color": "#D3C124",
"group": "Sound",
"codes": [
{
"name": "declaration",
"code": "\n// block_$id$ = $label$\nvar block_$id$ = context.createGain();\nvar $port[input]$ = block_$id$;\nvar $port[output]$ = block_$id$;\nvar $port[gain]$ = block_$id$.gain;\nvar $port[gain_value]$ = function(value){\n block_$id$.gain.value = value;\n };\n"
},
{
"name": "execution",
"code": "block_$id$.gain.value = $prop[gain]$;\n"
}
],
"properties": [
{
"name": "gain",
"label": "Gain",
"type": "Float",
"lower": 0,
"upper": 32000,
"value": 1
}
],
"ports": [
{
"conn_type": "input",
"name": "input",
"label": "Input",
"type": "javascript.sound"
},
{
"conn_type": "input",
"name": "gain",
"label": "Gain",
"type": "javascript.sound"
},
{
"conn_type": "input",
"name": "gain_value",
"label": "Gain Value",
"type": "javascript.float"
},
{
"conn_type": "output",
"name": "output",
"label": "Output",
"type": "javascript.sound"
}
]
}