Skip to content

Audio Scenes

Narta Xaymar Dirks edited this page Nov 27, 2026 · 1 revision

Audio scenes

An audio scene holds what buses and the listener should be set to, and sets all of it at once, with a fade, when it is applied. A game makes its scenes while loading and applies one when the place changes, the way it makes entities once and calls RenderWorld every frame. A scene holds only the values that were set in it, so a pause scene that turns the world down leaves the music and the listener alone.

Include "<audio.bb>"
world = CreateAudioBus()

; On the planet: air, normal doppler. In space: no doppler, sounds carry less, the world is quieter.
planet = CreateAudioScene()
AudioSceneListener planet, BB_LISTENER_DOPPLER, 1
AudioSceneListener planet, BB_LISTENER_ROLLOFF, 1
AudioSceneVolume planet, world, 1
space = CopyAudioScene(planet)
AudioSceneListener space, BB_LISTENER_DOPPLER, 0
AudioSceneListener space, BB_LISTENER_ROLLOFF, 3
AudioSceneVolume space, world, 0.4

; Leaving the atmosphere takes five seconds.
ApplyAudioScene space, 5000
Command What it does
CreateAudioScene, FreeAudioScene, CopyAudioScene Make, free and copy a scene.
AudioSceneVolume A bus volume in the scene.
AudioSceneListener A listener setting in the scene (BB_LISTENER_* from the shipped include file audio.bb).
ClearAudioScene Forgets one bus, or everything.
CaptureAudioScene Fills the scene with what everything is at now.
ApplyAudioScene Sets what the scene holds, with a fade.
BlendAudioScene Sets a mix of two scenes, for crossfades that follow the player.

The falloff curve (ListenerFalloff) is not in scenes, as a curve can't fade from one to another.

Home · Command Index


Getting started

Language

Tools


Language Features
BlitzBasic
Blitz3D
BlitzPlus
Differences

More

Clone this wiki locally