Documentation for the Unity C# Library
Loading...
Searching...
No Matches
PixoVR.Audio.AudioService Class Reference

Main logic for playing fxs and voice overs. More...

Inheritance diagram for PixoVR.Audio.AudioService:
[legend]

Public Member Functions

void CleanOnceTimeVO ()
 
VoiceOverInfo GetOverOverData (string voiceOverName)
 Get voice over data Info by name If VO data is missing from the data, it will return an error.
 
void InitCurrentVoiceOverdata (VoiceOverData voData)
 Init current voiceover data.
 
bool IsPlaying (string fxName)
 If the clip is missing from the data, it will return an error.
 
void MuteRepeatableSound ()
 Mute repeatable sound volume.
 
void PauseRepeatable ()
 Pause currently playing repeatable voice over and save its state Stop currently playing repeatable and saving the moment at which the music ended without notifying of the step manager.
 
int PlayFX (string fxName)
 Play FX by fx name.
 
void PlayFX (string fxName, bool loop)
 Play FX by fx name If the clip is missing from the data, it will return an error.
 
void PlayFX (string fxName, float volume, bool loop)
 Play FX by fx name If the clip is missing from the data, it will return an error.
 
void PlayLastRepeatable ()
 Play last played repeatable voice over from the moment it stopped.
 
void PlayOnceTime (AudioClip clip, string voiceOverName)
 Play once time audio clip.
 
void PlayOnceTime (string voiceOverName)
 Play once time by voice over name.
 
void PlayOnlyOneFX (string fxName)
 Play fx by name and stop the others that are playing.
 
void PlayRepeatable (AudioClip clip, string voiceOverName)
 Play repeatable voice over.
 
void PlayRepeatable (string voiceOverName)
 Play voice repeating it at a certain time intervals.
 
int PlaySpatiallyFX (string fxName, float volume, bool loop, Transform sourceTransform)
 Play 3d FX by fx name If the clip is missing from the data, it will return an error.
 
void PlayVoice (AudioClip clip)
 Play voice over audio clip.
 
void PlayVoice (string voiceOver)
 Play voice over by id If the clip is missing from the data, it will return an error.
 
void SetRepeatableSoundVolume (float volume)
 Set repeatable sound volume.
 
void SetSfxPitch (int audioID, float pitch)
 Set sfx pitch by audio id.
 
void SetSfxVolume (int audioID, float volume)
 Set fx volume by audio id.
 
void SetSfxVolume (string name, float volume)
 Set sfx volume If the clip is missing from the data, it will return an warning.
 
void StopAllFx ()
 Stop all fxs.
 
void StopAllVoiceOvers ()
 Stop all voice overs.
 
void StopFx (string fxName)
 Stop fx by name If the clip is missing from the data, it will return an error.
 
void StopFxById (int fxId)
 Stop fx by id If the clip is missing from the data, it will return an warning.
 
void StopOnceTimeTemporarily ()
 Stop currently playing voice over.
 
void StopPlaying ()
 Stop all fxs.
 
void StopRepeatable ()
 Stop currently playing repeatable voice over and remove its state Used for hard manual stop without notifying of the step manager.
 
void StopRepeatableTemporarily ()
 Temporarily stop currently playing repeatable voice over Stop currently playing repeatable and saving the moment at which the music ended with notifying of the step manager.
 
void UpdateLastRepeatable (string voiceOverName)
 Update last repeatable Used to restore the last played audio.
 

Properties

RepeatableAudio LastPlayedRepeatableAudio [get, private set]
 
RepeatableAudio PlayOnceAudio [get, private set]
 

Events

Action< string > OnceTimeAudioStopped
 
Action RepeatableAudioStopped
 

Private Member Functions

void ConfigureAudioSource (Hellmade.Sound.Audio audio, SpatialSoundSettings spatialSoundSettings)
 
SpatialSoundSettings GetSpatialSoundSettings (VoiceOverInfo voiceOverInfo)
 
void OnAudioStopped (Hellmade.Sound.Audio audio)
 
void OnDestroy ()
 
int PlayMusicWithParams (AudioClip clip)
 
IEnumerator PlayRepeatableCoroutine ()
 
void Start ()
 

Private Attributes

bool _isSoundMuted = false
 
Hellmade.Sound.Audio _lastStartedVO
 
Coroutine _playRepeatableCoroutine
 
SpatialSoundSettings defaultSpatialSoundSettings
 [SerializeField]
 
VoiceOverData soundsFx
 [SerializeField]
 
VoiceOverData voices
 [SerializeField]
 

Static Private Attributes

const float _mutedVolume = 0.001f
 
const float _soundRepeatDelay = 30
 

Detailed Description

Main logic for playing fxs and voice overs.

Definition at line 11 of file AudioService.cs.

Member Function Documentation

◆ CleanOnceTimeVO()

void PixoVR.Audio.AudioService.CleanOnceTimeVO ( )
inline

Definition at line 576 of file AudioService.cs.

Here is the caller graph for this function:

◆ ConfigureAudioSource()

void PixoVR.Audio.AudioService.ConfigureAudioSource ( Hellmade::Sound::Audio audio,
SpatialSoundSettings spatialSoundSettings )
inlineprivate

Definition at line 183 of file AudioService.cs.

Here is the caller graph for this function:

◆ GetOverOverData()

VoiceOverInfo PixoVR.Audio.AudioService.GetOverOverData ( string voiceOverName)
inline

Get voice over data Info by name If VO data is missing from the data, it will return an error.

Parameters
voiceOverNameid to search for a clip in the VO data
Returns

Definition at line 65 of file AudioService.cs.

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

◆ GetSpatialSoundSettings()

SpatialSoundSettings PixoVR.Audio.AudioService.GetSpatialSoundSettings ( VoiceOverInfo voiceOverInfo)
inlineprivate

Definition at line 191 of file AudioService.cs.

Here is the caller graph for this function:

◆ InitCurrentVoiceOverdata()

void PixoVR.Audio.AudioService.InitCurrentVoiceOverdata ( VoiceOverData voData)
inline

Init current voiceover data.

Parameters
voData

Definition at line 54 of file AudioService.cs.

Here is the caller graph for this function:

◆ IsPlaying()

bool PixoVR.Audio.AudioService.IsPlaying ( string fxName)
inline

If the clip is missing from the data, it will return an error.

Parameters
fxNameid to search for a clip in the VO data
Returns

Definition at line 82 of file AudioService.cs.

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

◆ MuteRepeatableSound()

void PixoVR.Audio.AudioService.MuteRepeatableSound ( )
inline

Mute repeatable sound volume.

Definition at line 627 of file AudioService.cs.

Here is the caller graph for this function:

◆ OnAudioStopped()

void PixoVR.Audio.AudioService.OnAudioStopped ( Hellmade::Sound::Audio audio)
inlineprivate

Definition at line 462 of file AudioService.cs.

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

◆ OnDestroy()

void PixoVR.Audio.AudioService.OnDestroy ( )
inlineprivate

Definition at line 45 of file AudioService.cs.

Here is the call graph for this function:

◆ PauseRepeatable()

void PixoVR.Audio.AudioService.PauseRepeatable ( )
inline

Pause currently playing repeatable voice over and save its state Stop currently playing repeatable and saving the moment at which the music ended without notifying of the step manager.

Definition at line 525 of file AudioService.cs.

Here is the caller graph for this function:

◆ PlayFX() [1/3]

int PixoVR.Audio.AudioService.PlayFX ( string fxName)
inline

Play FX by fx name.

Parameters
fxNameid to search for a clip in the VO data
Returns
Will return -1 if no clip is found in VO data

Definition at line 101 of file AudioService.cs.

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

◆ PlayFX() [2/3]

void PixoVR.Audio.AudioService.PlayFX ( string fxName,
bool loop )
inline

Play FX by fx name If the clip is missing from the data, it will return an error.

Parameters
fxNameid to search for a clip in the VO data
loop

Definition at line 120 of file AudioService.cs.

Here is the call graph for this function:

◆ PlayFX() [3/3]

void PixoVR.Audio.AudioService.PlayFX ( string fxName,
float volume,
bool loop )
inline

Play FX by fx name If the clip is missing from the data, it will return an error.

Parameters
fxNameid to search for a clip in the VO data
volume
loop

Definition at line 140 of file AudioService.cs.

Here is the call graph for this function:

◆ PlayLastRepeatable()

void PixoVR.Audio.AudioService.PlayLastRepeatable ( )
inline

Play last played repeatable voice over from the moment it stopped.

Definition at line 490 of file AudioService.cs.

◆ PlayMusicWithParams()

int PixoVR.Audio.AudioService.PlayMusicWithParams ( AudioClip clip)
inlineprivate

Definition at line 661 of file AudioService.cs.

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

◆ PlayOnceTime() [1/2]

void PixoVR.Audio.AudioService.PlayOnceTime ( AudioClip clip,
string voiceOverName )
inline

Play once time audio clip.

Parameters
clip
voiceOverNameid to search for a clip in the VO data

Definition at line 440 of file AudioService.cs.

Here is the call graph for this function:

◆ PlayOnceTime() [2/2]

void PixoVR.Audio.AudioService.PlayOnceTime ( string voiceOverName)
inline

Play once time by voice over name.

Parameters
voiceOverNameid to search for a clip in the VO data

Definition at line 383 of file AudioService.cs.

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

◆ PlayOnlyOneFX()

void PixoVR.Audio.AudioService.PlayOnlyOneFX ( string fxName)
inline

Play fx by name and stop the others that are playing.

Parameters
fxNameid to search for a clip in the VO data

Definition at line 306 of file AudioService.cs.

Here is the call graph for this function:

◆ PlayRepeatable() [1/2]

void PixoVR.Audio.AudioService.PlayRepeatable ( AudioClip clip,
string voiceOverName )
inline

Play repeatable voice over.

Parameters
clip
voiceOverNameid to search for a clip in the VO data

Definition at line 415 of file AudioService.cs.

Here is the call graph for this function:

◆ PlayRepeatable() [2/2]

void PixoVR.Audio.AudioService.PlayRepeatable ( string voiceOverName)
inline

Play voice repeating it at a certain time intervals.

Parameters
voiceOverNameid to search for a clip in the VO data

Definition at line 363 of file AudioService.cs.

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

◆ PlayRepeatableCoroutine()

IEnumerator PixoVR.Audio.AudioService.PlayRepeatableCoroutine ( )
inlineprivate

Definition at line 634 of file AudioService.cs.

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

◆ PlaySpatiallyFX()

int PixoVR.Audio.AudioService.PlaySpatiallyFX ( string fxName,
float volume,
bool loop,
Transform sourceTransform )
inline

Play 3d FX by fx name If the clip is missing from the data, it will return an error.

Parameters
fxNameid to search for a clip in the VO data
volume
loop

Definition at line 161 of file AudioService.cs.

Here is the call graph for this function:

◆ PlayVoice() [1/2]

void PixoVR.Audio.AudioService.PlayVoice ( AudioClip clip)
inline

Play voice over audio clip.

Parameters
clip

Definition at line 352 of file AudioService.cs.

Here is the call graph for this function:

◆ PlayVoice() [2/2]

void PixoVR.Audio.AudioService.PlayVoice ( string voiceOver)
inline

Play voice over by id If the clip is missing from the data, it will return an error.

Parameters
voiceOverid to search for a clip in the VO data

Definition at line 334 of file AudioService.cs.

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

◆ SetRepeatableSoundVolume()

void PixoVR.Audio.AudioService.SetRepeatableSoundVolume ( float volume)
inline

Set repeatable sound volume.

Parameters
volume

Definition at line 609 of file AudioService.cs.

Here is the caller graph for this function:

◆ SetSfxPitch()

void PixoVR.Audio.AudioService.SetSfxPitch ( int audioID,
float pitch )
inline

Set sfx pitch by audio id.

Parameters
audioID
pitch

Definition at line 251 of file AudioService.cs.

Here is the call graph for this function:

◆ SetSfxVolume() [1/2]

void PixoVR.Audio.AudioService.SetSfxVolume ( int audioID,
float volume )
inline

Set fx volume by audio id.

Parameters
audioID
volume

Definition at line 220 of file AudioService.cs.

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

◆ SetSfxVolume() [2/2]

void PixoVR.Audio.AudioService.SetSfxVolume ( string name,
float volume )
inline

Set sfx volume If the clip is missing from the data, it will return an warning.

Parameters
nameid to search for a clip in the VO data
volume

Definition at line 231 of file AudioService.cs.

Here is the call graph for this function:

◆ Start()

void PixoVR.Audio.AudioService.Start ( )
inlineprivate

Definition at line 40 of file AudioService.cs.

Here is the call graph for this function:

◆ StopAllFx()

void PixoVR.Audio.AudioService.StopAllFx ( )
inline

Stop all fxs.

Definition at line 599 of file AudioService.cs.

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

◆ StopAllVoiceOvers()

void PixoVR.Audio.AudioService.StopAllVoiceOvers ( )
inline

Stop all voice overs.

Definition at line 590 of file AudioService.cs.

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

◆ StopFx()

void PixoVR.Audio.AudioService.StopFx ( string fxName)
inline

Stop fx by name If the clip is missing from the data, it will return an error.

Parameters
fxNameid to search for a clip in the VO data

Definition at line 265 of file AudioService.cs.

Here is the call graph for this function:

◆ StopFxById()

void PixoVR.Audio.AudioService.StopFxById ( int fxId)
inline

Stop fx by id If the clip is missing from the data, it will return an warning.

Parameters
fxIdid to search for a clip in the VO data

Definition at line 288 of file AudioService.cs.

Here is the call graph for this function:

◆ StopOnceTimeTemporarily()

void PixoVR.Audio.AudioService.StopOnceTimeTemporarily ( )
inline

Stop currently playing voice over.

Definition at line 564 of file AudioService.cs.

Here is the caller graph for this function:

◆ StopPlaying()

void PixoVR.Audio.AudioService.StopPlaying ( )
inline

Stop all fxs.

Definition at line 324 of file AudioService.cs.

Here is the call graph for this function:

◆ StopRepeatable()

void PixoVR.Audio.AudioService.StopRepeatable ( )
inline

Stop currently playing repeatable voice over and remove its state Used for hard manual stop without notifying of the step manager.

Definition at line 506 of file AudioService.cs.

Here is the caller graph for this function:

◆ StopRepeatableTemporarily()

void PixoVR.Audio.AudioService.StopRepeatableTemporarily ( )
inline

Temporarily stop currently playing repeatable voice over Stop currently playing repeatable and saving the moment at which the music ended with notifying of the step manager.

Definition at line 543 of file AudioService.cs.

◆ UpdateLastRepeatable()

void PixoVR.Audio.AudioService.UpdateLastRepeatable ( string voiceOverName)
inline

Update last repeatable Used to restore the last played audio.

Parameters
voiceOverNameid to search for a clip in the VO data

Definition at line 395 of file AudioService.cs.

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

Member Data Documentation

◆ _isSoundMuted

bool PixoVR.Audio.AudioService._isSoundMuted = false
private

Definition at line 31 of file AudioService.cs.

◆ _lastStartedVO

Hellmade.Sound.Audio PixoVR.Audio.AudioService._lastStartedVO
private

Definition at line 38 of file AudioService.cs.

◆ _mutedVolume

const float PixoVR.Audio.AudioService._mutedVolume = 0.001f
staticprivate

Definition at line 30 of file AudioService.cs.

◆ _playRepeatableCoroutine

Coroutine PixoVR.Audio.AudioService._playRepeatableCoroutine
private

Definition at line 33 of file AudioService.cs.

◆ _soundRepeatDelay

const float PixoVR.Audio.AudioService._soundRepeatDelay = 30
staticprivate

Definition at line 29 of file AudioService.cs.

◆ defaultSpatialSoundSettings

SpatialSoundSettings PixoVR.Audio.AudioService.defaultSpatialSoundSettings
privateSerializeField

[SerializeField]

Definition at line 24 of file AudioService.cs.

◆ soundsFx

VoiceOverData PixoVR.Audio.AudioService.soundsFx
privateSerializeField

[SerializeField]

Definition at line 20 of file AudioService.cs.

◆ voices

VoiceOverData PixoVR.Audio.AudioService.voices
privateSerializeField

[SerializeField]

Definition at line 16 of file AudioService.cs.

Property Documentation

◆ LastPlayedRepeatableAudio

RepeatableAudio PixoVR.Audio.AudioService.LastPlayedRepeatableAudio
getprivate set

Definition at line 26 of file AudioService.cs.

◆ PlayOnceAudio

RepeatableAudio PixoVR.Audio.AudioService.PlayOnceAudio
getprivate set

Definition at line 27 of file AudioService.cs.

Event Documentation

◆ OnceTimeAudioStopped

Action<string> PixoVR.Audio.AudioService.OnceTimeAudioStopped

Definition at line 36 of file AudioService.cs.

◆ RepeatableAudioStopped

Action PixoVR.Audio.AudioService.RepeatableAudioStopped

Definition at line 35 of file AudioService.cs.


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