Skip to content

DeAudio

Daniele Giardini edited this page Mar 17, 2017 · 15 revisions

DeAudio + DeAudioEditor

Download


Requires Core libraries and DOTween

A simple and straightforward Audio manager, which manages and automatically deals with the creation of required AudioSources (according to the options you set), and comes with global/group/clip volume controls, fade effects, and more.

DeAudioManager

Mode A

Store it as a prefab and load it at runtime. Used to create and setup all the audio groups (DeAudioGroup) you will use.

Mode B

If you don't care about having separate audio groups, just call DeAudioManager.Init() to initialize it, and then DeAudioManager.Play(parameters) to play an audio file in the default global group.

Mode C

Create a DeAudioManager with a selection of groups and options completely via API at runtime, using DeAudioManager.Init(DeAudioGroup[] audioGroups).

// Example
DeAudioManager.Init(new[] {
   // DeAudioGroup constructor parameters:
   // groupId, volume, maxSources, preallocate, recycle, mixerGroup
   new DeAudioGroup(DeAudioGroupId.Music, 1, 4, 2),
   new DeAudioGroup(DeAudioGroupId.FX, 1),
});

DeAudioClipData

You can use DeAudioClipData objects in your classes to store more info about an audio file (like volume, pitch, and DeAudioGroup). If public and inside a MonoBehaviour, the default Inspector will render them in a special mode that shows all available properties.

API

I'll write more about it later, but Intellisense will help you for now, so here's just the basics.

DeAudioManager has a bunch of static methods to control global settings, groups, or clips. You can also directly use methods on sound groups (DeAudioGroup) or sources (DeAudioSource).

DeAudioSource DeAudioManager.Play(parameters)
Plays a clip or a DeAudioClipData object, with options for setting the sound group, volume, etc. Returns the DeAudioSource used to play it.

void DeAudioManager.Stop(parameters)
Depending on the parameters passed, stops a clip or all the clips inside a sound group.

void DeAudioManager.SetVolume(parameters)
Depending on the parameters passed, sets the global volume, the volume of a sound group, or the volume of a specific clip.

DeAudioGroup DeAudioManager.GetAudioGroup(DeAudioGroupId groupId)
Returns the DeAudioGroup with the given ID, or NULL if there is none.

void DeAudioManager.Fade[Sources]Out/In/To(parameters)
void DeAudioManager.CrossFade(parameters)
Depending on the parameters passed, fades the given global/group/clip/sources to the given volume, with options to stop clips when their volume reaches 0 and callbacks.