Files
AppleHillsProduction/docs/audiomanager_readme.md

44 lines
3.1 KiB
Markdown
Raw Normal View History

2025-10-30 14:17:47 +01:00
# Apple Hills Audio Manager
This document describes the classes and functionality of the AudioManager, LevelAudioObject and AppleAudioSource classes and components.
# AudioManager
The AudioManager is loaded through the bootstrap framework and will be added to every single level and minigame automatically.
It implements our Singletong framework and you can call functionality on the manager from any script in the project using:
```
AudioManager.Instance.WhatEverFunctionYouDesire();
```
## General overview
Everything that makes a sound should add the `AppleAudioSource` component. This component automatically adds Unity's own AudioSource that handles playing audio, but wraps it in our own custom class enabling more control over the game's audio assets.
All `AppleAudioSource` assets registers themselves with the `AudioManager` Singleton class that gets loaded in all levels allowing us to control all audio sources without fiddling with every single gameobject that makes sound.
All `AppleAudioSource` assets routes their audio to the AudioMixer which allows us to change the volume on categories of sounds i.e. ambience, music, sound etc. seperately. The AudioMixer also allows us to add effects to every category of sounds seperately and has a Master bus to control the general volume of all sound effects in the game.
## AudioManager component
![The AudioManager Component.](media/audiomanager_component.png)
The AudioManager component requires only one reference to function: The AudioMixer asset that handles all audio routing and volume mixing of the project.
### AudioManager options
The AudioManager only has one available option which is how it should handle audio when the game is paused.
**No Audio** pauses all audio sources when Pause is called on the GameManager.
**Play All Audio** ignores Pause completely by using `UnscaledTime`.
**MusicOnly** is still TODO and not fully implemented, but it also sets the mixer to work on `UnscaledTime` and we just need pause all other audio sources when Pause is called on the GameManager.
### AudioMixer
![The AudioMixer asset controlling all volumes.](media/audiomixer.png)
All AppleAudioSources outputs their audio to the `AppleHillsAudioMix` asset which handles the final volume of all audio sources of the game.
This allows us to expose volume sliders to options, and to tweak the volume of each sound source seperately, add effects like limiters, compressors etc.
**Ambience** is for the atmospheric background audio. Wind in the trees, bird chirps, water burbles etc. Outputs audio to the Master channel.
**SFX** is for smacks, whooshes, and other sound effects. Outputs audio to the Master channel.
**Music** is for.. music.. Outputs audio to the Master channel.
**Voice Over** is the accumulated audio of critical voice-over and flavor VO. Outputs audio to the Master channel.
**Critical VO** is all voice-over that guides the player and is considered more important to hear than everything else in the game. Outputs audio the the Voice Over channel.
**Flavor VO** is voice-over used for jokes, screams etc. and which is considered less important to hear than critical VO. Outputs audio to the Voice Over channel.
```
Some code
```