jengine-audio
Audio package for jEngine — kira-based sound effects and music.
| Kind | Built-in: linked into the stock runtime and editor viewport |
| Source | packages/jengine-audio |
| Version | 0.1.0 |
| Entry point | jengine_audio::AudioPackage |
Using it
Section titled “Using it”The stock runtime, web build and editor viewport are compiled with this package, so there is
nothing to link. A project that has a settings.enabled_packages list must name it there, since
that list is an allow-list once it exists; a project without the key gets every built-in.
{ "settings": { "enabled_packages": ["jengine-audio"] } }Its components are also core components, so v1 and v2 scenes both carry them.
Components
Section titled “Components”| Scene key | Rust type | |
|---|---|---|
audio_source | AudioSource | also registered by core |
Scenes that use it
Section titled “Scenes that use it”projects/engine-test-lab/assets/scenes/162-positional-audio.sceneprojects/engine-test-lab/assets/scenes/165-audio-effects.sceneprojects/engine-test-lab/assets/scenes/243-wall-occlusion.sceneprojects/engine-test-lab/assets/scenes/47-motion-components.sceneprojects/visual-showcase/assets/scenes/116-muffled-halls.sceneprojects/visual-showcase/assets/scenes/43-night-market.sceneprojects/visual-showcase/assets/scenes/46-sea-cove.sceneprojects/visual-showcase/assets/scenes/48-the-forge.sceneprojects/visual-showcase/assets/scenes/49-stage-night.sceneprojects/visual-showcase/assets/scenes/78-echo-canyon.scene
From packages/jengine-audio/README.md.
Sound effects and music on kira, for the native runtime.
This is a built-in package of the native runtime. It is native only:
kira does not build for wasm32, so a web build refuses a project that lists
it by name rather than silently leaving it out. The editor and web builds play
the same sounds through their own Web Audio backend, so leave it out of a
project’s "packages" array and let settings.enabled_packages name it.
What it registers
Section titled “What it registers”| Component | Is |
|---|---|
audio_source | A clip on an entity: clip_id, volume, pitch, looping, auto_play, its mixer bus_id, and spatial (with min_distance / max_distance) to be heard from where the entity is. |
audio_source is also a core component, so it works in v1 and v2 scenes.
It re-exports core’s AudioBackend, KiraAudioBackend and friends for Rust
code that wants them. Its audio_update system ticks a backend only if a host
shares one as a resource; the shipped runtimes drive their backend themselves.
From scripts
Section titled “From scripts”Scripts use core’s Audio namespace in every runtime: Audio.play_sound,
Audio.play_sound_at, Audio.play_music, Audio.get_music_position, the
mixer buses (Audio.create_bus, Audio.set_bus_volume,
Audio.set_bus_effect) and more - see the Audio guide and
the Scripting API.
The package’s own audio_* script descriptors are metadata only; no
runtime installs them as globals.
Things to know
Section titled “Things to know”- A clip must be preloaded: list it in the scene’s top-level
"audio_refs"array.clip_idis the path underassets/("sounds/hit.wav"). - Time things to the music with
Audio.get_music_position(), not by adding updt.