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.
|
| 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, AudioResource audioResourceToPlay=null, float initialDelay=0f) |
| | Plays a sound, signature with all options.
|
| virtual void | PauseSound (AudioSource source) |
| | Pauses the specified audiosource.
|
| virtual void | ResumeSound (AudioSource source) |
| | resumes play on the specified audio source
|
| virtual void | StopSound (AudioSource source) |
| | Stops the specified audio source.
|
| virtual void | FreeSound (AudioSource source) |
| | Frees a specific sound, stopping it and returning it to the pool.
|
| virtual bool | IsPaused (MMSoundManagerTracks track) |
| | Returns true if the specified track is currently paused, false otherwise.
|
| virtual void | MuteTrack (MMSoundManagerTracks track) |
| | Mutes an entire track.
|
| virtual void | UnmuteTrack (MMSoundManagerTracks track) |
| | Unmutes an entire track.
|
| virtual void | SetTrackVolume (MMSoundManagerTracks track, float volume) |
| | Sets the volume of an entire track.
|
| virtual float | GetTrackVolume (MMSoundManagerTracks track, bool mutedVolume) |
| | Returns the current volume of a track.
|
| virtual void | PauseTrack (MMSoundManagerTracks track) |
| | Pauses all sounds on a track.
|
| virtual void | PlayTrack (MMSoundManagerTracks track) |
| | Plays or resumes all sounds on a track.
|
| virtual void | StopTrack (MMSoundManagerTracks track) |
| | Stops all sounds on a track.
|
| virtual bool | HasSoundsPlaying (MMSoundManagerTracks track) |
| | Returns true if sounds are currently playing on that track.
|
| virtual List< MMSoundManagerSound > | GetSoundsPlaying (MMSoundManagerTracks track) |
| | Returns a list of MMSoundManagerSounds for the specified track.
|
| virtual void | FreeTrack (MMSoundManagerTracks track) |
| | Stops all sounds on a track, and returns them to the pool.
|
| virtual void | MuteMusic () |
| | Mutes the music track, QoL method ready to bind to a UnityEvent.
|
| virtual void | UnmuteMusic () |
| | Unmutes the music track, QoL method ready to bind to a UnityEvent.
|
| virtual void | MuteSfx () |
| | Mutes the sfx track, QoL method ready to bind to a UnityEvent.
|
| virtual void | UnmuteSfx () |
| | Unmutes the sfx track, QoL method ready to bind to a UnityEvent.
|
| virtual void | MuteUI () |
| | Mutes the UI track, QoL method ready to bind to a UnityEvent.
|
| virtual void | UnmuteUI () |
| | Unmutes the UI track, QoL method ready to bind to a UnityEvent.
|
| virtual void | MuteMaster () |
| | Mutes the master track, QoL method ready to bind to a UnityEvent.
|
| virtual void | UnmuteMaster () |
| | Unmutes the master track, QoL method ready to bind to a UnityEvent.
|
| virtual void | SetVolumeMusic (float newVolume) |
| | Sets the volume of the Music track to the specified value, QoL method, ready to bind to a UnityEvent.
|
| virtual void | SetVolumeSfx (float newVolume) |
| | Sets the volume of the SFX track to the specified value, QoL method, ready to bind to a UnityEvent.
|
| virtual void | SetVolumeUI (float newVolume) |
| | Sets the volume of the UI track to the specified value, QoL method, ready to bind to a UnityEvent.
|
| virtual void | SetVolumeMaster (float newVolume) |
| | Sets the volume of the Master track to the specified value, QoL method, ready to bind to a UnityEvent.
|
| virtual bool | IsMuted (MMSoundManagerTracks track) |
| | Returns true if the specified track is muted, false otherwise.
|
| virtual void | MuteTrack (MMSoundManagerCustomTrackSO customTrack) |
| | Mutes a custom track.
|
| virtual void | UnmuteTrack (MMSoundManagerCustomTrackSO customTrack) |
| | Unmutes a custom track.
|
| virtual void | SetTrackVolume (MMSoundManagerCustomTrackSO customTrack, float volume) |
| | Sets the volume of a custom track.
|
| virtual float | GetTrackVolume (MMSoundManagerCustomTrackSO customTrack, bool mutedVolume) |
| | Returns the current volume of a custom track.
|
| virtual bool | IsMuted (MMSoundManagerCustomTrackSO customTrack) |
| | Returns true if the specified custom track is muted.
|
| virtual void | PauseTrack (MMSoundManagerCustomTrackSO customTrack) |
| | Pauses all sounds on a custom track.
|
| virtual void | PlayTrack (MMSoundManagerCustomTrackSO customTrack) |
| | Plays or resumes all sounds on a custom track.
|
| virtual void | StopTrack (MMSoundManagerCustomTrackSO customTrack) |
| | Stops all sounds on a custom track.
|
| virtual bool | HasSoundsPlaying (MMSoundManagerCustomTrackSO customTrack) |
| | Returns true if sounds are currently playing on a custom track.
|
| virtual List< MMSoundManagerSound > | GetSoundsPlaying (MMSoundManagerCustomTrackSO customTrack) |
| | Returns a list of sounds playing on a custom track.
|
| virtual void | FreeTrack (MMSoundManagerCustomTrackSO customTrack) |
| | Stops all sounds on a custom track and returns them to the pool.
|
| virtual void | SetTrackPitch (MMSoundManagerTracks track, float pitch) |
| | Sets the pitch multiplier of an entire track. This multiplier gets applied to every sound currently playing on that track, as well as to every sound played on it later, on top of each sound's own pitch (final pitch = sound pitch * track pitch). The Master track's pitch multiplies the pitch of all sounds, regardless of their track. Track pitch is runtime only : it's not saved with the sound settings, and resets to 1 when the MMSoundManager initializes. Calling this will stop any pitch fade currently running on that track.
|
| virtual float | GetTrackPitch (MMSoundManagerTracks track) |
| | Returns the current pitch multiplier of the specified track (1 if it was never set)
|
| virtual void | ResetTrackPitch (MMSoundManagerTracks track) |
| | Resets the pitch multiplier of the specified track to 1, stopping any pitch fade on it.
|
| virtual void | SetTrackPitch (MMSoundManagerCustomTrackSO customTrack, float pitch) |
| | Sets the pitch multiplier of a custom track. It gets applied to all sounds playing on that custom track (and later ones), on top of the Other and Master track pitches, and of each sound's own pitch. Calling this will stop any pitch fade currently running on that custom track.
|
| virtual float | GetTrackPitch (MMSoundManagerCustomTrackSO customTrack) |
| | Returns the current pitch multiplier of the specified custom track (1 if it was never set)
|
| virtual void | ResetTrackPitch (MMSoundManagerCustomTrackSO customTrack) |
| | Resets the pitch multiplier of the specified custom track to 1, stopping any pitch fade on it.
|
| virtual void | ResetAllTrackPitches () |
| | Stops all track pitch fades, resets the pitch multiplier of every track (built-in and custom) to 1, and restores the base pitch of all sounds.
|
| virtual float | GetTrackPitchMultiplier (MMSoundManagerTracks track, MMSoundManagerCustomTrackSO customTrack=null) |
| | Returns the total pitch multiplier that applies to a sound played on the specified track (and optional custom track) : Master pitch * track pitch (* custom track pitch if the track is Other and a custom track is specified)
|
| virtual void | SetSoundPitch (AudioSource source, float basePitch) |
| | Changes the pitch of a sound played by the MMSoundManager, while preserving its track pitch multiplier. Use this rather than setting AudioSource.pitch directly on a managed sound, as track pitch changes recompute the source's pitch from its stored base pitch. If the source isn't managed by this MMSoundManager, its pitch is simply set to the specified value.
|
| virtual void | SetPitchMusic (float newPitch) |
| | Sets the pitch of the Music track to the specified value, QoL method, ready to bind to a UnityEvent.
|
| virtual void | SetPitchSfx (float newPitch) |
| | Sets the pitch of the SFX track to the specified value, QoL method, ready to bind to a UnityEvent.
|
| virtual void | SetPitchUI (float newPitch) |
| | Sets the pitch of the UI track to the specified value, QoL method, ready to bind to a UnityEvent.
|
| virtual void | SetPitchMaster (float newPitch) |
| | Sets the pitch of the Master track to the specified value, QoL method, ready to bind to a UnityEvent.
|
| virtual void | FadeTrackPitch (MMSoundManagerTracks track, float duration, float initialPitch=1f, float finalPitch=1f, MMTweenType tweenType=null) |
| | Fades the pitch multiplier of an entire track over the specified duration, from initialPitch to finalPitch. Any pitch fade already running on that track gets stopped first. A duration of 0 (or less) sets the final pitch instantly.
|
| virtual void | FadeTrackPitch (MMSoundManagerCustomTrackSO customTrack, float duration, float initialPitch=1f, float finalPitch=1f, MMTweenType tweenType=null) |
| | Fades the pitch multiplier of a custom track over the specified duration, from initialPitch to finalPitch. Any pitch fade already running on that custom track gets stopped first. A duration of 0 (or less) sets the final pitch instantly.
|
| virtual void | StopFadeTrackPitch (MMSoundManagerTracks track) |
| | Stops any pitch fade currently happening on the specified track, leaving its pitch where it currently is.
|
| virtual void | StopFadeTrackPitch (MMSoundManagerCustomTrackSO customTrack) |
| | Stops any pitch fade currently happening on the specified custom track, leaving its pitch where it currently is.
|
| virtual bool | TrackPitchIsFading (MMSoundManagerTracks track) |
| | Returns true if a pitch fade is currently running on the specified track.
|
| 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.
|
| virtual void | FadeTrack (MMSoundManagerCustomTrackSO customTrack, float duration, float initialVolume=0f, float finalVolume=1f, MMTweenType tweenType=null) |
| | Fades a custom track over the specified duration towards the desired finalVolume.
|
| 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.
|
| virtual bool | SoundIsFadingIn (AudioSource source) |
| | Returns true if the specified source is already fading, false otherwise.
|
| virtual bool | SoundIsFadingOut (AudioSource source) |
| | Returns true if the specified source is already fading, false otherwise.
|
| virtual void | StopFadeTrack (MMSoundManagerTracks track) |
| | Stops any fade currently happening on the specified track.
|
| virtual void | StopFadeTrack (MMSoundManagerCustomTrackSO customTrack) |
| | Stops any fade currently happening on the specified custom track.
|
| virtual void | StopFadeSound (AudioSource source) |
| | Stops any fade currently happening on the specified sound.
|
| virtual void | MuteSoundsOnTrack (MMSoundManagerTracks track, bool mute, float delay=0f) |
| | Mutes all sounds playing on a specific track.
|
| virtual void | MuteAllSounds (bool mute=true) |
| | Mutes all sounds playing on the MMSoundManager.
|
| virtual AudioSource | FindByID (int ID) |
| | Returns an audio source played with the specified ID, if one is found.
|
| virtual AudioSource | FindByClip (AudioClip clip) |
| | Returns an audio source played with the specified ID, if one is found.
|
| virtual int | CurrentlyPlayingCount (AudioClip clip) |
| | Returns the amount of audiosources currently playing the specified clip on this sound manager.
|
| virtual void | PauseAllSounds () |
| | Pauses all sounds playing on the MMSoundManager.
|
| virtual void | PlayAllSounds () |
| | Plays all sounds playing on the MMSoundManager.
|
| virtual void | StopAllSounds () |
| | Stops all sounds playing on the MMSoundManager.
|
| virtual void | FreeAllSounds () |
| | Stops all sounds and returns them to the pool.
|
| virtual void | FreeAllSoundsButPersistent () |
| | Stops all sounds except the persistent ones, and returns them to the pool.
|
| virtual void | FreeAllLoopingSounds () |
| | Stops all looping sounds and returns them to the pool.
|
| virtual void | OnMMEvent (MMSoundManagerTrackEvent soundManagerTrackEvent) |
| virtual void | OnMMEvent (MMSoundManagerEvent soundManagerEvent) |
| virtual void | SaveSettings () |
| | Save sound settings to file.
|
| virtual void | LoadSettings () |
| | Loads sound settings from file.
|
| virtual void | ResetSettings () |
| | Deletes any saved sound settings.
|
| virtual void | OnMMEvent (MMSoundManagerSoundControlEvent soundControlEvent) |
| virtual void | OnMMEvent (MMSoundManagerTrackFadeEvent trackFadeEvent) |
| virtual void | OnMMEvent (MMSoundManagerTrackPitchFadeEvent trackPitchFadeEvent) |
| | When getting a track pitch fade event, we fade (or stop fading) the pitch of the target track, from its current pitch.
|
| 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) |
|
| override void | Awake () |
| | On Awake we initialize our manager.
|
| 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.
|
| virtual void | InitializeSoundManager () |
| | Initializes the pool, fills it, registers to the scene loaded event.
|
| virtual void | ControlTrack (MMSoundManagerTracks track, ControlTrackModes trackMode, float volume=0.5f) |
| virtual void | ControlTrack (MMSoundManagerCustomTrackSO customTrack, ControlTrackModes trackMode, float volume=0.5f) |
| | Controls a custom track (mute, unmute, set volume)
|
| virtual void | SetTrackPitchInternal (MMSoundManagerTracks track, float pitch) |
| | Stores the clamped pitch multiplier for the specified track and applies it to the affected sounds, without stopping fades.
|
| virtual void | SetTrackPitchInternal (MMSoundManagerCustomTrackSO customTrack, float pitch) |
| | Stores the clamped pitch multiplier for the specified custom track and applies it to the affected sounds, without stopping fades.
|
| virtual float | ClampTrackPitch (float pitch) |
| | Clamps a track pitch multiplier to the allowed range.
|
| virtual void | ApplyTrackPitch (MMSoundManagerTracks track) |
| | Recomputes the pitch of every sound impacted by the specified track (all sounds if the track is Master) from their base pitch and current track multipliers.
|
| virtual void | ApplyTrackPitch (MMSoundManagerCustomTrackSO customTrack) |
| | Recomputes the pitch of every sound playing on the specified custom track from their base pitch and current track multipliers.
|
| virtual IEnumerator | FadeTrackPitchCoroutine (MMSoundManagerTracks track, float duration, float initialPitch, float finalPitch, MMTweenType tweenType) |
| | Fades a track's pitch multiplier over time.
|
| virtual IEnumerator | FadeCustomTrackPitchCoroutine (MMSoundManagerCustomTrackSO customTrack, float duration, float initialPitch, float finalPitch, MMTweenType tweenType) |
| | Fades a custom track's pitch multiplier over time.
|
| virtual IEnumerator | FadeTrackCoroutine (MMSoundManagerTracks track, float duration, float initialVolume, float finalVolume, MMTweenType tweenType) |
| | Fades an entire track over time.
|
| virtual IEnumerator | FadeCustomTrackCoroutine (MMSoundManagerCustomTrackSO customTrack, float duration, float initialVolume, float finalVolume, MMTweenType tweenType) |
| | Fades a custom track over time.
|
| virtual IEnumerator | FadeCoroutine (AudioSource source, float duration, float initialVolume, float finalVolume, MMTweenType tweenType, bool freeAfterFade=false) |
| | Fades an audiosource's volume over time.
|
| virtual IEnumerator | MuteSoundsOnTrackCoroutine (MMSoundManagerTracks track, bool mute, float delay) |
| | Mutes all sounds on the specified track after an optional delay.
|
| virtual IEnumerator | MuteAllSoundsCoroutine (float delay, bool mute=true) |
| | Mutes all sounds after an optional delay.
|
| 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.
|
| virtual void | OnEnable () |
| | On enable we start listening for events.
|
| virtual void | OnDisable () |
| | On disable we stop listening for events.
|
| virtual void | InitializeSingleton () |
| | Initializes the singleton.
|