public static void StopStream(AudioCase audioCase, float fadeTime = 0) { if (audioCase.type == AudioType.Sound) { instance.StopSound(audioCase.source, fadeTime); } else { instance.StopMusic(audioCase.source, fadeTime); } }
public static AudioCase PlaySmartSound(AudioClip clip, AudioType type = AudioType.Sound) { if (clip == null) { Debug.LogError("[AudioController]: Audio clip is null"); } AudioSource source = instance.GetAudioSource(); SetSourceDefaultSettings(source, type); AudioCase audioCase = new AudioCase(clip, source, type); audioCase.Play(); AddSound(source); return(audioCase); }
public static AudioCase PlaySmartMusic(AudioClip clip, float volumePercentage = 1.0f) { if (clip == null) { Debug.LogError("[AudioController]: Audio clip is null"); } AudioSource source = instance.GetAudioSource(); SetSourceDefaultSettings(source, AudioType.Music); source.volume *= volumePercentage; source.clip = clip; AudioCase audioCase = new AudioCase(clip, source, AudioType.Music); audioCase.Play(); AddMusic(source); return(audioCase); }