A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
examples(audio-demo): rebuild as a drum machine
yhh091eae1f748f
diff --git a/examples/audio-demo/README.md b/examples/audio-demo/README.mdnew file mode 100644index 000000000..f957ce390--- /dev/null+++ b/examples/audio-demo/README.md@@ -0,0 +1,58 @@+# Audio — Drum Machine++A four-pad drum machine that shows off the engine's audio system: one-shot SFX+with per-hit variation, a looping beat on the music bus, per-bus volume control,+and a **real** spectrum visualizer driven by the master-bus analyser.++## Controls++| Input | Action |+| ------------------------------ | ---------------------------------------- |+| `1` `2` `3` `4` / click a pad | Kick / Snare / Hi-Hat / Clap |+| **Beat** button | Toggle the looping beat (music bus) |+| **Master / Music / SFX** | Click to cycle that bus's volume |++## What it shows++- **Pads** play one-shots via `audio.playSFX(url, { pitch, pan })` — each hit+ gets a small random pitch and pan so repeats feel alive.+- **Beat** loops on the music bus via `audio.playBGM(url, { fadeIn })` /+ `audio.stopBGM(fade)`. (There's no music track here, so a kick loop stands in —+ enough to show the loop + fade + music-bus routing.)+- **Volume** buttons step each bus through the mixer with `setMasterVolume` /+ `setMusicVolume` / `setSFXVolume`, so you can hear the bus tree at work.+- **Visualizer** is a true frequency spectrum, not a canned animation.++## How it works++The visualizer is fed by a new SDK method, `audio.getSpectrum(out)`, which fills+a `Uint8Array` with the master output's frequency magnitudes (0-255 per bin).+Under the hood the WebAudio backend taps the master bus with an `AnalyserNode`+(a side branch, so it never alters the sound). Backends without analysis (e.g.+WeChat) return `false`, and the bars simply rest flat — the demo degrades rather+than breaks.++- **`visualizer.ts`** samples one analyser bin per bar each frame and sets the+ bar's `UINode` height. Louder frequencies → taller bars, so a kick lights the+ low bars and a hi-hat the high ones.+- **The buttons** are plain UI entities (`UINode` + `UIVisual` + `Interactable`+ + a tag/`VolumeKnob`); a click surfaces as a `'click'` UI event the systems+ read with `events.query('click').some(e => e.target === entity)`.++## Files++```+assets/+ scenes/main.esscene # camera, pads, beat + volume buttons, spectrum bars+ audio/*.wav # kick / snare / hi-hat / clap samples+src/+ main.ts # registers the systems+ config.ts # pad samples, beat url, volume steps, spectrum bins+ components.ts # Pad, BeatToggle, VolumeKnob, VisualizerBar (+ labels)+ systems/+ preload.ts # warm the buffer cache at startup+ sfx.ts # pads → playSFX with pitch/pan variation+ beat.ts # toggle the looping music-bus beat+ volume.ts # cycle per-bus volume, update labels+ visualizer.ts # real spectrum → bar heights (audio.getSpectrum)+```diff --git a/examples/audio-demo/assets/scenes/main.esscene b/examples/audio-demo/assets/scenes/main.essceneindex 0fbf5f691..66aa0c84f 100644--- a/examples/audio-demo/assets/scenes/main.esscene+++ b/examples/audio-demo/assets/scenes/main.esscene@@ -3,1579 +3,334 @@"name": "Main","entities": [{- "id": 0,- "name": "Camera",- "parent": null,- "children": [],+ "id": 0, "name": "Camera", "parent": null, "children": [], "visible": true,"components": [- {- "type": "Transform",- "data": {- "position": {- "x": 0,- "y": 0,- "z": 10- }- }- },- {- "type": "Camera",- "data": {- "projectionType": 1,- "orthoSize": 300,- "isActive": true,- "priority": 0- }- }- ],- "visible": true+ { "type": "Transform", "data": { "position": { "x": 0, "y": 0, "z": 10 } } },+ { "type": "Camera", "data": { "projectionType": 1, "orthoSize": 300, "isActive": true, "priority": 0 } }+ ]},{- "id": 1,- "name": "Canvas",- "parent": null,- "children": [- 2,- 3,- 4,- 5,- 6,- 7,- 8,- 9,- 10,- 11,- 12,- 13,- 14,- 15,- 16,- 17,- 18,- 19,- 20,- 21,- 22,- 23,- 24,- 25,- 26- ],+ "id": 1, "name": "Canvas", "parent": null,+ "children": [2, 3, 5, 7, 9, 11, 13, 15, 17, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35],+ "visible": true,"components": [- {- "type": "Transform",- "data": {}- },- {- "type": "Canvas",- "data": {- "designResolution": {- "x": 800,- "y": 600- },- "scaleMode": 2- }- },- {- "type": "UINode",- "data": {}- }- ],- "visible": true+ { "type": "Transform", "data": {} },+ { "type": "Canvas", "data": { "designResolution": { "x": 800, "y": 600 }, "scaleMode": 2, "backgroundColor": { "r": 0, "g": 0, "b": 0, "a": 0 } } },+ { "type": "UINode", "data": {} }+ ]},{- "id": 2,- "name": "Title",- "parent": 1,- "children": [],+ "id": 2, "name": "Title", "parent": 1, "children": [], "visible": true,"components": [- {- "type": "Transform",- "data": {}- },- {- "type": "UINode",- "data": {- "position": 1,- "width": {- "value": 400.0,- "unit": 0- },- "insetLeft": {- "value": 50.0,- "unit": 1- },- "marginLeft": {- "value": -200.0,- "unit": 0- },- "height": {- "value": 45.0,- "unit": 0- },- "insetTop": {- "value": 0.0,- "unit": 1- },- "marginTop": {- "value": 45.0,- "unit": 0- }- }- },- {- "type": "Text",- "data": {- "content": "Audio Demo",- "fontSize": 32,- "color": {- "r": 1,- "g": 1,- "b": 1,- "a": 1- },- "align": 1,- "verticalAlign": 1- }- }- ],- "visible": true+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "width": { "value": 500, "unit": 0 }, "height": { "value": 40, "unit": 0 }, "insetLeft": { "value": 50, "unit": 1 }, "marginLeft": { "value": -250, "unit": 0 }, "insetTop": { "value": 0, "unit": 1 }, "marginTop": { "value": 26, "unit": 0 } } },+ { "type": "Text", "data": { "content": "Audio — Drum Machine", "fontSize": 28, "color": { "r": 0.95, "g": 0.95, "b": 1, "a": 1 }, "align": 1, "verticalAlign": 1 } }+ ]},+{- "id": 3,- "name": "KickBtn",- "parent": 1,- "children": [],+ "id": 3, "name": "Pad0", "parent": 1, "children": [4], "visible": true,"components": [- {- "type": "Transform",- "data": {}- },- {- "type": "UINode",- "data": {- "position": 1,- "width": {- "value": 110.0,- "unit": 0- },- "insetLeft": {- "value": 50.0,- "unit": 1- },- "marginLeft": {- "value": -335.0,- "unit": 0- },- "height": {- "value": 50.0,- "unit": 0- },- "insetTop": {- "value": 50.0,- "unit": 1- },- "marginTop": {- "value": -105.0,- "unit": 0- }- }- },- {- "type": "UIVisual",- "data": {- "visualType": 1,- "color": {- "r": 0.9,- "g": 0.3,- "b": 0.3,- "a": 1- }- }- },- {- "type": "Interactable",- "data": {}- },- {- "type": "SFXTrigger",- "data": {- "cooldown": 0- }- }- ],- "visible": true+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "width": { "value": 100, "unit": 0 }, "height": { "value": 60, "unit": 0 }, "insetLeft": { "value": 50, "unit": 1 }, "marginLeft": { "value": -245, "unit": 0 }, "insetTop": { "value": 50, "unit": 1 }, "marginTop": { "value": -150, "unit": 0 } } },+ { "type": "UIVisual", "data": { "visualType": 1, "color": { "r": 0.9, "g": 0.3, "b": 0.3, "a": 1 } } },+ { "type": "Interactable", "data": {} },+ { "type": "Pad", "data": { "index": 0 } }+ ]},{- "id": 4,- "name": "KickLabel",- "parent": 1,- "children": [],+ "id": 4, "name": "Pad0Label", "parent": 3, "children": [], "visible": true,"components": [- {- "type": "Transform",- "data": {}- },- {- "type": "UINode",- "data": {- "position": 1,- "width": {- "value": 110.0,- "unit": 0- },- "insetLeft": {- "value": 50.0,- "unit": 1- },- "marginLeft": {- "value": -335.0,- "unit": 0- },- "height": {- "value": 50.0,- "unit": 0- },- "insetTop": {- "value": 50.0,- "unit": 1- },- "marginTop": {- "value": -105.0,- "unit": 0- }- }- },- {- "type": "Text",- "data": {- "content": "Kick",- "fontSize": 20,- "color": {- "r": 1,- "g": 1,- "b": 1,- "a": 1- },- "align": 1,- "verticalAlign": 1- }- }- ],- "visible": true+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "insetLeft": { "value": 0, "unit": 1 }, "insetRight": { "value": 0, "unit": 1 }, "insetTop": { "value": 0, "unit": 1 }, "insetBottom": { "value": 0, "unit": 1 } } },+ { "type": "Text", "data": { "content": "Kick\n1", "fontSize": 18, "color": { "r": 1, "g": 1, "b": 1, "a": 1 }, "align": 1, "verticalAlign": 1 } }+ ]},{- "id": 5,- "name": "SnareBtn",- "parent": 1,- "children": [],+ "id": 5, "name": "Pad1", "parent": 1, "children": [6], "visible": true,"components": [- {- "type": "Transform",- "data": {}- },- {- "type": "UINode",- "data": {- "position": 1,- "width": {- "value": 110.0,- "unit": 0- },- "insetLeft": {- "value": 50.0,- "unit": 1- },- "marginLeft": {- "value": -185.0,- "unit": 0- },- "height": {- "value": 50.0,- "unit": 0- },- "insetTop": {- "value": 50.0,- "unit": 1- },- "marginTop": {- "value": -105.0,- "unit": 0- }- }- },- {- "type": "UIVisual",- "data": {- "visualType": 1,- "color": {- "r": 0.3,- "g": 0.7,- "b": 0.9,- "a": 1- }- }- },- {- "type": "Interactable",- "data": {}- },- {- "type": "SFXTrigger",- "data": {- "cooldown": 0- }- }- ],- "visible": true+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "width": { "value": 100, "unit": 0 }, "height": { "value": 60, "unit": 0 }, "insetLeft": { "value": 50, "unit": 1 }, "marginLeft": { "value": -115, "unit": 0 }, "insetTop": { "value": 50, "unit": 1 }, "marginTop": { "value": -150, "unit": 0 } } },+ { "type": "UIVisual", "data": { "visualType": 1, "color": { "r": 0.3, "g": 0.7, "b": 0.9, "a": 1 } } },+ { "type": "Interactable", "data": {} },+ { "type": "Pad", "data": { "index": 1 } }+ ]},{- "id": 6,- "name": "SnareLabel",- "parent": 1,- "children": [],+ "id": 6, "name": "Pad1Label", "parent": 5, "children": [], "visible": true,"components": [- {- "type": "Transform",- "data": {}- },- {- "type": "UINode",- "data": {- "position": 1,- "width": {- "value": 110.0,- "unit": 0- },- "insetLeft": {- "value": 50.0,- "unit": 1- },- "marginLeft": {- "value": -185.0,- "unit": 0- },- "height": {- "value": 50.0,- "unit": 0- },- "insetTop": {- "value": 50.0,- "unit": 1- },- "marginTop": {- "value": -105.0,- "unit": 0- }- }- },- {- "type": "Text",- "data": {- "content": "Snare",- "fontSize": 20,- "color": {- "r": 1,- "g": 1,- "b": 1,- "a": 1- },- "align": 1,- "verticalAlign": 1- }- }- ],- "visible": true+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "insetLeft": { "value": 0, "unit": 1 }, "insetRight": { "value": 0, "unit": 1 }, "insetTop": { "value": 0, "unit": 1 }, "insetBottom": { "value": 0, "unit": 1 } } },+ { "type": "Text", "data": { "content": "Snare\n2", "fontSize": 18, "color": { "r": 1, "g": 1, "b": 1, "a": 1 }, "align": 1, "verticalAlign": 1 } }+ ]},{- "id": 7,- "name": "HiHatBtn",- "parent": 1,- "children": [],+ "id": 7, "name": "Pad2", "parent": 1, "children": [8], "visible": true,"components": [- {- "type": "Transform",- "data": {}- },- {- "type": "UINode",- "data": {- "position": 1,- "width": {- "value": 110.0,- "unit": 0- },- "insetLeft": {- "value": 50.0,- "unit": 1- },- "marginLeft": {- "value": -35.0,- "unit": 0- },- "height": {- "value": 50.0,- "unit": 0- },- "insetTop": {- "value": 50.0,- "unit": 1- },- "marginTop": {- "value": -105.0,- "unit": 0- }- }- },- {- "type": "UIVisual",- "data": {- "visualType": 1,- "color": {- "r": 0.3,- "g": 0.9,- "b": 0.4,- "a": 1- }- }- },- {- "type": "Interactable",- "data": {}- },- {- "type": "SFXTrigger",- "data": {- "cooldown": 0- }- }- ],- "visible": true+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "width": { "value": 100, "unit": 0 }, "height": { "value": 60, "unit": 0 }, "insetLeft": { "value": 50, "unit": 1 }, "marginLeft": { "value": 15, "unit": 0 }, "insetTop": { "value": 50, "unit": 1 }, "marginTop": { "value": -150, "unit": 0 } } },+ { "type": "UIVisual", "data": { "visualType": 1, "color": { "r": 0.3, "g": 0.9, "b": 0.4, "a": 1 } } },+ { "type": "Interactable", "data": {} },+ { "type": "Pad", "data": { "index": 2 } }+ ]},{- "id": 8,- "name": "HiHatLabel",- "parent": 1,- "children": [],+ "id": 8, "name": "Pad2Label", "parent": 7, "children": [], "visible": true,"components": [- {- "type": "Transform",- "data": {}- },- {- "type": "UINode",- "data": {- "position": 1,- "width": {- "value": 110.0,- "unit": 0- },- "insetLeft": {- "value": 50.0,- "unit": 1- },- "marginLeft": {- "value": -35.0,- "unit": 0- },- "height": {- "value": 50.0,- "unit": 0- },- "insetTop": {- "value": 50.0,- "unit": 1- },- "marginTop": {- "value": -105.0,- "unit": 0- }- }- },- {- "type": "Text",- "data": {- "content": "Hi-Hat",- "fontSize": 20,- "color": {- "r": 1,- "g": 1,- "b": 1,- "a": 1- },- "align": 1,- "verticalAlign": 1- }- }- ],- "visible": true+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "insetLeft": { "value": 0, "unit": 1 }, "insetRight": { "value": 0, "unit": 1 }, "insetTop": { "value": 0, "unit": 1 }, "insetBottom": { "value": 0, "unit": 1 } } },+ { "type": "Text", "data": { "content": "Hi-Hat\n3", "fontSize": 18, "color": { "r": 1, "g": 1, "b": 1, "a": 1 }, "align": 1, "verticalAlign": 1 } }+ ]},{- "id": 9,- "name": "ClapBtn",- "parent": 1,- "children": [],+ "id": 9, "name": "Pad3", "parent": 1, "children": [10], "visible": true,"components": [- {- "type": "Transform",- "data": {}- },- {- "type": "UINode",- "data": {- "position": 1,- "width": {- "value": 110.0,- "unit": 0- },- "insetLeft": {- "value": 50.0,- "unit": 1- },- "marginLeft": {- "value": 115.0,- "unit": 0- },- "height": {- "value": 50.0,- "unit": 0- },- "insetTop": {- "value": 50.0,- "unit": 1- },- "marginTop": {- "value": -105.0,- "unit": 0- }- }- },- {- "type": "UIVisual",- "data": {- "visualType": 1,- "color": {- "r": 0.9,- "g": 0.7,- "b": 0.2,- "a": 1- }- }- },- {- "type": "Interactable",- "data": {}- },- {- "type": "SFXTrigger",- "data": {- "cooldown": 0- }- }- ],- "visible": true+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "width": { "value": 100, "unit": 0 }, "height": { "value": 60, "unit": 0 }, "insetLeft": { "value": 50, "unit": 1 }, "marginLeft": { "value": 145, "unit": 0 }, "insetTop": { "value": 50, "unit": 1 }, "marginTop": { "value": -150, "unit": 0 } } },+ { "type": "UIVisual", "data": { "visualType": 1, "color": { "r": 0.9, "g": 0.7, "b": 0.2, "a": 1 } } },+ { "type": "Interactable", "data": {} },+ { "type": "Pad", "data": { "index": 3 } }+ ]},{- "id": 10,- "name": "ClapLabel",- "parent": 1,- "children": [],+ "id": 10, "name": "Pad3Label", "parent": 9, "children": [], "visible": true,"components": [- {- "type": "Transform",- "data": {}- },- {- "type": "UINode",- "data": {- "position": 1,- "width": {- "value": 110.0,- "unit": 0- },- "insetLeft": {- "value": 50.0,- "unit": 1- },- "marginLeft": {- "value": 115.0,- "unit": 0- },- "height": {- "value": 50.0,- "unit": 0- },- "insetTop": {- "value": 50.0,- "unit": 1- },- "marginTop": {- "value": -105.0,- "unit": 0- }- }- },- {- "type": "Text",- "data": {- "content": "Clap",- "fontSize": 20,- "color": {- "r": 1,- "g": 1,- "b": 1,- "a": 1- },- "align": 1,- "verticalAlign": 1- }- }- ],- "visible": true+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "insetLeft": { "value": 0, "unit": 1 }, "insetRight": { "value": 0, "unit": 1 }, "insetTop": { "value": 0, "unit": 1 }, "insetBottom": { "value": 0, "unit": 1 } } },+ { "type": "Text", "data": { "content": "Clap\n4", "fontSize": 18, "color": { "r": 1, "g": 1, "b": 1, "a": 1 }, "align": 1, "verticalAlign": 1 } }+ ]},+{- "id": 11,- "name": "VisualizerBar0",- "parent": 1,- "children": [],+ "id": 11, "name": "BeatBtn", "parent": 1, "children": [12], "visible": true,"components": [- {- "type": "Transform",- "data": {}- },- {- "type": "UINode",- "data": {- "position": 1,- "width": {- "value": 20.0,- "unit": 0- },- "insetLeft": {- "value": 50.0,- "unit": 1- },- "marginLeft": {- "value": -205.0,- "unit": 0- },- "height": {- "value": 20.0,- "unit": 0- },- "insetTop": {- "value": 50.0,- "unit": 1- },- "marginTop": {- "value": 180.0,- "unit": 0- }- }- },- {- "type": "UIVisual",- "data": {- "visualType": 1,- "color": {- "r": 0.91,- "g": 0.19,- "b": 0.19,- "a": 1- }- }- },- {- "type": "Visualizer",- "data": {}- }- ],- "visible": true+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "width": { "value": 170, "unit": 0 }, "height": { "value": 44, "unit": 0 }, "insetLeft": { "value": 50, "unit": 1 }, "marginLeft": { "value": -85, "unit": 0 }, "insetTop": { "value": 50, "unit": 1 }, "marginTop": { "value": -74, "unit": 0 } } },+ { "type": "UIVisual", "data": { "visualType": 1, "color": { "r": 0.55, "g": 0.35, "b": 0.85, "a": 1 } } },+ { "type": "Interactable", "data": {} },+ { "type": "BeatToggle", "data": {} }+ ]},{- "id": 12,- "name": "VisualizerBar1",- "parent": 1,- "children": [],+ "id": 12, "name": "BeatLabel", "parent": 11, "children": [], "visible": true,"components": [- {- "type": "Transform",- "data": {}- },- {- "type": "UINode",- "data": {- "position": 1,- "width": {- "value": 20.0,- "unit": 0- },- "insetLeft": {- "value": 50.0,- "unit": 1- },- "marginLeft": {- "value": -179.0,- "unit": 0- },- "height": {- "value": 20.0,- "unit": 0- },- "insetTop": {- "value": 50.0,- "unit": 1- },- "marginTop": {- "value": 180.0,- "unit": 0- }- }- },- {- "type": "UIVisual",- "data": {- "visualType": 1,- "color": {- "r": 0.91,- "g": 0.46,- "b": 0.19,- "a": 1- }- }- },- {- "type": "Visualizer",- "data": {}- }- ],- "visible": true+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "insetLeft": { "value": 0, "unit": 1 }, "insetRight": { "value": 0, "unit": 1 }, "insetTop": { "value": 0, "unit": 1 }, "insetBottom": { "value": 0, "unit": 1 } } },+ { "type": "Text", "data": { "content": "Beat: Off", "fontSize": 20, "color": { "r": 1, "g": 1, "b": 1, "a": 1 }, "align": 1, "verticalAlign": 1 } },+ { "type": "BeatLabel", "data": {} }+ ]},+{- "id": 13,- "name": "VisualizerBar2",- "parent": 1,- "children": [],+ "id": 13, "name": "MasterKnob", "parent": 1, "children": [14], "visible": true,"components": [- {- "type": "Transform",- "data": {}- },- {- "type": "UINode",- "data": {- "position": 1,- "width": {- "value": 20.0,- "unit": 0- },- "insetLeft": {- "value": 50.0,- "unit": 1- },- "marginLeft": {- "value": -153.0,- "unit": 0- },- "height": {- "value": 20.0,- "unit": 0- },- "insetTop": {- "value": 50.0,- "unit": 1- },- "marginTop": {- "value": 180.0,- "unit": 0- }- }- },- {- "type": "UIVisual",- "data": {- "visualType": 1,- "color": {- "r": 0.91,- "g": 0.73,- "b": 0.19,- "a": 1- }- }- },- {- "type": "Visualizer",- "data": {}- }- ],- "visible": true+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "width": { "value": 150, "unit": 0 }, "height": { "value": 40, "unit": 0 }, "insetLeft": { "value": 50, "unit": 1 }, "marginLeft": { "value": -255, "unit": 0 }, "insetTop": { "value": 50, "unit": 1 }, "marginTop": { "value": -12, "unit": 0 } } },+ { "type": "UIVisual", "data": { "visualType": 1, "color": { "r": 0.2, "g": 0.22, "b": 0.3, "a": 1 } } },+ { "type": "Interactable", "data": {} },+ { "type": "VolumeKnob", "data": { "bus": "master", "volume": 1 } }+ ]},{- "id": 14,- "name": "VisualizerBar3",- "parent": 1,- "children": [],+ "id": 14, "name": "MasterLabel", "parent": 13, "children": [], "visible": true,"components": [- {- "type": "Transform",- "data": {}- },- {- "type": "UINode",- "data": {- "position": 1,- "width": {- "value": 20.0,- "unit": 0- },- "insetLeft": {- "value": 50.0,- "unit": 1- },- "marginLeft": {- "value": -127.0,- "unit": 0- },- "height": {- "value": 20.0,- "unit": 0- },- "insetTop": {- "value": 50.0,- "unit": 1- },- "marginTop": {- "value": 180.0,- "unit": 0- }- }- },- {- "type": "UIVisual",- "data": {- "visualType": 1,- "color": {- "r": 0.82,- "g": 0.91,- "b": 0.19,- "a": 1- }- }- },- {- "type": "Visualizer",- "data": {}- }- ],- "visible": true+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "insetLeft": { "value": 0, "unit": 1 }, "insetRight": { "value": 0, "unit": 1 }, "insetTop": { "value": 0, "unit": 1 }, "insetBottom": { "value": 0, "unit": 1 } } },+ { "type": "Text", "data": { "content": "Master 100%", "fontSize": 16, "color": { "r": 0.9, "g": 0.92, "b": 1, "a": 1 }, "align": 1, "verticalAlign": 1 } },+ { "type": "VolumeLabel", "data": { "bus": "master" } }+ ]},{- "id": 15,- "name": "VisualizerBar4",- "parent": 1,- "children": [],+ "id": 15, "name": "MusicKnob", "parent": 1, "children": [16], "visible": true,"components": [- {- "type": "Transform",- "data": {}- },- {- "type": "UINode",- "data": {- "position": 1,- "width": {- "value": 20.0,- "unit": 0- },- "insetLeft": {- "value": 50.0,- "unit": 1- },- "marginLeft": {- "value": -101.0,- "unit": 0- },- "height": {- "value": 20.0,- "unit": 0- },- "insetTop": {- "value": 50.0,- "unit": 1- },- "marginTop": {- "value": 180.0,- "unit": 0- }- }- },- {- "type": "UIVisual",- "data": {- "visualType": 1,- "color": {- "r": 0.55,- "g": 0.91,- "b": 0.19,- "a": 1- }- }- },- {- "type": "Visualizer",- "data": {}- }- ],- "visible": true+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "width": { "value": 150, "unit": 0 }, "height": { "value": 40, "unit": 0 }, "insetLeft": { "value": 50, "unit": 1 }, "marginLeft": { "value": -75, "unit": 0 }, "insetTop": { "value": 50, "unit": 1 }, "marginTop": { "value": -12, "unit": 0 } } },+ { "type": "UIVisual", "data": { "visualType": 1, "color": { "r": 0.2, "g": 0.22, "b": 0.3, "a": 1 } } },+ { "type": "Interactable", "data": {} },+ { "type": "VolumeKnob", "data": { "bus": "music", "volume": 0.8 } }+ ]},{- "id": 16,- "name": "VisualizerBar5",- "parent": 1,- "children": [],+ "id": 16, "name": "MusicLabel", "parent": 15, "children": [], "visible": true,"components": [- {- "type": "Transform",- "data": {}- },- {- "type": "UINode",- "data": {- "position": 1,- "width": {- "value": 20.0,- "unit": 0- },- "insetLeft": {- "value": 50.0,- "unit": 1- },- "marginLeft": {- "value": -75.0,- "unit": 0- },- "height": {- "value": 20.0,- "unit": 0- },- "insetTop": {- "value": 50.0,- "unit": 1- },- "marginTop": {- "value": 180.0,- "unit": 0- }- }- },- {- "type": "UIVisual",- "data": {- "visualType": 1,- "color": {- "r": 0.28,- "g": 0.91,- "b": 0.19,- "a": 1- }- }- },- {- "type": "Visualizer",- "data": {}- }- ],- "visible": true+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "insetLeft": { "value": 0, "unit": 1 }, "insetRight": { "value": 0, "unit": 1 }, "insetTop": { "value": 0, "unit": 1 }, "insetBottom": { "value": 0, "unit": 1 } } },+ { "type": "Text", "data": { "content": "Music 80%", "fontSize": 16, "color": { "r": 0.9, "g": 0.92, "b": 1, "a": 1 }, "align": 1, "verticalAlign": 1 } },+ { "type": "VolumeLabel", "data": { "bus": "music" } }+ ]},{- "id": 17,- "name": "VisualizerBar6",- "parent": 1,- "children": [],+ "id": 17, "name": "SFXKnob", "parent": 1, "children": [18], "visible": true,"components": [- {- "type": "Transform",- "data": {}- },- {- "type": "UINode",- "data": {- "position": 1,- "width": {- "value": 20.0,- "unit": 0- },- "insetLeft": {- "value": 50.0,- "unit": 1- },- "marginLeft": {- "value": -49.0,- "unit": 0- },- "height": {- "value": 20.0,- "unit": 0- },- "insetTop": {- "value": 50.0,- "unit": 1- },- "marginTop": {- "value": 180.0,- "unit": 0- }- }- },- {- "type": "UIVisual",- "data": {- "visualType": 1,- "color": {- "r": 0.19,- "g": 0.91,- "b": 0.37,- "a": 1- }- }- },- {- "type": "Visualizer",- "data": {}- }- ],- "visible": true+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "width": { "value": 150, "unit": 0 }, "height": { "value": 40, "unit": 0 }, "insetLeft": { "value": 50, "unit": 1 }, "marginLeft": { "value": 105, "unit": 0 }, "insetTop": { "value": 50, "unit": 1 }, "marginTop": { "value": -12, "unit": 0 } } },+ { "type": "UIVisual", "data": { "visualType": 1, "color": { "r": 0.2, "g": 0.22, "b": 0.3, "a": 1 } } },+ { "type": "Interactable", "data": {} },+ { "type": "VolumeKnob", "data": { "bus": "sfx", "volume": 1 } }+ ]},{- "id": 18,- "name": "VisualizerBar7",- "parent": 1,- "children": [],+ "id": 18, "name": "SFXLabel", "parent": 17, "children": [], "visible": true,"components": [- {- "type": "Transform",- "data": {}- },- {- "type": "UINode",- "data": {- "position": 1,- "width": {- "value": 20.0,- "unit": 0- },- "insetLeft": {- "value": 50.0,- "unit": 1- },- "marginLeft": {- "value": -23.0,- "unit": 0- },- "height": {- "value": 20.0,- "unit": 0- },- "insetTop": {- "value": 50.0,- "unit": 1- },- "marginTop": {- "value": 180.0,- "unit": 0- }- }- },- {- "type": "UIVisual",- "data": {- "visualType": 1,- "color": {- "r": 0.19,- "g": 0.91,- "b": 0.64,- "a": 1- }- }- },- {- "type": "Visualizer",- "data": {}- }- ],- "visible": true+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "insetLeft": { "value": 0, "unit": 1 }, "insetRight": { "value": 0, "unit": 1 }, "insetTop": { "value": 0, "unit": 1 }, "insetBottom": { "value": 0, "unit": 1 } } },+ { "type": "Text", "data": { "content": "SFX 100%", "fontSize": 16, "color": { "r": 0.9, "g": 0.92, "b": 1, "a": 1 }, "align": 1, "verticalAlign": 1 } },+ { "type": "VolumeLabel", "data": { "bus": "sfx" } }+ ]},+{- "id": 19,- "name": "VisualizerBar8",- "parent": 1,- "children": [],+ "id": 19, "name": "Bar0", "parent": 1, "children": [], "visible": true,"components": [- {- "type": "Transform",- "data": {}- },- {- "type": "UINode",- "data": {- "position": 1,- "width": {- "value": 20.0,- "unit": 0- },- "insetLeft": {- "value": 50.0,- "unit": 1- },- "marginLeft": {- "value": 3.0,- "unit": 0- },- "height": {- "value": 20.0,- "unit": 0- },- "insetTop": {- "value": 50.0,- "unit": 1- },- "marginTop": {- "value": 180.0,- "unit": 0- }- }- },- {- "type": "UIVisual",- "data": {- "visualType": 1,- "color": {- "r": 0.19,- "g": 0.91,- "b": 0.91,- "a": 1- }- }- },- {- "type": "Visualizer",- "data": {}- }- ],- "visible": true+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "width": { "value": 18, "unit": 0 }, "height": { "value": 6, "unit": 0 }, "insetLeft": { "value": 50, "unit": 1 }, "marginLeft": { "value": -204, "unit": 0 }, "insetTop": { "value": 50, "unit": 1 }, "marginTop": { "value": 60, "unit": 0 } } },+ { "type": "UIVisual", "data": { "visualType": 1, "color": { "r": 0.91, "g": 0.19, "b": 0.19, "a": 1 } } },+ { "type": "VisualizerBar", "data": { "index": 0 } }+ ]},{- "id": 20,- "name": "VisualizerBar9",- "parent": 1,- "children": [],+ "id": 20, "name": "Bar1", "parent": 1, "children": [], "visible": true,"components": [- {- "type": "Transform",- "data": {}- },- {- "type": "UINode",- "data": {- "position": 1,- "width": {- "value": 20.0,- "unit": 0- },- "insetLeft": {- "value": 50.0,- "unit": 1- },- "marginLeft": {- "value": 29.0,- "unit": 0- },- "height": {- "value": 20.0,- "unit": 0- },- "insetTop": {- "value": 50.0,- "unit": 1- },- "marginTop": {- "value": 180.0,- "unit": 0- }- }- },- {- "type": "UIVisual",- "data": {- "visualType": 1,- "color": {- "r": 0.19,- "g": 0.64,- "b": 0.91,- "a": 1- }- }- },- {- "type": "Visualizer",- "data": {}- }- ],- "visible": true+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "width": { "value": 18, "unit": 0 }, "height": { "value": 6, "unit": 0 }, "insetLeft": { "value": 50, "unit": 1 }, "marginLeft": { "value": -178, "unit": 0 }, "insetTop": { "value": 50, "unit": 1 }, "marginTop": { "value": 60, "unit": 0 } } },+ { "type": "UIVisual", "data": { "visualType": 1, "color": { "r": 0.91, "g": 0.42, "b": 0.19, "a": 1 } } },+ { "type": "VisualizerBar", "data": { "index": 1 } }+ ]},{- "id": 21,- "name": "VisualizerBar10",- "parent": 1,- "children": [],+ "id": 21, "name": "Bar2", "parent": 1, "children": [], "visible": true,"components": [- {- "type": "Transform",- "data": {}- },- {- "type": "UINode",- "data": {- "position": 1,- "width": {- "value": 20.0,- "unit": 0- },- "insetLeft": {- "value": 50.0,- "unit": 1- },- "marginLeft": {- "value": 55.0,- "unit": 0- },- "height": {- "value": 20.0,- "unit": 0- },- "insetTop": {- "value": 50.0,- "unit": 1- },- "marginTop": {- "value": 180.0,- "unit": 0- }- }- },- {- "type": "UIVisual",- "data": {- "visualType": 1,- "color": {- "r": 0.19,- "g": 0.37,- "b": 0.91,- "a": 1- }- }- },- {- "type": "Visualizer",- "data": {}- }- ],- "visible": true+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "width": { "value": 18, "unit": 0 }, "height": { "value": 6, "unit": 0 }, "insetLeft": { "value": 50, "unit": 1 }, "marginLeft": { "value": -152, "unit": 0 }, "insetTop": { "value": 50, "unit": 1 }, "marginTop": { "value": 60, "unit": 0 } } },+ { "type": "UIVisual", "data": { "visualType": 1, "color": { "r": 0.91, "g": 0.65, "b": 0.19, "a": 1 } } },+ { "type": "VisualizerBar", "data": { "index": 2 } }+ ]},{- "id": 22,- "name": "VisualizerBar11",- "parent": 1,- "children": [],+ "id": 22, "name": "Bar3", "parent": 1, "children": [], "visible": true,"components": [- {- "type": "Transform",- "data": {}- },- {- "type": "UINode",- "data": {- "position": 1,- "width": {- "value": 20.0,- "unit": 0- },- "insetLeft": {- "value": 50.0,- "unit": 1- },- "marginLeft": {- "value": 81.0,- "unit": 0- },- "height": {- "value": 20.0,- "unit": 0- },- "insetTop": {- "value": 50.0,- "unit": 1- },- "marginTop": {- "value": 180.0,- "unit": 0- }- }- },- {- "type": "UIVisual",- "data": {- "visualType": 1,- "color": {- "r": 0.28,- "g": 0.19,- "b": 0.91,- "a": 1- }- }- },- {- "type": "Visualizer",- "data": {}- }- ],- "visible": true+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "width": { "value": 18, "unit": 0 }, "height": { "value": 6, "unit": 0 }, "insetLeft": { "value": 50, "unit": 1 }, "marginLeft": { "value": -126, "unit": 0 }, "insetTop": { "value": 50, "unit": 1 }, "marginTop": { "value": 60, "unit": 0 } } },+ { "type": "UIVisual", "data": { "visualType": 1, "color": { "r": 0.88, "g": 0.91, "b": 0.19, "a": 1 } } },+ { "type": "VisualizerBar", "data": { "index": 3 } }+ ]},{- "id": 23,- "name": "VisualizerBar12",- "parent": 1,- "children": [],+ "id": 23, "name": "Bar4", "parent": 1, "children": [], "visible": true,"components": [- {- "type": "Transform",- "data": {}- },- {- "type": "UINode",- "data": {- "position": 1,- "width": {- "value": 20.0,- "unit": 0- },- "insetLeft": {- "value": 50.0,- "unit": 1- },- "marginLeft": {- "value": 107.0,- "unit": 0- },- "height": {- "value": 20.0,- "unit": 0- },- "insetTop": {- "value": 50.0,- "unit": 1- },- "marginTop": {- "value": 180.0,- "unit": 0- }- }- },- {- "type": "UIVisual",- "data": {- "visualType": 1,- "color": {- "r": 0.55,- "g": 0.19,- "b": 0.91,- "a": 1- }- }- },- {- "type": "Visualizer",- "data": {}- }- ],- "visible": true+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "width": { "value": 18, "unit": 0 }, "height": { "value": 6, "unit": 0 }, "insetLeft": { "value": 50, "unit": 1 }, "marginLeft": { "value": -100, "unit": 0 }, "insetTop": { "value": 50, "unit": 1 }, "marginTop": { "value": 60, "unit": 0 } } },+ { "type": "UIVisual", "data": { "visualType": 1, "color": { "r": 0.62, "g": 0.91, "b": 0.19, "a": 1 } } },+ { "type": "VisualizerBar", "data": { "index": 4 } }+ ]},{- "id": 24,- "name": "VisualizerBar13",- "parent": 1,- "children": [],+ "id": 24, "name": "Bar5", "parent": 1, "children": [], "visible": true,"components": [- {- "type": "Transform",- "data": {}- },- {- "type": "UINode",- "data": {- "position": 1,- "width": {- "value": 20.0,- "unit": 0- },- "insetLeft": {- "value": 50.0,- "unit": 1- },- "marginLeft": {- "value": 133.0,- "unit": 0- },- "height": {- "value": 20.0,- "unit": 0- },- "insetTop": {- "value": 50.0,- "unit": 1- },- "marginTop": {- "value": 180.0,- "unit": 0- }- }- },- {- "type": "UIVisual",- "data": {- "visualType": 1,- "color": {- "r": 0.82,- "g": 0.19,- "b": 0.91,- "a": 1- }- }- },- {- "type": "Visualizer",- "data": {}- }- ],- "visible": true+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "width": { "value": 18, "unit": 0 }, "height": { "value": 6, "unit": 0 }, "insetLeft": { "value": 50, "unit": 1 }, "marginLeft": { "value": -74, "unit": 0 }, "insetTop": { "value": 50, "unit": 1 }, "marginTop": { "value": 60, "unit": 0 } } },+ { "type": "UIVisual", "data": { "visualType": 1, "color": { "r": 0.36, "g": 0.91, "b": 0.19, "a": 1 } } },+ { "type": "VisualizerBar", "data": { "index": 5 } }+ ]},{- "id": 25,- "name": "VisualizerBar14",- "parent": 1,- "children": [],+ "id": 25, "name": "Bar6", "parent": 1, "children": [], "visible": true,"components": [- {- "type": "Transform",- "data": {}- },- {- "type": "UINode",- "data": {- "position": 1,- "width": {- "value": 20.0,- "unit": 0- },- "insetLeft": {- "value": 50.0,- "unit": 1- },- "marginLeft": {- "value": 159.0,- "unit": 0- },- "height": {- "value": 20.0,- "unit": 0- },- "insetTop": {- "value": 50.0,- "unit": 1- },- "marginTop": {- "value": 180.0,- "unit": 0- }- }- },- {- "type": "UIVisual",- "data": {- "visualType": 1,- "color": {- "r": 0.91,- "g": 0.19,- "b": 0.73,- "a": 1- }- }- },- {- "type": "Visualizer",- "data": {}- }- ],- "visible": true+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "width": { "value": 18, "unit": 0 }, "height": { "value": 6, "unit": 0 }, "insetLeft": { "value": 50, "unit": 1 }, "marginLeft": { "value": -48, "unit": 0 }, "insetTop": { "value": 50, "unit": 1 }, "marginTop": { "value": 60, "unit": 0 } } },+ { "type": "UIVisual", "data": { "visualType": 1, "color": { "r": 0.19, "g": 0.91, "b": 0.29, "a": 1 } } },+ { "type": "VisualizerBar", "data": { "index": 6 } }+ ]},{- "id": 26,- "name": "VisualizerBar15",- "parent": 1,- "children": [],+ "id": 26, "name": "Bar7", "parent": 1, "children": [], "visible": true,"components": [- {- "type": "Transform",- "data": {}- },- {- "type": "UINode",- "data": {- "position": 1,- "width": {- "value": 20.0,- "unit": 0- },- "insetLeft": {- "value": 50.0,- "unit": 1- },- "marginLeft": {- "value": 185.0,- "unit": 0- },- "height": {- "value": 20.0,- "unit": 0- },- "insetTop": {- "value": 50.0,- "unit": 1- },- "marginTop": {- "value": 180.0,- "unit": 0- }- }- },- {- "type": "UIVisual",- "data": {- "visualType": 1,- "color": {- "r": 0.91,- "g": 0.19,- "b": 0.46,- "a": 1- }- }- },- {- "type": "Visualizer",- "data": {}- }- ],- "visible": true+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "width": { "value": 18, "unit": 0 }, "height": { "value": 6, "unit": 0 }, "insetLeft": { "value": 50, "unit": 1 }, "marginLeft": { "value": -22, "unit": 0 }, "insetTop": { "value": 50, "unit": 1 }, "marginTop": { "value": 60, "unit": 0 } } },+ { "type": "UIVisual", "data": { "visualType": 1, "color": { "r": 0.19, "g": 0.91, "b": 0.55, "a": 1 } } },+ { "type": "VisualizerBar", "data": { "index": 7 } }+ ]+ },+ {+ "id": 27, "name": "Bar8", "parent": 1, "children": [], "visible": true,+ "components": [+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "width": { "value": 18, "unit": 0 }, "height": { "value": 6, "unit": 0 }, "insetLeft": { "value": 50, "unit": 1 }, "marginLeft": { "value": 4, "unit": 0 }, "insetTop": { "value": 50, "unit": 1 }, "marginTop": { "value": 60, "unit": 0 } } },+ { "type": "UIVisual", "data": { "visualType": 1, "color": { "r": 0.19, "g": 0.91, "b": 0.82, "a": 1 } } },+ { "type": "VisualizerBar", "data": { "index": 8 } }+ ]+ },+ {+ "id": 28, "name": "Bar9", "parent": 1, "children": [], "visible": true,+ "components": [+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "width": { "value": 18, "unit": 0 }, "height": { "value": 6, "unit": 0 }, "insetLeft": { "value": 50, "unit": 1 }, "marginLeft": { "value": 30, "unit": 0 }, "insetTop": { "value": 50, "unit": 1 }, "marginTop": { "value": 60, "unit": 0 } } },+ { "type": "UIVisual", "data": { "visualType": 1, "color": { "r": 0.19, "g": 0.65, "b": 0.91, "a": 1 } } },+ { "type": "VisualizerBar", "data": { "index": 9 } }+ ]+ },+ {+ "id": 29, "name": "Bar10", "parent": 1, "children": [], "visible": true,+ "components": [+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "width": { "value": 18, "unit": 0 }, "height": { "value": 6, "unit": 0 }, "insetLeft": { "value": 50, "unit": 1 }, "marginLeft": { "value": 56, "unit": 0 }, "insetTop": { "value": 50, "unit": 1 }, "marginTop": { "value": 60, "unit": 0 } } },+ { "type": "UIVisual", "data": { "visualType": 1, "color": { "r": 0.19, "g": 0.4, "b": 0.91, "a": 1 } } },+ { "type": "VisualizerBar", "data": { "index": 10 } }+ ]+ },+ {+ "id": 30, "name": "Bar11", "parent": 1, "children": [], "visible": true,+ "components": [+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "width": { "value": 18, "unit": 0 }, "height": { "value": 6, "unit": 0 }, "insetLeft": { "value": 50, "unit": 1 }, "marginLeft": { "value": 82, "unit": 0 }, "insetTop": { "value": 50, "unit": 1 }, "marginTop": { "value": 60, "unit": 0 } } },+ { "type": "UIVisual", "data": { "visualType": 1, "color": { "r": 0.36, "g": 0.19, "b": 0.91, "a": 1 } } },+ { "type": "VisualizerBar", "data": { "index": 11 } }+ ]+ },+ {+ "id": 31, "name": "Bar12", "parent": 1, "children": [], "visible": true,+ "components": [+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "width": { "value": 18, "unit": 0 }, "height": { "value": 6, "unit": 0 }, "insetLeft": { "value": 50, "unit": 1 }, "marginLeft": { "value": 108, "unit": 0 }, "insetTop": { "value": 50, "unit": 1 }, "marginTop": { "value": 60, "unit": 0 } } },+ { "type": "UIVisual", "data": { "visualType": 1, "color": { "r": 0.62, "g": 0.19, "b": 0.91, "a": 1 } } },+ { "type": "VisualizerBar", "data": { "index": 12 } }+ ]+ },+ {+ "id": 32, "name": "Bar13", "parent": 1, "children": [], "visible": true,+ "components": [+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "width": { "value": 18, "unit": 0 }, "height": { "value": 6, "unit": 0 }, "insetLeft": { "value": 50, "unit": 1 }, "marginLeft": { "value": 134, "unit": 0 }, "insetTop": { "value": 50, "unit": 1 }, "marginTop": { "value": 60, "unit": 0 } } },+ { "type": "UIVisual", "data": { "visualType": 1, "color": { "r": 0.88, "g": 0.19, "b": 0.91, "a": 1 } } },+ { "type": "VisualizerBar", "data": { "index": 13 } }+ ]+ },+ {+ "id": 33, "name": "Bar14", "parent": 1, "children": [], "visible": true,+ "components": [+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "width": { "value": 18, "unit": 0 }, "height": { "value": 6, "unit": 0 }, "insetLeft": { "value": 50, "unit": 1 }, "marginLeft": { "value": 160, "unit": 0 }, "insetTop": { "value": 50, "unit": 1 }, "marginTop": { "value": 60, "unit": 0 } } },+ { "type": "UIVisual", "data": { "visualType": 1, "color": { "r": 0.91, "g": 0.19, "b": 0.73, "a": 1 } } },+ { "type": "VisualizerBar", "data": { "index": 14 } }+ ]+ },+ {+ "id": 34, "name": "Bar15", "parent": 1, "children": [], "visible": true,+ "components": [+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "width": { "value": 18, "unit": 0 }, "height": { "value": 6, "unit": 0 }, "insetLeft": { "value": 50, "unit": 1 }, "marginLeft": { "value": 186, "unit": 0 }, "insetTop": { "value": 50, "unit": 1 }, "marginTop": { "value": 60, "unit": 0 } } },+ { "type": "UIVisual", "data": { "visualType": 1, "color": { "r": 0.91, "g": 0.19, "b": 0.46, "a": 1 } } },+ { "type": "VisualizerBar", "data": { "index": 15 } }+ ]+ },++ {+ "id": 35, "name": "Hint", "parent": 1, "children": [], "visible": true,+ "components": [+ { "type": "Transform", "data": {} },+ { "type": "UINode", "data": { "position": 1, "width": { "value": 640, "unit": 0 }, "height": { "value": 22, "unit": 0 }, "insetLeft": { "value": 50, "unit": 1 }, "marginLeft": { "value": -320, "unit": 0 }, "insetTop": { "value": 100, "unit": 1 }, "marginTop": { "value": -34, "unit": 0 } } },+ { "type": "Text", "data": { "content": "keys 1-4 or click the pads · Beat toggles the loop · click a bus to change its volume", "fontSize": 14, "color": { "r": 0.72, "g": 0.76, "b": 0.86, "a": 0.9 }, "align": 1, "verticalAlign": 1 } }+ ]}]}diff --git a/examples/audio-demo/src/components.ts b/examples/audio-demo/src/components.tsindex d394accd6..892f2ab17 100644--- a/examples/audio-demo/src/components.ts+++ b/examples/audio-demo/src/components.ts@@ -1,11 +1,16 @@import { defineComponent, defineTag } from 'esengine';-export const SFXTrigger = defineComponent('SFXTrigger', {- cooldown: 0,-});+// A drum pad. `index` selects its sample; `cooldown` debounces retriggers.+export const Pad = defineComponent('Pad', { index: 0, cooldown: 0 });-export const VolumeKnob = defineComponent('VolumeKnob', {- volume: 1.0,-});+// The looping-beat toggle button, and its live On/Off label.+export const BeatToggle = defineTag('BeatToggle');+export const BeatLabel = defineTag('BeatLabel');-export const Visualizer = defineTag('Visualizer');+// A bus-volume button: clicking cycles `bus`'s volume. VolumeLabel is the live+// percentage readout for the same bus.+export const VolumeKnob = defineComponent('VolumeKnob', { bus: 'master', volume: 1 });+export const VolumeLabel = defineComponent('VolumeLabel', { bus: 'master' });++// A spectrum bar: reads analyser bin `index` each frame to set its height.+export const VisualizerBar = defineComponent('VisualizerBar', { index: 0 });diff --git a/examples/audio-demo/src/config.ts b/examples/audio-demo/src/config.tsnew file mode 100644index 000000000..3883f89bf--- /dev/null+++ b/examples/audio-demo/src/config.ts@@ -0,0 +1,23 @@+// The four drum pads, in pad order (also the keys 1-4).+export const PADS = [+ { name: 'Kick', url: 'assets/audio/kick.wav' },+ { name: 'Snare', url: 'assets/audio/snare.wav' },+ { name: 'Hi-Hat', url: 'assets/audio/hihat.wav' },+ { name: 'Clap', url: 'assets/audio/clap.wav' },+];++// The looping beat runs on the music bus. There's no dedicated music track in+// this example, so a kick loop stands in — enough to show playBGM's loop + fade+// + music-bus routing.+export const BEAT_URL = 'assets/audio/kick.wav';++// Everything to preload up front so the first hit is latency-free.+export const ALL_URLS = [...PADS.map((p) => p.url), BEAT_URL];++// Bus volumes cycle through these steps on each click.+export const VOLUME_STEPS = [1, 0.66, 0.33, 0];++// Number of analyser bins the spectrum is sampled into (matches the bar count+// via BAR_STRIDE). Kept in one place so the system and scene agree.+export const SPECTRUM_BINS = 64;+export const BAR_STRIDE = 2;diff --git a/examples/audio-demo/src/main.ts b/examples/audio-demo/src/main.tsindex fc7d9a5a2..706421b04 100644--- a/examples/audio-demo/src/main.ts+++ b/examples/audio-demo/src/main.ts@@ -1,8 +1,21 @@-import { addSystemToSchedule, Schedule } from 'esengine';+// Audio — a drum machine that shows off the engine's audio system: pad SFX with+// per-hit pitch/pan, a looping beat on the music bus, per-bus volume control, and+// a real spectrum visualizer fed by the master-bus analyser.+//+// • Keys 1-4 or click the pads — Kick / Snare / Hi-Hat / Clap+// • Beat button — toggle the looping music-bus beat+// • Master / Music / SFX buttons — cycle each bus's volume+import { addStartupSystem, addSystemToSchedule, Schedule } from 'esengine';import './components';-import { sfxTriggerSystem } from './systems/sfx';+import { preloadSystem } from './systems/preload';+import { sfxSystem } from './systems/sfx';+import { beatSystem } from './systems/beat';+import { volumeSystem } from './systems/volume';import { visualizerSystem } from './systems/visualizer';-addSystemToSchedule(Schedule.Update, sfxTriggerSystem);+addStartupSystem(preloadSystem);+addSystemToSchedule(Schedule.Update, sfxSystem);+addSystemToSchedule(Schedule.Update, beatSystem);+addSystemToSchedule(Schedule.Update, volumeSystem);addSystemToSchedule(Schedule.Update, visualizerSystem);diff --git a/examples/audio-demo/src/systems/beat.ts b/examples/audio-demo/src/systems/beat.tsnew file mode 100644index 000000000..946f438ca--- /dev/null+++ b/examples/audio-demo/src/systems/beat.ts@@ -0,0 +1,26 @@+import {+ defineSystem, Query, Mut, Res, UIEvents, Audio, Text,+} from 'esengine';+import type { UIEventQueue, AudioAPI } from 'esengine';+import { BeatToggle, BeatLabel } from '../components';+import { BEAT_URL } from '../config';++let beatOn = false;++// Toggle the looping beat on the music bus, fading in/out, and reflect the state+// in the label.+export const beatSystem = defineSystem(+ [Res(UIEvents), Res(Audio), Query(BeatToggle), Query(Mut(Text), BeatLabel)],+ (events: UIEventQueue, audio: AudioAPI, toggles, labels) => {+ const clicks = events.query('click');+ let toggled = false;+ for (const [entity] of toggles) if (clicks.some((c) => c.target === entity)) toggled = true;+ if (!toggled) return;++ beatOn = !beatOn;+ if (beatOn) audio.playBGM(BEAT_URL, { volume: 0.9, fadeIn: 0.3 });+ else audio.stopBGM(0.3);+ for (const [, text] of labels) text.content = beatOn ? 'Beat: On' : 'Beat: Off';+ },+ { name: 'BeatSystem' },+);diff --git a/examples/audio-demo/src/systems/preload.ts b/examples/audio-demo/src/systems/preload.tsnew file mode 100644index 000000000..10633f5ba--- /dev/null+++ b/examples/audio-demo/src/systems/preload.ts@@ -0,0 +1,12 @@+import { defineSystem, Res, Audio } from 'esengine';+import type { AudioAPI } from 'esengine';+import { ALL_URLS } from '../config';++// Warm the buffer cache at startup so the first hit plays without latency.+export const preloadSystem = defineSystem(+ [Res(Audio)],+ (audio: AudioAPI) => {+ void audio.preloadAll(ALL_URLS);+ },+ { name: 'PreloadSystem' },+);diff --git a/examples/audio-demo/src/systems/sfx.ts b/examples/audio-demo/src/systems/sfx.tsindex 1f066391f..e9aa96568 100644--- a/examples/audio-demo/src/systems/sfx.ts+++ b/examples/audio-demo/src/systems/sfx.ts@@ -1,37 +1,31 @@import {- defineSystem, Query, Mut, Res, Time, Input, Audio, AudioAPI,- UIEvents,+ defineSystem, Query, Mut, Res, Time, Input, UIEvents, Audio,} from 'esengine';-import type { UIEventQueue } from 'esengine';-import { SFXTrigger } from '../components';+import type { UIEventQueue, AudioAPI } from 'esengine';+import { Pad } from '../components';+import { PADS } from '../config';-const SFX_URLS = [- 'assets/audio/kick.wav',- 'assets/audio/snare.wav',- 'assets/audio/hihat.wav',- 'assets/audio/clap.wav',-];--let triggerIndex = 0;--export const sfxTriggerSystem = defineSystem(- [Query(Mut(SFXTrigger)), Res(Time), Res(Input), Res(UIEvents), Res(Audio)],- (query, time, input, events: UIEventQueue, audio: AudioAPI) => {- triggerIndex = 0;- for (const [entity, trigger] of query) {- trigger.cooldown = Math.max(0, trigger.cooldown - time.delta);-- const key = `Digit${triggerIndex + 1}`;- const clicked = events.query('click').some(e => e.target === entity);- if ((input.isKeyPressed(key) || clicked) && trigger.cooldown <= 0) {- const url = SFX_URLS[triggerIndex];- if (url) {- audio.playSFX(url);+// Trigger a pad from its key (1-4) or a click, with slight per-hit pitch and pan+// variation so repeats feel alive. cooldown debounces held keys.+export const sfxSystem = defineSystem(+ [Query(Mut(Pad)), Res(Time), Res(Input), Res(UIEvents), Res(Audio)],+ (pads, time, input, events: UIEventQueue, audio: AudioAPI) => {+ const clicks = events.query('click');+ for (const [entity, pad] of pads) {+ pad.cooldown = Math.max(0, pad.cooldown - time.delta);+ const key = `Digit${pad.index + 1}`;+ const hit = input.isKeyPressed(key) || clicks.some((c) => c.target === entity);+ if (hit && pad.cooldown <= 0) {+ const sample = PADS[pad.index];+ if (sample) {+ audio.playSFX(sample.url, {+ pitch: 0.9 + Math.random() * 0.2,+ pan: (Math.random() - 0.5) * 0.6,+ });}- trigger.cooldown = 0.1;+ pad.cooldown = 0.08;}- triggerIndex++;}},- { name: 'SFXTriggerSystem' }+ { name: 'SFXSystem' },);diff --git a/examples/audio-demo/src/systems/visualizer.ts b/examples/audio-demo/src/systems/visualizer.tsindex 5aec3ed60..9605294ed 100644--- a/examples/audio-demo/src/systems/visualizer.ts+++ b/examples/audio-demo/src/systems/visualizer.ts@@ -1,19 +1,22 @@-import {- defineSystem, Query, Mut, Res, Time, UIRect,-} from 'esengine';-import { Visualizer } from '../components';+import { defineSystem, Query, Mut, Res, UINode, Audio } from 'esengine';+import type { AudioAPI } from 'esengine';+import { VisualizerBar } from '../components';+import { SPECTRUM_BINS, BAR_STRIDE } from '../config';-let barIndex = 0;+const spectrum = new Uint8Array(SPECTRUM_BINS);+const BASE_H = 6;+const MAX_H = 130;+// Drive each bar's height from a real analyser bin of the master output. Falls+// back to flat bars on backends without analysis (getSpectrum returns false).export const visualizerSystem = defineSystem(- [Query(Mut(UIRect), Visualizer), Res(Time)],- (query, time) => {- barIndex = 0;- for (const [_entity, rect] of query) {- const height = 20 + Math.abs(Math.sin(time.elapsed * 3 + barIndex * 0.5)) * 100;- rect.size = { x: rect.size.x, y: height };- barIndex++;+ [Query(Mut(UINode), VisualizerBar), Res(Audio)],+ (bars, audio: AudioAPI) => {+ const live = audio.getSpectrum(spectrum);+ for (const [, node, bar] of bars) {+ const mag = live ? (spectrum[bar.index * BAR_STRIDE] ?? 0) / 255 : 0;+ node.height = { value: BASE_H + mag * MAX_H, unit: node.height.unit };}},- { name: 'VisualizerSystem' }+ { name: 'VisualizerSystem' },);diff --git a/examples/audio-demo/src/systems/volume.ts b/examples/audio-demo/src/systems/volume.tsnew file mode 100644index 000000000..fd4d75ddb--- /dev/null+++ b/examples/audio-demo/src/systems/volume.ts@@ -0,0 +1,40 @@+import {+ defineSystem, Query, Mut, Res, UIEvents, Audio, Text,+} from 'esengine';+import type { UIEventQueue, AudioAPI } from 'esengine';+import { VolumeKnob, VolumeLabel } from '../components';+import { VOLUME_STEPS } from '../config';++function applyBusVolume(audio: AudioAPI, bus: string, v: number): void {+ if (bus === 'master') audio.setMasterVolume(v);+ else if (bus === 'music') audio.setMusicVolume(v);+ else if (bus === 'sfx') audio.setSFXVolume(v);+}++const cap = (s: string): string => s.charAt(0).toUpperCase() + s.slice(1);++// Clicking a knob steps its bus volume through VOLUME_STEPS; labels mirror each+// bus's current level.+export const volumeSystem = defineSystem(+ [Res(UIEvents), Res(Audio), Query(Mut(VolumeKnob)), Query(Mut(Text), VolumeLabel)],+ (events: UIEventQueue, audio: AudioAPI, knobs, labels) => {+ const clicks = events.query('click');+ const vol: Record<string, number> = {};+ let changed = false;+ for (const [entity, knob] of knobs) {+ if (clicks.some((c) => c.target === entity)) {+ const next = (VOLUME_STEPS.indexOf(knob.volume) + 1) % VOLUME_STEPS.length;+ knob.volume = VOLUME_STEPS[next] ?? 1;+ applyBusVolume(audio, knob.bus, knob.volume);+ changed = true;+ }+ vol[knob.bus] = knob.volume;+ }+ if (changed) {+ for (const [, text, label] of labels) {+ text.content = `${cap(label.bus)} ${Math.round((vol[label.bus] ?? 1) * 100)}%`;+ }+ }+ },+ { name: 'VolumeSystem' },+);