private ResourceType GetResourceType(AudioType audioType) { switch (audioType) { case AudioType.MUSIC: return(ResourceType.MUSIC); case AudioType.VO: return(ResourceType.AUDIO); case AudioType.SFX: return(ResourceType.SFX); case AudioType.AMBIENCE: return(ResourceType.AMBIENCE_MUSIC); } return(ResourceType.MUSIC); }
private void PreviewSound(float volume, AudioType audioType) { if (Pair == null && m_uiEngine.ActiveModule != InputModule.STANDALONE) { return; } if (Pair != null && m_uiEngine.ActiveModule != InputModule.OCULUS) { return; } var audioSource = m_audio.GetAudioSource(audioType); if (audioSource.isPlaying) { audioSource.volume = volume; return; } var sampleSounds = m_commonResource.GetResource(GetResourceType(audioType), SampleSound); if (sampleSounds == null || sampleSounds.Length == 0) { return; } AudioClip sampleClip = ((AudioResource)sampleSounds[0]).Clip; AudioArgs args = new AudioArgs(sampleClip, audioType) { FadeTime = 0 }; m_audio.Play(args); if (audioType == AudioType.SFX) { audioSource.loop = true; } m_playingSampleType = audioType; }