Feel 5.9.1
The best way to improve your game's feel and make it extra juicy
Loading...
Searching...
No Matches
MoreMountains.Feedbacks.MMF_Sound Class Reference
Inheritance diagram for MoreMountains.Feedbacks.MMF_Sound:
MoreMountains.Feedbacks.MMF_Feedback

Public Types

enum  PlayMethods { Event , Cached , OnDemand , 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.
override void AutomaticShakerSetup ()
 Automatically tries to add a MMSoundManager to the scene if none are present.

Public Attributes

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

Static Public Attributes

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

Protected Member Functions

override void CustomInitialization (MMF_Player owner)
 Custom init to cache the audiosource if required.
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.
virtual float GetDuration ()
virtual void PlaySound (AudioClip sfx, Vector3 position, float intensity)
 Plays a sound differently based on the selected play method.
override void CustomStopFeedback (Vector3 position, float feedbacksIntensity=1)
 On Stop, we stop our sound if needed.
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.
virtual AudioSource GetAudioSourceFromPool ()
 Gets an audio source from the pool if possible.
virtual async void TestPlaySound ()
 A test method that creates an audiosource, plays it, and destroys itself after play.
virtual void TestStopSound ()
 A test method that stops the test sound.

Protected Attributes

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

Properties

override bool HasRandomness [get]
 sets the inspector color for this feedback
override float FeedbackDuration [get]
 the duration of this feedback is the duration of the clip being played

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 )
protected

Plays either a random sound or the specified sfx.

Parameters
position
feedbacksIntensity

◆ 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

◆ 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

◆ HasRandomness

override bool MoreMountains.Feedbacks.MMF_Sound.HasRandomness
get

sets the inspector color for this feedback


The documentation for this class was generated from the following file:
  • H:/Code/MoreMountains/feel/Assets/Feel/MMFeedbacks/MMFeedbacksForThirdParty/MMTools/Feedbacks/MMF_Sound.cs