diff options
author | Humberto Alfonso Díaz <humberto.alfonso@asvito.es> | 2019-10-07 13:18:06 +0200 |
---|---|---|
committer | Lorenzo Tilve <ltilve@igalia.com> | 2020-02-04 09:42:15 +0100 |
commit | a16d4d0c1402472265a3a104fcafdf343177ea67 (patch) | |
tree | 78b3eb7658930b2366ca44cf72abe1c6c0f2a9d3 /src/js/sliders.js | |
parent | 9dfbec37d2c28f5850a0707c9a2717f4bcb5b6ce (diff) |
FUNCT Integrate AGLJS library
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 |