AudioMixer
Controls audio properties for a group of sounds.
AudioMixer allows collective control over sounds assigned to the same group, making it easy to adjust volume, pan, pitch, or mute entire categories of sounds (e.g., music, sound effects, UI sounds) independently.
Mixers are created automatically when accessed through app.audio.mixer(index)
or when a sound's group property is set.
The mixer's settings are multiplied with individual sound settings:
- Final volume = sound.volume × mixer.volume × 2
- Final pan = sound.pan + mixer.pan
- Final pitch = sound.pitch + (mixer.pitch - 1)
// Control all sounds in group 1 (e.g., music)
var musicMixer = app.audio.mixer(1);
musicMixer.volume = 0.3;
musicMixer.mute = false;
// Assign sounds to the music group
var bgMusic = assets.sound('background');
bgMusic.group = 1;
bgMusic.play(0, true);
Instance Members
volume: FloatMaster volume for all sounds in this group. Range: 0.0 (silent) to 1.0 (full volume) Default: 0.5 This is multiplied by 2 then multiplied with each sound's individual volume.
pan: FloatMaster pan adjustment for all sounds in this group. Range: -1.0 (full left) to 1.0 (full right) Default: 0.0 (center) This is added to each sound's individual pan value.
pitch: FloatMaster pitch adjustment for all sounds in this group. Default: 1.0 (no change) The adjustment (pitch - 1) is added to each sound's individual pitch.
mute: BoolMute all sounds in this group. When true, sounds in this group won't play at all. Useful for quickly toggling categories of sounds on/off.
index: IntThe group index this mixer controls. Read-only - set when the mixer is created.
Private Members
Private constructor - mixers are created by the Audio system.
Use app.audio.mixer(index) to get or create a mixer.
| Name | Type | Description |
|---|---|---|
index |
Int | The group index for this mixer |
Metadata
| Name | Parameters |
|---|---|
:build |
ceramic.macros.EntityMacro.buildForCompletion() |
:autoBuild |
ceramic.macros.EntityMacro.buildForCompletion() |
:build |
tracker.macros.EventsMacro.build() |
:autoBuild |
tracker.macros.EventsMacro.build() |