simvx.core.audio_bus¶
Audio bus system – named buses with volume, mute, and routing.
Provides a mixing hierarchy similar to Godot’s audio bus layout. Buses can route to parent buses (e.g., SFX -> Master, Music -> Master), and the final volume is computed by walking the chain.
Public API: from simvx.core.audio_bus import AudioBusLayout, AudioBus
layout = AudioBusLayout.get_default()
layout.get_bus("Music").volume_db = -6.0
layout.get_bus("SFX").mute = True
# Effective volume considers the full chain:
effective = layout.get_effective_volume("SFX")
Module Contents¶
Classes¶
A single audio bus with volume, mute, and parent routing. |
|
Collection of audio buses with routing and volume computation. |
Data¶
API¶
- simvx.core.audio_bus.__all__¶
[‘AudioBus’, ‘AudioBusLayout’]
- class simvx.core.audio_bus.AudioBus(name: str, volume_db: float = 0.0, send_to: str = '')[source]¶
A single audio bus with volume, mute, and parent routing.
Attributes: name: Bus display name (e.g., “Master”, “SFX”). volume_db: Volume in decibels (-80 to 24). 0 = full volume. mute: If True, this bus and all children produce no output. solo: If True, only this bus (and its children) produce output. send_to: Name of the parent bus this routes to (empty for Master).
Initialization
- __slots__¶
(‘name’, ‘volume_db’, ‘mute’, ‘solo’, ‘send_to’, ‘_effects’)
- property effects: list[Any]¶
Read-only view of effects on this bus.
- class simvx.core.audio_bus.AudioBusLayout[source]¶
Collection of audio buses with routing and volume computation.
Default layout creates four buses: Master (root) <- Music, SFX, Voice
Initialization
- add_bus(name: str, volume_db: float = 0.0, send_to: str = '') simvx.core.audio_bus.AudioBus[source]¶
Add a new audio bus.
Args: name: Unique bus name. volume_db: Initial volume in dB. send_to: Name of parent bus to route to.
Returns: The created AudioBus.
- get_bus(name: str) simvx.core.audio_bus.AudioBus | None[source]¶
Get a bus by name, or None if not found.
- property buses: list[simvx.core.audio_bus.AudioBus]¶
All buses in the layout.
- property bus_names: list[str]¶
Names of all buses.
- get_effective_volume(bus_name: str) float[source]¶
Compute effective volume in dB by walking the bus chain to Master.
The effective volume is the sum of volume_db values along the chain. If any bus in the chain is muted, returns -80 (silent).
- get_effective_linear(bus_name: str) float[source]¶
Compute effective volume as linear multiplier (0.0 to ~15.85).
- classmethod get_default() simvx.core.audio_bus.AudioBusLayout[source]¶
Return the default bus layout (Master, Music, SFX, Voice).
- classmethod create_default() simvx.core.audio_bus.AudioBusLayout[source]¶
Create the standard four-bus layout.
- classmethod from_dict(data: list[dict]) simvx.core.audio_bus.AudioBusLayout[source]¶
Deserialize from JSON format.