A simple yet powerful sound manager, that will let you play sounds with an event based approach and performance in mind.
More...
|
virtual AudioSource | PlaySound (AudioClip audioClip, MMSoundManagerPlayOptions options) |
| Plays a sound, separate options object signature More...
|
|
virtual AudioSource | PlaySound (AudioClip audioClip, MMSoundManagerTracks mmSoundManagerTrack, Vector3 location, bool loop=false, float volume=1.0f, int ID=0, bool fade=false, float fadeInitialVolume=0f, float fadeDuration=1f, MMTweenType fadeTween=null, bool persistent=false, AudioSource recycleAudioSource=null, AudioMixerGroup audioGroup=null, float pitch=1f, float panStereo=0f, float spatialBlend=0.0f, bool soloSingleTrack=false, bool soloAllTracks=false, bool autoUnSoloOnEnd=false, bool bypassEffects=false, bool bypassListenerEffects=false, bool bypassReverbZones=false, int priority=128, float reverbZoneMix=1f, float dopplerLevel=1f, int spread=0, AudioRolloffMode rolloffMode=AudioRolloffMode.Logarithmic, float minDistance=1f, float maxDistance=500f, bool doNotAutoRecycleIfNotDonePlaying=false, float playbackTime=0f, float playbackDuration=0f, Transform attachToTransform=null, bool useSpreadCurve=false, AnimationCurve spreadCurve=null, bool useCustomRolloffCurve=false, AnimationCurve customRolloffCurve=null, bool useSpatialBlendCurve=false, AnimationCurve spatialBlendCurve=null, bool useReverbZoneMixCurve=false, AnimationCurve reverbZoneMixCurve=null) |
| Plays a sound, signature with all options More...
|
|
virtual void | PauseSound (AudioSource source) |
| Pauses the specified audiosource More...
|
|
virtual void | ResumeSound (AudioSource source) |
| resumes play on the specified audio source More...
|
|
virtual void | StopSound (AudioSource source) |
| Stops the specified audio source More...
|
|
virtual void | FreeSound (AudioSource source) |
| Frees a specific sound, stopping it and returning it to the pool More...
|
|
virtual void | MuteTrack (MMSoundManagerTracks track) |
| Mutes an entire track More...
|
|
virtual void | UnmuteTrack (MMSoundManagerTracks track) |
| Unmutes an entire track More...
|
|
virtual void | SetTrackVolume (MMSoundManagerTracks track, float volume) |
| Sets the volume of an entire track More...
|
|
virtual float | GetTrackVolume (MMSoundManagerTracks track, bool mutedVolume) |
| Returns the current volume of a track More...
|
|
virtual void | PauseTrack (MMSoundManagerTracks track) |
| Pauses all sounds on a track More...
|
|
virtual void | PlayTrack (MMSoundManagerTracks track) |
| Plays or resumes all sounds on a track More...
|
|
virtual void | StopTrack (MMSoundManagerTracks track) |
| Stops all sounds on a track More...
|
|
virtual bool | HasSoundsPlaying (MMSoundManagerTracks track) |
| Returns true if sounds are currently playing on that track More...
|
|
virtual List< MMSoundManagerSound > | GetSoundsPlaying (MMSoundManagerTracks track) |
| Returns a list of MMSoundManagerSounds for the specified track More...
|
|
virtual void | FreeTrack (MMSoundManagerTracks track) |
| Stops all sounds on a track, and returns them to the pool More...
|
|
virtual void | MuteMusic () |
| Mutes the music track, QoL method ready to bind to a UnityEvent More...
|
|
virtual void | UnmuteMusic () |
| Unmutes the music track, QoL method ready to bind to a UnityEvent More...
|
|
virtual void | MuteSfx () |
| Mutes the sfx track, QoL method ready to bind to a UnityEvent More...
|
|
virtual void | UnmuteSfx () |
| Unmutes the sfx track, QoL method ready to bind to a UnityEvent More...
|
|
virtual void | MuteUI () |
| Mutes the UI track, QoL method ready to bind to a UnityEvent More...
|
|
virtual void | UnmuteUI () |
| Unmutes the UI track, QoL method ready to bind to a UnityEvent More...
|
|
virtual void | MuteMaster () |
| Mutes the master track, QoL method ready to bind to a UnityEvent More...
|
|
virtual void | UnmuteMaster () |
| Unmutes the master track, QoL method ready to bind to a UnityEvent More...
|
|
virtual void | SetVolumeMusic (float newVolume) |
| Sets the volume of the Music track to the specified value, QoL method, ready to bind to a UnityEvent More...
|
|
virtual void | SetVolumeSfx (float newVolume) |
| Sets the volume of the SFX track to the specified value, QoL method, ready to bind to a UnityEvent More...
|
|
virtual void | SetVolumeUI (float newVolume) |
| Sets the volume of the UI track to the specified value, QoL method, ready to bind to a UnityEvent More...
|
|
virtual void | SetVolumeMaster (float newVolume) |
| Sets the volume of the Master track to the specified value, QoL method, ready to bind to a UnityEvent More...
|
|
virtual bool | IsMuted (MMSoundManagerTracks track) |
| Returns true if the specified track is muted, false otherwise More...
|
|
virtual void | FadeTrack (MMSoundManagerTracks track, float duration, float initialVolume=0f, float finalVolume=1f, MMTweenType tweenType=null) |
| Fades an entire track over the specified duration towards the desired finalVolume More...
|
|
virtual void | FadeSound (AudioSource source, float duration, float initialVolume, float finalVolume, MMTweenType tweenType, bool freeAfterFade=false) |
| Fades a target sound towards a final volume over time More...
|
|
virtual bool | SoundIsFadingIn (AudioSource source) |
| Returns true if the specified source is already fading, false otherwise More...
|
|
virtual bool | SoundIsFadingOut (AudioSource source) |
| Returns true if the specified source is already fading, false otherwise More...
|
|
virtual void | StopFadeTrack (MMSoundManagerTracks track) |
| Stops any fade currently happening on the specified track More...
|
|
virtual void | StopFadeSound (AudioSource source) |
| Stops any fade currently happening on the specified sound More...
|
|
virtual void | MuteSoundsOnTrack (MMSoundManagerTracks track, bool mute, float delay=0f) |
| Mutes all sounds playing on a specific track More...
|
|
virtual void | MuteAllSounds (bool mute=true) |
| Mutes all sounds playing on the MMSoundManager More...
|
|
virtual AudioSource | FindByID (int ID) |
| Returns an audio source played with the specified ID, if one is found More...
|
|
virtual AudioSource | FindByClip (AudioClip clip) |
| Returns an audio source played with the specified ID, if one is found More...
|
|
virtual void | PauseAllSounds () |
| Pauses all sounds playing on the MMSoundManager More...
|
|
virtual void | PlayAllSounds () |
| Plays all sounds playing on the MMSoundManager More...
|
|
virtual void | StopAllSounds () |
| Stops all sounds playing on the MMSoundManager More...
|
|
virtual void | FreeAllSounds () |
| Stops all sounds and returns them to the pool More...
|
|
virtual void | FreeAllSoundsButPersistent () |
| Stops all sounds except the persistent ones, and returns them to the pool More...
|
|
virtual void | FreeAllLoopingSounds () |
| Stops all looping sounds and returns them to the pool More...
|
|
virtual void | OnMMEvent (MMSoundManagerTrackEvent soundManagerTrackEvent) |
|
virtual void | OnMMEvent (MMSoundManagerEvent soundManagerEvent) |
|
virtual void | SaveSettings () |
| Save sound settings to file More...
|
|
virtual void | LoadSettings () |
| Loads sound settings from file More...
|
|
virtual void | ResetSettings () |
| Deletes any saved sound settings More...
|
|
virtual void | OnMMEvent (MMSoundManagerSoundControlEvent soundControlEvent) |
|
virtual void | OnMMEvent (MMSoundManagerTrackFadeEvent trackFadeEvent) |
|
virtual void | OnMMEvent (MMSoundManagerSoundFadeEvent soundFadeEvent) |
|
virtual void | OnMMEvent (MMSoundManagerAllSoundsControlEvent allSoundsControlEvent) |
|
virtual void | OnMMSfxEvent (AudioClip clipToPlay, AudioMixerGroup audioGroup=null, float volume=1f, float pitch=1f, int priority=128) |
|
virtual AudioSource | OnMMSoundManagerSoundPlayEvent (AudioClip clip, MMSoundManagerPlayOptions options) |
|
void | OnMMEvent (T eventType) |
|
void | OnMMEvent (T eventType) |
|
void | OnMMEvent (T eventType) |
|
void | OnMMEvent (T eventType) |
|
void | OnMMEvent (T eventType) |
|
void | OnMMEvent (T eventType) |
|
|
override void | Awake () |
| On Awake we initialize our manager More...
|
|
virtual void | Start () |
| On Start we load and apply our saved settings if needed. This is done on Start and not Awake because of a bug in Unity's AudioMixer API More...
|
|
virtual void | InitializeSoundManager () |
| Initializes the pool, fills it, registers to the scene loaded event More...
|
|
virtual void | ControlTrack (MMSoundManagerTracks track, ControlTrackModes trackMode, float volume=0.5f) |
|
virtual IEnumerator | FadeTrackCoroutine (MMSoundManagerTracks track, float duration, float initialVolume, float finalVolume, MMTweenType tweenType) |
| Fades an entire track over time More...
|
|
virtual IEnumerator | FadeCoroutine (AudioSource source, float duration, float initialVolume, float finalVolume, MMTweenType tweenType, bool freeAfterFade=false) |
| Fades an audiosource's volume over time More...
|
|
virtual IEnumerator | MuteSoundsOnTrackCoroutine (MMSoundManagerTracks track, bool mute, float delay) |
| Mutes all sounds on the specified track after an optional delay More...
|
|
virtual IEnumerator | MuteAllSoundsCoroutine (float delay, bool mute=true) |
| Mutes all sounds after an optional delay More...
|
|
virtual void | OnSceneLoaded (Scene arg0, LoadSceneMode loadSceneMode) |
| Registered on enable, triggers every time a new scene is loaded At which point we free all sounds except the persistent ones More...
|
|
virtual void | OnEnable () |
| On enable we start listening for events More...
|
|
virtual void | OnDisable () |
| On disable we stop listening for events More...
|
|
virtual void | InitializeSingleton () |
| Initializes the singleton. More...
|
|
A simple yet powerful sound manager, that will let you play sounds with an event based approach and performance in mind.
Features :
- Play/stop/pause/resume/free sounds
- Full control : loop, volume, pitch, pan, spatial blend, bypasses, priority, reverb, doppler level, spread, rolloff mode, distance
- 2D & 3D spatial support
- Built-in pooling, automatically recycle a set of audio sources for maximum performance
- Built in audio mixer and groups, with ready-made tracks (Master, Music, SFX, UI), and options to play on more groups if needed
- Stop/pause/resume/free entire tracks
- Stop/pause/resume/free all sounds at once
- Mute / set volume entire tracks
- Save and load settings, with auto save / auto load mechanics built-in
- Fade in/out sounds
- Fade in/out tracks
- Solo mode : play a sound with one or all tracks muted, then unmute them automatically afterwards
- PlayOptions struct
- Option to have sounds persist across scene loads and from scene to scene
- Inspector controls for tracks (volume, mute, unmute, play, pause, stop, resume, free, number of sounds)
- MMSfxEvents
- MMSoundManagerEvents : mute track, control track, save, load, reset, stop persistent sounds