diff options
Diffstat (limited to 'src/js/sliders.js')
-rw-r--r-- | src/js/sliders.js | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/src/js/sliders.js b/src/js/sliders.js index 624e8e4..7208a85 100644 --- a/src/js/sliders.js +++ b/src/js/sliders.js @@ -1,4 +1,4 @@ -this.sliders = {}; +import { audiomixer } from 'agl-js-api'; function getRootNode(node) { while(!node.hasAttribute('slider-id') && node.parentNode) { @@ -21,7 +21,7 @@ function getValue(node) { } } -function setValue(node, value) { +export function setValue(node, value, notUpdate) { node = getRootNode(node); if( node ){ value = Math.max(Math.min(value, 100), 0); @@ -29,28 +29,20 @@ function setValue(node, value) { node.getElementsByTagName('progress')[0].value = value; node.getElementsByTagName('input')[0].value = value; node.getElementsByClassName('value')[0].innerHTML = value+'%'; + if( !notUpdate ) { + audiomixer.set_volume(node.getAttribute('slider-id'), value/100); + } } } -function init(sliders) { - console.log(sliders); -} - -function increase(node) { +export function increase(node) { setValue(node, getValue(node)+5); } -function decrease(node) { +export function decrease(node) { setValue(node, getValue(node)-5); } -function change(node) { +export function change(node) { setValue(node, node.value); -} - -module.exports = { - init: init, - increase: increase, - decrease: decrease, - change: change }
\ No newline at end of file |