Documentation for the Unity C# Library
Loading...
Searching...
No Matches
Hellmade.Sound.Audio Class Reference

The audio object. More...

Public Types

enum  AudioType { Music , Sound , UISound }
 Enum representing the type of audio. More...
 

Public Member Functions

 Audio (string name, AudioType audioType, AudioClip clip, bool loop, bool persist, float volume, float fadeInValue, float fadeOutValue, Transform sourceTransform)
 
void Pause ()
 Pause playing audio clip.
 
void Play ()
 Start playing audio clip from the beginning.
 
void Play (float volume)
 Start playing audio clip from the beggining.
 
void Resume ()
 Resume playing audio clip.
 
void Set3DDistances (float min, float max)
 Sets the Audio 3D distances.
 
void SetVolume (float volume)
 Sets the audio volume.
 
void SetVolume (float volume, float fadeSeconds)
 Sets the audio volume.
 
void SetVolume (float volume, float fadeSeconds, float startVolume)
 Sets the audio volume.
 
void Stop ()
 Stop playing audio clip.
 
void UnPause ()
 Resume playing audio clip.
 
void Update ()
 Update loop of the Audio. This is automatically called from the sound manager itself. Do not use this function anywhere else, as it may lead to unwanted behaviour.
 

Properties

bool Activated [get, private set]
 Whether the audio is created and updated at least once.
 
int AudioID [get, private set]
 The ID of the Audio.
 
AudioSource AudioSource [get, private set]
 The audio source that is responsible for this audio. Do not modify the audiosource directly as it could result to unpredictable behaviour. Use the Audio class instead.
 
AudioClip Clip [get, set]
 Audio clip to play/is playing.
 
float DopplerLevel [get, set]
 The doppler scale of the audio.
 
float FadeInSeconds [get, set]
 How many seconds it needs for the audio to fade in/ reach target volume (if higher than current)
 
float FadeOutSeconds [get, set]
 How many seconds it needs for the audio to fade out/ reach target volume (if lower than current)
 
bool IsPlaying [get, private set]
 Whether the audio is currently playing.
 
bool Loop [get, set]
 Whether the audio will be lopped.
 
float Max3DDistance [get, set]
 (Logarithmic rolloff) MaxDistance is the distance a sound stops attenuating at.
 
float Min3DDistance [get, set]
 Within the Min distance the audio will cease to grow louder in volume.
 
bool Mute [get, set]
 Whether the audio is muted.
 
string Name [get, private set]
 
bool Paused [get, private set]
 Whether the audio is paused.
 
bool Persist [get, set]
 Whether the audio persists in between scene changes.
 
float Pitch [get, set]
 The pitch of the audio.
 
bool Pooled [get, set]
 Whether the audio is currently pooled. Do not modify this value, it is specifically used by EazySoundManager.
 
int Priority [get, set]
 Sets the priority of the audio.
 
float ReverbZoneMix [get, set]
 The amount by which the signal from the AudioSource will be mixed into the global reverb associated with the Reverb Zones.
 
AudioRolloffMode RolloffMode [get, set]
 How the audio attenuates over distance.
 
Transform SourceTransform [get, set]
 The source transform of the audio.
 
float SpatialBlend [get, set]
 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 Spread [get, set]
 The spread angle (in degrees) of a 3d stereo or multichannel sound in speaker space.
 
float StereoPan [get, set]
 Pans a playing sound in a stereo way (left or right). This only applies to sounds that are Mono or Stereo.
 
bool Stopping [get, private set]
 Whether the audio is stopping.
 
AudioType Type [get, private set]
 The type of the Audio.
 
float Volume [get, private set]
 The volume of the audio. Use SetVolume to change it.
 

Private Member Functions

void CreateAudiosource ()
 Creates and initializes the audiosource component with the appropriate values.
 

Private Attributes

AudioClip clip
 
float dopplerLevel
 
float fadeInterpolater
 
float initTargetVolume
 
bool loop
 
float max3DDistance
 
float min3DDistance
 
bool mute
 
float onFadeStartVolume
 
float pitch
 
int priority
 
float reverbZoneMix
 
AudioRolloffMode rolloffMode
 
Transform sourceTransform
 
float spatialBlend
 
float spread
 
float stereoPan
 
float targetVolume
 
float tempFadeSeconds
 

Static Private Attributes

static int audioCounter = 0
 

Detailed Description

The audio object.

Definition at line 9 of file Audio.cs.

Member Enumeration Documentation

◆ AudioType

Enum representing the type of audio.

Enumerator
Music 
Sound 
UISound 

Definition at line 304 of file Audio.cs.

Constructor & Destructor Documentation

◆ Audio()

Hellmade.Sound.Audio.Audio ( string name,
AudioType audioType,
AudioClip clip,
bool loop,
bool persist,
float volume,
float fadeInValue,
float fadeOutValue,
Transform sourceTransform )
inline

Definition at line 334 of file Audio.cs.

Member Function Documentation

◆ CreateAudiosource()

void Hellmade.Sound.Audio.CreateAudiosource ( )
inlineprivate

Creates and initializes the audiosource component with the appropriate values.

Definition at line 385 of file Audio.cs.

Here is the caller graph for this function:

◆ Pause()

void Hellmade.Sound.Audio.Pause ( )
inline

Pause playing audio clip.

Definition at line 460 of file Audio.cs.

Here is the caller graph for this function:

◆ Play() [1/2]

void Hellmade.Sound.Audio.Play ( )
inline

Start playing audio clip from the beginning.

Definition at line 407 of file Audio.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Play() [2/2]

void Hellmade.Sound.Audio.Play ( float volume)
inline

Start playing audio clip from the beggining.

Parameters
volumeThe target volume

Definition at line 416 of file Audio.cs.

Here is the call graph for this function:

◆ Resume()

void Hellmade.Sound.Audio.Resume ( )
inline

Resume playing audio clip.

Definition at line 478 of file Audio.cs.

Here is the caller graph for this function:

◆ Set3DDistances()

void Hellmade.Sound.Audio.Set3DDistances ( float min,
float max )
inline

Sets the Audio 3D distances.

Parameters
minthe min distance
maxthe max distance

Definition at line 529 of file Audio.cs.

◆ SetVolume() [1/3]

void Hellmade.Sound.Audio.SetVolume ( float volume)
inline

Sets the audio volume.

Parameters
volumeThe target volume

Definition at line 488 of file Audio.cs.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetVolume() [2/3]

void Hellmade.Sound.Audio.SetVolume ( float volume,
float fadeSeconds )
inline

Sets the audio volume.

Parameters
volumeThe target volume
fadeSecondsHow many seconds it needs for the audio to fade in/out to reach target volume. If passed, it will override the Audio's fade in/out seconds, but only for this transition

Definition at line 505 of file Audio.cs.

Here is the call graph for this function:

◆ SetVolume() [3/3]

void Hellmade.Sound.Audio.SetVolume ( float volume,
float fadeSeconds,
float startVolume )
inline

Sets the audio volume.

Parameters
volumeThe target volume
fadeSecondsHow many seconds it needs for the audio to fade in/out to reach target volume. If passed, it will override the Audio's fade in/out seconds, but only for this transition
startVolumeImmediately set the volume to this value before beginning the fade. If not passed, the Audio will start fading from the current volume towards the target volume

Definition at line 516 of file Audio.cs.

◆ Stop()

void Hellmade.Sound.Audio.Stop ( )
inline

Stop playing audio clip.

Definition at line 448 of file Audio.cs.

Here is the caller graph for this function:

◆ UnPause()

void Hellmade.Sound.Audio.UnPause ( )
inline

Resume playing audio clip.

Definition at line 469 of file Audio.cs.

◆ Update()

void Hellmade.Sound.Audio.Update ( )
inline

Update loop of the Audio. This is automatically called from the sound manager itself. Do not use this function anywhere else, as it may lead to unwanted behaviour.

Definition at line 538 of file Audio.cs.

Here is the caller graph for this function:

Member Data Documentation

◆ audioCounter

int Hellmade.Sound.Audio.audioCounter = 0
staticprivate

Definition at line 311 of file Audio.cs.

◆ clip

AudioClip Hellmade.Sound.Audio.clip
private

Definition at line 313 of file Audio.cs.

◆ dopplerLevel

float Hellmade.Sound.Audio.dopplerLevel
private

Definition at line 321 of file Audio.cs.

◆ fadeInterpolater

float Hellmade.Sound.Audio.fadeInterpolater
private

Definition at line 330 of file Audio.cs.

◆ initTargetVolume

float Hellmade.Sound.Audio.initTargetVolume
private

Definition at line 328 of file Audio.cs.

◆ loop

bool Hellmade.Sound.Audio.loop
private

Definition at line 314 of file Audio.cs.

◆ max3DDistance

float Hellmade.Sound.Audio.max3DDistance
private

Definition at line 324 of file Audio.cs.

◆ min3DDistance

float Hellmade.Sound.Audio.min3DDistance
private

Definition at line 325 of file Audio.cs.

◆ mute

bool Hellmade.Sound.Audio.mute
private

Definition at line 315 of file Audio.cs.

◆ onFadeStartVolume

float Hellmade.Sound.Audio.onFadeStartVolume
private

Definition at line 331 of file Audio.cs.

◆ pitch

float Hellmade.Sound.Audio.pitch
private

Definition at line 317 of file Audio.cs.

◆ priority

int Hellmade.Sound.Audio.priority
private

Definition at line 316 of file Audio.cs.

◆ reverbZoneMix

float Hellmade.Sound.Audio.reverbZoneMix
private

Definition at line 320 of file Audio.cs.

◆ rolloffMode

AudioRolloffMode Hellmade.Sound.Audio.rolloffMode
private

Definition at line 323 of file Audio.cs.

◆ sourceTransform

Transform Hellmade.Sound.Audio.sourceTransform
private

Definition at line 332 of file Audio.cs.

◆ spatialBlend

float Hellmade.Sound.Audio.spatialBlend
private

Definition at line 319 of file Audio.cs.

◆ spread

float Hellmade.Sound.Audio.spread
private

Definition at line 322 of file Audio.cs.

◆ stereoPan

float Hellmade.Sound.Audio.stereoPan
private

Definition at line 318 of file Audio.cs.

◆ targetVolume

float Hellmade.Sound.Audio.targetVolume
private

Definition at line 327 of file Audio.cs.

◆ tempFadeSeconds

float Hellmade.Sound.Audio.tempFadeSeconds
private

Definition at line 329 of file Audio.cs.

Property Documentation

◆ Activated

bool Hellmade.Sound.Audio.Activated
getprivate set

Whether the audio is created and updated at least once.

Definition at line 41 of file Audio.cs.

◆ AudioID

int Hellmade.Sound.Audio.AudioID
getprivate set

The ID of the Audio.

Definition at line 16 of file Audio.cs.

◆ AudioSource

AudioSource Hellmade.Sound.Audio.AudioSource
getprivate set

The audio source that is responsible for this audio. Do not modify the audiosource directly as it could result to unpredictable behaviour. Use the Audio class instead.

Definition at line 56 of file Audio.cs.

◆ Clip

AudioClip Hellmade.Sound.Audio.Clip
getset

Audio clip to play/is playing.

Definition at line 80 of file Audio.cs.

◆ DopplerLevel

float Hellmade.Sound.Audio.DopplerLevel
getset

The doppler scale of the audio.

Definition at line 208 of file Audio.cs.

◆ FadeInSeconds

float Hellmade.Sound.Audio.FadeInSeconds
getset

How many seconds it needs for the audio to fade in/ reach target volume (if higher than current)

Definition at line 293 of file Audio.cs.

◆ FadeOutSeconds

float Hellmade.Sound.Audio.FadeOutSeconds
getset

How many seconds it needs for the audio to fade out/ reach target volume (if lower than current)

Definition at line 298 of file Audio.cs.

◆ IsPlaying

bool Hellmade.Sound.Audio.IsPlaying
getprivate set

Whether the audio is currently playing.

Definition at line 26 of file Audio.cs.

◆ Loop

bool Hellmade.Sound.Audio.Loop
getset

Whether the audio will be lopped.

Definition at line 96 of file Audio.cs.

◆ Max3DDistance

float Hellmade.Sound.Audio.Max3DDistance
getset

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

Definition at line 256 of file Audio.cs.

◆ Min3DDistance

float Hellmade.Sound.Audio.Min3DDistance
getset

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

Definition at line 272 of file Audio.cs.

◆ Mute

bool Hellmade.Sound.Audio.Mute
getset

Whether the audio is muted.

Definition at line 112 of file Audio.cs.

◆ Name

string Hellmade.Sound.Audio.Name
getprivate set

Definition at line 11 of file Audio.cs.

◆ Paused

bool Hellmade.Sound.Audio.Paused
getprivate set

Whether the audio is paused.

Definition at line 31 of file Audio.cs.

◆ Persist

bool Hellmade.Sound.Audio.Persist
getset

Whether the audio persists in between scene changes.

Definition at line 288 of file Audio.cs.

◆ Pitch

float Hellmade.Sound.Audio.Pitch
getset

The pitch of the audio.

Definition at line 144 of file Audio.cs.

◆ Pooled

bool Hellmade.Sound.Audio.Pooled
getset

Whether the audio is currently pooled. Do not modify this value, it is specifically used by EazySoundManager.

Definition at line 46 of file Audio.cs.

◆ Priority

int Hellmade.Sound.Audio.Priority
getset

Sets the priority of the audio.

Definition at line 128 of file Audio.cs.

◆ ReverbZoneMix

float Hellmade.Sound.Audio.ReverbZoneMix
getset

The amount by which the signal from the AudioSource will be mixed into the global reverb associated with the Reverb Zones.

Definition at line 192 of file Audio.cs.

◆ RolloffMode

AudioRolloffMode Hellmade.Sound.Audio.RolloffMode
getset

How the audio attenuates over distance.

Definition at line 240 of file Audio.cs.

◆ SourceTransform

Transform Hellmade.Sound.Audio.SourceTransform
getset

The source transform of the audio.

Definition at line 61 of file Audio.cs.

◆ SpatialBlend

float Hellmade.Sound.Audio.SpatialBlend
getset

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.

Definition at line 176 of file Audio.cs.

◆ Spread

float Hellmade.Sound.Audio.Spread
getset

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

Definition at line 224 of file Audio.cs.

◆ StereoPan

float Hellmade.Sound.Audio.StereoPan
getset

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

Definition at line 160 of file Audio.cs.

◆ Stopping

bool Hellmade.Sound.Audio.Stopping
getprivate set

Whether the audio is stopping.

Definition at line 36 of file Audio.cs.

◆ Type

AudioType Hellmade.Sound.Audio.Type
getprivate set

The type of the Audio.

Definition at line 21 of file Audio.cs.

◆ Volume

float Hellmade.Sound.Audio.Volume
getprivate set

The volume of the audio. Use SetVolume to change it.

Definition at line 51 of file Audio.cs.


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