Exemple #1
0
        public void PlayFromSrc(AudioCue cue, AudioSource src)
        {
            if (src == null)
            {
                Play(cue);
            }

            cue.PlayClipToSource(src);
        }
        public void PlayAudio(AudioCue cue, AudioPlayType type, int priority)   //played from generic sources on cam
        {
            var item = CreateNewVoiceItemFromCue(cue, type, priority);

            item.source = GetAudioSourceForTrack(cue.GetTrack());       //equivalent for source-supplied sounds is to find mixer group and assign source to it

            AttemptAddSoundToList(item);
            ReviewSoundList();
        }
        //public void StopSoundtrack()
        //{
        //    soundtrackSource.Stop();
        //}
        #endregion

        #region NEW play audio generic method with different overloads
        public void PlayAudio(AudioCue cue, AudioPlayType type, int priority, AudioSource source)   //played from the supplied source
        {
            var item = CreateNewVoiceItemFromCue(cue, type, priority);

            item.source = source;

            AttemptAddSoundToList(item);
            ReviewSoundList();
        }
        private VoiceItem CreateNewVoiceItemFromCue(AudioCue cue, AudioPlayType type, int priority)
        {
            priority = Mathf.Clamp(priority, highestPriority, lowestPriority);

            var newClip = cue.SelectClip();

            VoiceItem item = new VoiceItem
            {
                clip      = newClip,
                track     = cue.GetTrack(),
                source    = null,   //to be assigned
                loop      = IsLooping(type),
                length    = newClip.length,
                timeEnds  = Time.time + newClip.length,
                priority  = priority,
                isPlaying = false,
                isGarbage = false
            };

            return(item);
        }
Exemple #5
0
 public void Play(AudioCue cue)
 {
     cue.PlayOneShotToSource(m_channels[cue.GetTrack()].audioSource);
 }
Exemple #6
0
 public AudioRequest(AudioCue cue, AudioSource src)
 {
     m_cue = cue;
     m_src = src;
 }
 public void PlayFromSrc(AudioCue cue, AudioSource src)
 {
     m_audioAsset.PlayFromSrc(cue, src);
 }
 public void Play(AudioCue cue)
 {
     m_audioAsset.Play(cue);
 }