Skip to content

Audio Manager

NebSeniah edited this page Jul 22, 2026 · 9 revisions

System Summary

The Audio Manager controls all audio being played, with the music and sound effects separated into two different functionalities. Audio and be run from the UI, in which case the existence of files should be guaranteed, it can also be run from the folder LevelSmithLabs/Audio in the user's roaming appdata. The Manager also handles fallback if said files do not currently exist.


Connected Systems

Connecting Systems:

Related Controls

  • Control for audio is found in the settings menu

Bugs

  • None

Feature List / Breakdown of Features

Audio:

  • User can place appropriately named audio files into the Audio folder to play custom sound effects/music during testing
  • If files don't exist, fallback is handled with default sound effects during gameplay
  • Folder can be used to create multiple possible audio sources
  • Basic sound effects play during editing

All audio files that can be added by the user: PlayerDeath, PlayerJump, Victory, EnemyDeath, LevelMusic, Walking effect for Ice, Sticky, and Standard tiles, Bounce effect


Important Variables

  • available_players : Array[AudioStreamPlayer] = All AudioStreamPlayers not currently playing audio, new sound effects can be run in these.

  • walking_player: AudioStreamPlayer = The AudioStreamPlayer that gets used to play walking sounds whenever the player moves, runs repeatedly as long as the player is walking.

  • inuse_players : Array[AudioStreamPlayer] = All AudioStreamPlayers that are currently playing audio, these are stored so volume changes impact currently played effects.

  • queue : Array[String] = An array of filepaths with audio to play, can be .mp4 or .wav.

  • soundLevels : Dictionary = Contains references to sound effects with different individual volume values. Used more prominently in VolumeSlider branch.

Important Functions

  • func play_(UI_)effect(effectName: String) -> void: Plays a sound effect or UI effect, sound effects get routed through the currently created Audio folder in the user's Roaming directory, UI sound effects are stored in the project. This function adds the effect to the queue to play during the next _process frame a player is available.

  • func play_(UI_)music(musicName: String) -> void: Stops the currently played music being held by musicPlayer, starts music at the specified filepath. Filepath handling works the same as play_(UI_)effect.

  • func find_audio_in_folder(folderPath: String) -> AudioStream: Takes in the folderPath for a sound effect and reads the file inside of it, if the file is a valid extension, attach it to a new AudioStream and return it to be played within the AssetManager.


Future Work / Risks

Future Work:

  1. Merge branch for adjusting volume of individual assets into main.

Risks:

  • If the user puts in a file that's not .mp3, .wav, .ogg, it won't work.

Miscellaneous Notes

  • None

Clone this wiki locally