From 38587cf96c096a204cd742fff9fea4f8e465393a Mon Sep 17 00:00:00 2001 From: Roger Zanoni Date: Fri, 11 Nov 2022 16:53:15 +0100 Subject: Adapt the mixer demo to use kuksa.val service Bug-AGL: SPEC-4599 Signed-off-by: Roger Zanoni Change-Id: If8308d3402c11ac3acc7dc11c11ed042f014b87e --- src/index.html | 6 +-- src/index.js | 11 ++-- src/js/agl_stubs_audiomixer.js | 13 ----- src/js/app.js | 30 +++-------- src/js/kuksa.js | 119 +++++++++++++++++++++++++++++++++++++++++ src/js/paths.js | 18 +++++++ src/js/sliders.js | 48 ----------------- src/js/volume.js | 55 +++++++++++++++++++ webpack.config.js | 5 +- 9 files changed, 212 insertions(+), 93 deletions(-) delete mode 100644 src/js/agl_stubs_audiomixer.js create mode 100644 src/js/kuksa.js create mode 100644 src/js/paths.js delete mode 100644 src/js/sliders.js create mode 100644 src/js/volume.js diff --git a/src/index.html b/src/index.html index 5095354..c12b13e 100644 --- a/src/index.html +++ b/src/index.html @@ -31,14 +31,14 @@
{{ name }}: {{ value }}%
- +
- +
- + diff --git a/src/index.js b/src/index.js index 37b78c4..a022899 100644 --- a/src/index.js +++ b/src/index.js @@ -16,13 +16,14 @@ /* JS */ import { init } from './js/app'; -import { increase, decrease, change } from './js/sliders'; /* CSS */ import './styles/app.scss'; +document.addEventListener('DOMContentLoaded', function(){ + init(); -window.increase = increase; -window.decrease = decrease; -window.change = change; -init(); \ No newline at end of file + KUKSA.init([ + [PATHS.volume, VOLUME], + ], VOLUME.init); +}); diff --git a/src/js/agl_stubs_audiomixer.js b/src/js/agl_stubs_audiomixer.js deleted file mode 100644 index c5f8d2e..0000000 --- a/src/js/agl_stubs_audiomixer.js +++ /dev/null @@ -1,13 +0,0 @@ -export function on_volume_changed() { -} - -export function list_controls() { - return new Promise((result, reject) => { - result([ - { control: "MAIN", volume: 0.5 } - ]); - }); -} - -export function set_volume() { -} diff --git a/src/js/app.js b/src/js/app.js index bfebf1c..9ad4ea1 100644 --- a/src/js/app.js +++ b/src/js/app.js @@ -1,14 +1,17 @@ import Mustache from 'mustache'; -import * as audiomixer from './agl_stubs_audiomixer'; -import { setValue } from './sliders'; var template; +var controls = [ + { id: 'MAIN', name: 'Main', volume: 50 }, +]; + function render_sliders(sliders) { var sliderContainer = document.getElementById('SliderContainer'); for( var i=0; i