Sample Object.zip (5.8 KB)
Volume Adjustment Required Script.zip (5.0 KB)
Volume Adjustment Sample Project.zip (222.6 KB)
AudioBusControlButton User Manual
AudioBusControlButton is a Button that, when pressed, calls the AutoLoad AudioBusSettings and performs volume level switching, volume increase/decrease, and mute toggling on the specified AudioServer bus.
The settings are saved by AudioBusSettings to user://audio_settings.cfg and restored on the next launch.
Setup
-
Create a scene for AudioBusSettings
- Create a new scene
- Set the root node to Node
- Attach
AudioBusSettings.gdto the root node - Save it as an example at
res://autoload/AudioBusSettings.tscn
-
Register the created scene in AutoLoad
- Open Project Settings
- Open AutoLoad
- Specify
res://autoload/AudioBusSettings.tscnin Path - Set the AutoLoad name in Name
Example:AudioBus - Press Add to register
-
Configure the export settings of AudioBusSettings in the scene
- Open
AudioBusSettings.tscn - Set the values in the Inspector of the root node
config_path: Exampleuser://audio_settings.cfg(no change needed)
config_section: Exampleaudio
include_master: Whether to include the Master bus
exposed_buses: If empty, all buses are included; otherwise, only the specified names are included
volume_levels: Linear candidates for level switching from 0.0 to 1.0
min_db: Lower limit to convert linear 0 vicinity to dB
- Open
-
Place AudioBusControlButton
- Add a Button node to the scene
- Attach
AudioBusControlButton.gdto the Button - Configure in the Inspector
autoload_name: Must match the AutoLoad name, e.g.,AudioBus
refresh_bus_list: Turn ON once to update the list, then turn OFF again
target_bus_name: Select the target bus from the dropdown (if the dropdown doesn’t update, save the project and reopen it)
mode: Select the action when pressed
Minimal Configuration
Minimum configuration for use as level switching.
- Set
modetoCYCLE_LEVELS - Leave
cycle_levels_percentempty
If empty,AudioBusSettings.volume_levelswill be used - Run and press the button
Volume switches to the next candidate, and after the last, it returns to the first - Stop and restart
If saving is enabled, the previous settings will be restored
Key Settings
mode
CYCLE_LEVELS: Finds the candidate closest to the current value and switches to the next oneMUTE_TOGGLE: Toggles muteVOLUME_UP: Increases linear volume bystep_percent_pointsVOLUME_DOWN: Decreases linear volume bystep_percent_points
cycle_levels_percent
- Specifies candidates in percent for
CYCLE_LEVELS - Example:
0, 25, 50, 75, 100 - If empty,
AudioBusSettings.volume_levelsis used
step_percent_points
- The increment/decrement amount for
VOLUME_UPandVOLUME_DOWN
Display
- If
auto_labelis true,textis automatically updated; set to false if you want to fix it label_prefixis the prefix string; if empty, the bus name will be at the beginning
