diff options
author | Roger Zanoni <rzanoni@igalia.com> | 2022-11-11 16:53:15 +0100 |
---|---|---|
committer | Roger Zanoni <rzanoni@igalia.com> | 2022-11-11 16:54:34 +0100 |
commit | 38587cf96c096a204cd742fff9fea4f8e465393a (patch) | |
tree | 18b18d18bba8c93140186cc7db5b462408ea9f2c /src/js/sliders.js | |
parent | c189320ab6810d4c916fa8f697a9452f3a8976a4 (diff) |
Adapt the mixer demo to use kuksa.val service
Bug-AGL: SPEC-4599
Signed-off-by: Roger Zanoni <rzanoni@igalia.com>
Change-Id: If8308d3402c11ac3acc7dc11c11ed042f014b87e
Diffstat (limited to 'src/js/sliders.js')
-rw-r--r-- | src/js/sliders.js | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/src/js/sliders.js b/src/js/sliders.js deleted file mode 100644 index 5b9191c..0000000 --- a/src/js/sliders.js +++ /dev/null @@ -1,48 +0,0 @@ -import * as audiomixer from './agl_stubs_audiomixer'; - -function getRootNode(node) { - while(!node.hasAttribute('slider-id') && node.parentNode) { - return getRootNode(node.parentNode); - } - - if( node.hasAttribute('slider-id') ) { - return node; - } else { - return false; - } -} - -function getValue(node) { - node = getRootNode(node); - if( node ) { - return parseInt(node.getAttribute('value')); - } else { - return false; - } -} - -export function setValue(node, value, notUpdate) { - node = getRootNode(node); - if( node ){ - value = Math.max(Math.min(value, 100), 0); - node.setAttribute('value', 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); - } - } -} - -export function increase(node) { - setValue(node, getValue(node)+5); -} - -export function decrease(node) { - setValue(node, getValue(node)-5); -} - -export function change(node) { - setValue(node, node.value); -}
\ No newline at end of file |