public void Play(float delay, BaseAudioFileObject file, bool loop = false)
        {
            // Make sure no remnants from a previous sound remain
            StopAllCoroutines();
            aSource.Stop();
            enabled = true; // Enable updates on the script
            if (file.playReversed)
            {
                aSource.time = aSource.clip.length - 0.01f;
            }
            aSource.PlayDelayed(delay);
            audioFile                     = file;
            looping                       = loop;
            aSource.pitch                 = GetRandomPitch();
            aSource.bypassEffects         = file.bypassEffects;
            aSource.bypassListenerEffects = file.bypassListenerEffects;
            aSource.bypassReverbZones     = file.bypassReverbZones;
            switch (file.fadeMode)
            {
            case FadeMode.FadeIn:
            case FadeMode.FadeInAndOut:
                StartCoroutine(FadeIn(file.fadeMode == FadeMode.FadeInAndOut));
                break;

            case FadeMode.FadeOut:
                StartCoroutine(FadeOut());
                break;
            }
            ApplyVolumeChanges();
            ApplyEffects();
        }
 public void Play(float delay)
 {
     StopAllCoroutines();
     aSource.Stop();
     aSource.PlayDelayed(delay);
     audioFile                     = null;
     looping                       = false;
     aSource.pitch                 = GetRandomPitch();
     aSource.bypassEffects         = false;
     aSource.bypassListenerEffects = false;
     aSource.bypassReverbZones     = false;
     ClearEffects();
 }
 public void Play(AudioFileMusicObject file)
 {
     // Make sure no remnants from a previous sound remain
     StopAllCoroutines();
     if (file.playReversed)
     {
         aSource.time = aSource.clip.length - 0.01f;
     }
     aSource.Play();
     audioFile                     = file;
     looping                       = false;
     aSource.pitch                 = GetRandomPitch();
     aSource.bypassEffects         = file.bypassEffects;
     aSource.bypassListenerEffects = file.bypassListenerEffects;
     aSource.bypassReverbZones     = file.bypassReverbZones;
     ApplyEffects();
     ApplyVolumeChanges();
 }
        public void PlayDebug(BaseAudioFileObject file, bool dontReset)
        {
            if (!dontReset)
            {
                aSource.Stop();
            }
            if (file.playReversed)
            {
                aSource.time = aSource.clip.length - AudioManager.EPSILON;
            }
            else
            {
                aSource.timeSamples = (int)Mathf.Clamp((float)aSource.timeSamples, 0, (float)aSource.clip.samples - 1);
            }

            audioFile = file;
            aSource.Play();
            aSource.pitch                 = GetRandomPitch();
            aSource.bypassEffects         = file.bypassEffects;
            aSource.bypassListenerEffects = file.bypassListenerEffects;
            aSource.bypassReverbZones     = file.bypassReverbZones;
            ApplyVolumeChanges();
            ApplyEffects();
        }
 public void SetAudioFile(BaseAudioFileObject file)
 {
     audioFile = file;
 }