TopDown Engine  v4.1
MoreMountains.Feedbacks.MMF_Sound Class Reference
Inheritance diagram for MoreMountains.Feedbacks.MMF_Sound:
MoreMountains.Feedbacks.MMF_Feedback

Public Types

enum  PlayMethods { PlayMethods.Event, PlayMethods.Cached, PlayMethods.OnDemand, PlayMethods.Pool }
 The possible methods to play the sound with. Event : sends a MMSfxEvent, you'll need a class to catch this event and play the sound Cached : creates and stores an audiosource to play the sound with, parented to the owner OnDemand : creates an audiosource and destroys it everytime you want to play the sound More...
 

Public Member Functions

override void InitializeCustomAttributes ()
 Use this method to initialize any custom attributes you may have More...
 
override void AutomaticShakerSetup ()
 Automatically tries to add a MMSoundManager to the scene if none are present More...
 

Public Attributes

override bool HasRandomness => true
 sets the inspector color for this feedback More...
 
AudioClip Sfx
 the sound clip to play More...
 
AudioClip[] RandomSfx
 an array to pick a random sfx from More...
 
MMF_Button TestPlayButton
 a test button used to play the sound in inspector More...
 
MMF_Button TestStopButton
 a test button used to stop the sound in inspector More...
 
PlayMethods PlayMethod = PlayMethods.Event
 the play method to use when playing the sound (event, cached or on demand) More...
 
int PoolSize = 10
 the size of the pool when in Pool mode More...
 
bool UseLegacyEventsMode = false
 in event mode, whether to use legacy events (MMSfxEvent) or the current events (MMSoundManagerSoundPlayEvent) More...
 
bool StopSoundOnFeedbackStop = true
 if this is true, calling Stop on this feedback will also stop the sound from playing further More...
 
float MinVolume = 1f
 the minimum volume to play the sound at More...
 
float MaxVolume = 1f
 the maximum volume to play the sound at More...
 
float MinPitch = 1f
 the minimum pitch to play the sound at More...
 
float MaxPitch = 1f
 the maximum pitch to play the sound at More...
 
AudioMixerGroup SfxAudioMixerGroup
 the audiomixer to play the sound with (optional) More...
 
int Priority = 128
 the audiosource priority More...
 
float PanStereo
 Pans a playing sound in a stereo way (left or right). This only applies to sounds that are Mono or Stereo. More...
 
float SpatialBlend
 Sets how much this AudioSource is affected by 3D spatialisation calculations (attenuation, doppler etc). 0.0 makes the sound full 2D, 1.0 makes it full 3D. More...
 
float DopplerLevel = 1f
 Sets the Doppler scale for this AudioSource. More...
 
int Spread = 0
 Sets the spread angle (in degrees) of a 3d stereo or multichannel sound in speaker space. More...
 
AudioRolloffMode RolloffMode = AudioRolloffMode.Logarithmic
 Sets/Gets how the AudioSource attenuates over distance. More...
 
float MinDistance = 1f
 Within the Min distance the AudioSource will cease to grow louder in volume. More...
 
float MaxDistance = 500f
 (Logarithmic rolloff) MaxDistance is the distance a sound stops attenuating at. More...
 
bool UseCustomRolloffCurve = false
 whether or not to use a custom curve for custom volume rolloff More...
 
AnimationCurve CustomRolloffCurve
 the curve to use for custom volume rolloff if UseCustomRolloffCurve is true More...
 
bool UseSpatialBlendCurve = false
 whether or not to use a custom curve for spatial blend More...
 
AnimationCurve SpatialBlendCurve
 the curve to use for custom spatial blend if UseSpatialBlendCurve is true More...
 
bool UseReverbZoneMixCurve = false
 whether or not to use a custom curve for reverb zone mix More...
 
AnimationCurve ReverbZoneMixCurve
 the curve to use for custom reverb zone mix if UseReverbZoneMixCurve is true More...
 
bool UseSpreadCurve = false
 whether or not to use a custom curve for spread More...
 
AnimationCurve SpreadCurve
 the curve to use for custom spread if UseSpreadCurve is true More...
 

Static Public Attributes

static bool FeedbackTypeAuthorized = true
 a static bool used to disable all feedbacks of this type at once More...
 

Protected Member Functions

override void CustomInitialization (MMF_Player owner)
 Custom init to cache the audiosource if required More...
 
virtual AudioSource CreateAudioSource (GameObject owner, string audioSourceName)
 
override void CustomPlayFeedback (Vector3 position, float feedbacksIntensity=1.0f)
 Plays either a random sound or the specified sfx More...
 
virtual float GetDuration ()
 
virtual void PlaySound (AudioClip sfx, Vector3 position, float intensity)
 Plays a sound differently based on the selected play method More...
 
override void CustomStopFeedback (Vector3 position, float feedbacksIntensity=1)
 On Stop, we stop our sound if needed More...
 
virtual void PlayAudioSource (AudioSource audioSource, AudioClip sfx, float volume, float pitch, int timeSamples, AudioMixerGroup audioMixerGroup=null, int priority=128)
 Plays the audio source with the specified volume and pitch More...
 
virtual AudioSource GetAudioSourceFromPool ()
 Gets an audio source from the pool if possible More...
 
virtual async void TestPlaySound ()
 A test method that creates an audiosource, plays it, and destroys itself after play More...
 
virtual void TestStopSound ()
 A test method that stops the test sound More...
 

Protected Attributes

AudioClip _randomClip
 
AudioSource _cachedAudioSource
 
AudioSource[] _pool
 
AudioSource _tempAudioSource
 
float _duration
 
AudioSource _editorAudioSource
 
AudioSource _audioSource
 
AudioClip _lastPlayedClip
 

Properties

override float FeedbackDuration [get]
 the duration of this feedback is the duration of the clip being played More...
 

Member Enumeration Documentation

◆ PlayMethods

The possible methods to play the sound with. Event : sends a MMSfxEvent, you'll need a class to catch this event and play the sound Cached : creates and stores an audiosource to play the sound with, parented to the owner OnDemand : creates an audiosource and destroys it everytime you want to play the sound

Enumerator
Event 
Cached 
OnDemand 
Pool 

Member Function Documentation

◆ AutomaticShakerSetup()

override void MoreMountains.Feedbacks.MMF_Sound.AutomaticShakerSetup ( )
virtual

Automatically tries to add a MMSoundManager to the scene if none are present

Reimplemented from MoreMountains.Feedbacks.MMF_Feedback.

◆ CreateAudioSource()

virtual AudioSource MoreMountains.Feedbacks.MMF_Sound.CreateAudioSource ( GameObject  owner,
string  audioSourceName 
)
protectedvirtual

◆ CustomInitialization()

override void MoreMountains.Feedbacks.MMF_Sound.CustomInitialization ( MMF_Player  owner)
protectedvirtual

Custom init to cache the audiosource if required

Parameters
owner

Reimplemented from MoreMountains.Feedbacks.MMF_Feedback.

◆ CustomPlayFeedback()

override void MoreMountains.Feedbacks.MMF_Sound.CustomPlayFeedback ( Vector3  position,
float  feedbacksIntensity = 1.0f 
)
protectedvirtual

Plays either a random sound or the specified sfx

Parameters
position
feedbacksIntensity

Implements MoreMountains.Feedbacks.MMF_Feedback.

◆ CustomStopFeedback()

override void MoreMountains.Feedbacks.MMF_Sound.CustomStopFeedback ( Vector3  position,
float  feedbacksIntensity = 1 
)
protectedvirtual

On Stop, we stop our sound if needed

Parameters
position
feedbacksIntensity

Reimplemented from MoreMountains.Feedbacks.MMF_Feedback.

◆ GetAudioSourceFromPool()

virtual AudioSource MoreMountains.Feedbacks.MMF_Sound.GetAudioSourceFromPool ( )
protectedvirtual

Gets an audio source from the pool if possible

Returns

◆ GetDuration()

virtual float MoreMountains.Feedbacks.MMF_Sound.GetDuration ( )
protectedvirtual

◆ InitializeCustomAttributes()

override void MoreMountains.Feedbacks.MMF_Sound.InitializeCustomAttributes ( )
virtual

Use this method to initialize any custom attributes you may have

Reimplemented from MoreMountains.Feedbacks.MMF_Feedback.

◆ PlayAudioSource()

virtual void MoreMountains.Feedbacks.MMF_Sound.PlayAudioSource ( AudioSource  audioSource,
AudioClip  sfx,
float  volume,
float  pitch,
int  timeSamples,
AudioMixerGroup  audioMixerGroup = null,
int  priority = 128 
)
protectedvirtual

Plays the audio source with the specified volume and pitch

Parameters
audioSource
sfx
volume
pitch

◆ PlaySound()

virtual void MoreMountains.Feedbacks.MMF_Sound.PlaySound ( AudioClip  sfx,
Vector3  position,
float  intensity 
)
protectedvirtual

Plays a sound differently based on the selected play method

Parameters
sfx
position

◆ TestPlaySound()

virtual async void MoreMountains.Feedbacks.MMF_Sound.TestPlaySound ( )
protectedvirtual

A test method that creates an audiosource, plays it, and destroys itself after play

◆ TestStopSound()

virtual void MoreMountains.Feedbacks.MMF_Sound.TestStopSound ( )
protectedvirtual

A test method that stops the test sound

Member Data Documentation

◆ _audioSource

AudioSource MoreMountains.Feedbacks.MMF_Sound._audioSource
protected

◆ _cachedAudioSource

AudioSource MoreMountains.Feedbacks.MMF_Sound._cachedAudioSource
protected

◆ _duration

float MoreMountains.Feedbacks.MMF_Sound._duration
protected

◆ _editorAudioSource

AudioSource MoreMountains.Feedbacks.MMF_Sound._editorAudioSource
protected

◆ _lastPlayedClip

AudioClip MoreMountains.Feedbacks.MMF_Sound._lastPlayedClip
protected

◆ _pool

AudioSource [] MoreMountains.Feedbacks.MMF_Sound._pool
protected

◆ _randomClip

AudioClip MoreMountains.Feedbacks.MMF_Sound._randomClip
protected

◆ _tempAudioSource

AudioSource MoreMountains.Feedbacks.MMF_Sound._tempAudioSource
protected

◆ CustomRolloffCurve

AnimationCurve MoreMountains.Feedbacks.MMF_Sound.CustomRolloffCurve

the curve to use for custom volume rolloff if UseCustomRolloffCurve is true

◆ DopplerLevel

float MoreMountains.Feedbacks.MMF_Sound.DopplerLevel = 1f

Sets the Doppler scale for this AudioSource.

◆ FeedbackTypeAuthorized

bool MoreMountains.Feedbacks.MMF_Sound.FeedbackTypeAuthorized = true
static

a static bool used to disable all feedbacks of this type at once

◆ HasRandomness

override bool MoreMountains.Feedbacks.MMF_Sound.HasRandomness => true

sets the inspector color for this feedback

◆ MaxDistance

float MoreMountains.Feedbacks.MMF_Sound.MaxDistance = 500f

(Logarithmic rolloff) MaxDistance is the distance a sound stops attenuating at.

◆ MaxPitch

float MoreMountains.Feedbacks.MMF_Sound.MaxPitch = 1f

the maximum pitch to play the sound at

◆ MaxVolume

float MoreMountains.Feedbacks.MMF_Sound.MaxVolume = 1f

the maximum volume to play the sound at

◆ MinDistance

float MoreMountains.Feedbacks.MMF_Sound.MinDistance = 1f

Within the Min distance the AudioSource will cease to grow louder in volume.

◆ MinPitch

float MoreMountains.Feedbacks.MMF_Sound.MinPitch = 1f

the minimum pitch to play the sound at

◆ MinVolume

float MoreMountains.Feedbacks.MMF_Sound.MinVolume = 1f

the minimum volume to play the sound at

◆ PanStereo

float MoreMountains.Feedbacks.MMF_Sound.PanStereo

Pans a playing sound in a stereo way (left or right). This only applies to sounds that are Mono or Stereo.

◆ PlayMethod

PlayMethods MoreMountains.Feedbacks.MMF_Sound.PlayMethod = PlayMethods.Event

the play method to use when playing the sound (event, cached or on demand)

◆ PoolSize

int MoreMountains.Feedbacks.MMF_Sound.PoolSize = 10

the size of the pool when in Pool mode

◆ Priority

int MoreMountains.Feedbacks.MMF_Sound.Priority = 128

the audiosource priority

◆ RandomSfx

AudioClip [] MoreMountains.Feedbacks.MMF_Sound.RandomSfx

an array to pick a random sfx from

◆ ReverbZoneMixCurve

AnimationCurve MoreMountains.Feedbacks.MMF_Sound.ReverbZoneMixCurve

the curve to use for custom reverb zone mix if UseReverbZoneMixCurve is true

◆ RolloffMode

AudioRolloffMode MoreMountains.Feedbacks.MMF_Sound.RolloffMode = AudioRolloffMode.Logarithmic

Sets/Gets how the AudioSource attenuates over distance.

◆ Sfx

AudioClip MoreMountains.Feedbacks.MMF_Sound.Sfx

the sound clip to play

◆ SfxAudioMixerGroup

AudioMixerGroup MoreMountains.Feedbacks.MMF_Sound.SfxAudioMixerGroup

the audiomixer to play the sound with (optional)

◆ SpatialBlend

float MoreMountains.Feedbacks.MMF_Sound.SpatialBlend

Sets how much this AudioSource is affected by 3D spatialisation calculations (attenuation, doppler etc). 0.0 makes the sound full 2D, 1.0 makes it full 3D.

◆ SpatialBlendCurve

AnimationCurve MoreMountains.Feedbacks.MMF_Sound.SpatialBlendCurve

the curve to use for custom spatial blend if UseSpatialBlendCurve is true

◆ Spread

int MoreMountains.Feedbacks.MMF_Sound.Spread = 0

Sets the spread angle (in degrees) of a 3d stereo or multichannel sound in speaker space.

◆ SpreadCurve

AnimationCurve MoreMountains.Feedbacks.MMF_Sound.SpreadCurve

the curve to use for custom spread if UseSpreadCurve is true

◆ StopSoundOnFeedbackStop

bool MoreMountains.Feedbacks.MMF_Sound.StopSoundOnFeedbackStop = true

if this is true, calling Stop on this feedback will also stop the sound from playing further

◆ TestPlayButton

MMF_Button MoreMountains.Feedbacks.MMF_Sound.TestPlayButton

a test button used to play the sound in inspector

◆ TestStopButton

MMF_Button MoreMountains.Feedbacks.MMF_Sound.TestStopButton

a test button used to stop the sound in inspector

◆ UseCustomRolloffCurve

bool MoreMountains.Feedbacks.MMF_Sound.UseCustomRolloffCurve = false

whether or not to use a custom curve for custom volume rolloff

◆ UseLegacyEventsMode

bool MoreMountains.Feedbacks.MMF_Sound.UseLegacyEventsMode = false

in event mode, whether to use legacy events (MMSfxEvent) or the current events (MMSoundManagerSoundPlayEvent)

◆ UseReverbZoneMixCurve

bool MoreMountains.Feedbacks.MMF_Sound.UseReverbZoneMixCurve = false

whether or not to use a custom curve for reverb zone mix

◆ UseSpatialBlendCurve

bool MoreMountains.Feedbacks.MMF_Sound.UseSpatialBlendCurve = false

whether or not to use a custom curve for spatial blend

◆ UseSpreadCurve

bool MoreMountains.Feedbacks.MMF_Sound.UseSpreadCurve = false

whether or not to use a custom curve for spread

Property Documentation

◆ FeedbackDuration

override float MoreMountains.Feedbacks.MMF_Sound.FeedbackDuration
get

the duration of this feedback is the duration of the clip being played


The documentation for this class was generated from the following file: