Example #1
0
 /// <summary>
 /// Facilitates user settable/gettable AudioClip.loadState
 /// </summary>
 public static void SetAudioClipLoadState(AudioClip audioClip, AudioDataLoadState newLoadState)
 {
     if (audioClip != null)
     {
         audioClipToLoadState[audioClip] = newLoadState;
     }
 }
Example #2
0
        internal void Play(IntroloopAudio music, bool isFade)
        {
            if (music == null)
            {
                throw new IntroloopException("Played IntroloopAudio is null!");
            }

            pauseDspTimestamp = 0;
            pauseDspTotal     = 0;

            twoSources[0].pitch = music.Pitch;
            twoSources[1].pitch = music.Pitch;

            AudioDataLoadState loadState = music.audioClip.loadState;
            string             musicName = music.audioClip.name;

            FadeVolume = isFade ? 0 : 1;
            if (loadState != AudioDataLoadState.Loaded)
            {
                IntroloopLog("\"" + musicName + "\" not loaded yet. Loading into memory...");
                StartCoroutine(LoadAndPlayRoutine(music));
            }
            else
            {
                IntroloopLog("\"" + musicName + "\" already loaded in memory.");
                SetupPlayingSchedule(music);
            }
        }
Example #3
0
    private bool CheckIfAllStorySoundsLoaded()
    {
        if (_storySounds == null)
        {
            return(false);
        }
        bool alldone = true;

        for (int i = 0; i < _storySounds.Length; i++)
        {
            if (_storySounds[i] == null)
            {
                alldone = false;
                break;
            }
            AudioDataLoadState res = _storySounds[i].loadState;
            if (res != AudioDataLoadState.Loaded)
            {
                alldone  = false;
                msg.text = "waiting to load sound " + i.ToString();
                break;
            }
        }

        return(alldone);
    }
Example #4
0
    public bool CheckIfAllSoundsLoaded()
    {
        if (instructionClips == null)
        {
            return(false);
        }
        bool alldone = true;

        for (int i = 0; i < instructionClips.Length; i++)
        {
            if (instructionClips[i] == null)
            {
                //Debug.Log("clip " + i.ToString() + "is null");
                alldone = false;
                break;
            }
            AudioDataLoadState res = instructionClips[i].loadState;
            if (res != AudioDataLoadState.Loaded)
            {
                //Debug.Log("clip " + i.ToString() + "is not loaded");
                alldone = false;
                break;
            }
        }
        if (alldone)
        {
            Debug.Log("Load Instruction Sound time" + (Time.realtimeSinceStartup - soundST).ToString());
        }
        return(alldone);
    }
Example #5
0
    private bool CheckIfAllSoundsLoaded()
    {
        if (_memorySounds == null)
        {
            return(false);
        }
        bool alldone = true;

        for (int i = 0; i < _memorySounds.Length; i++)
        {
            if (_memorySounds[i] == null)
            {
                alldone = false;
                break;
            }
            AudioDataLoadState res = _memorySounds[i].loadState;
            if (res != AudioDataLoadState.Loaded)
            {
                alldone  = false;
                msg.text = "waiting to load sound " + i.ToString();
                break;
            }
        }
        //if (alldone)
        //   Debug.Log("LoadMemorySound time" + (Time.realtimeSinceStartup - soundST).ToString());
        return(alldone);
    }
Example #6
0
        public static AudioDataLoadState GetAudioClipLoadState(AudioClip audioClip)
        {
            AudioDataLoadState value = AudioDataLoadState.Failed;

            if (audioClip != null)
            {
                value = audioClip.loadState;
                audioLoadState.TryGetValue(audioClip, out value);
            }
            return(value);
        }
Example #7
0
        public static AudioDataLoadState GetAudioClipLoadState(AudioClip audioClip)
        {
            AudioDataLoadState result = AudioDataLoadState.Failed;

            if (audioClip != null)
            {
                result = audioClip.loadState;
                audioLoadState.TryGetValue(audioClip, out result);
            }
            return(result);
        }
Example #8
0
        public static AudioDataLoadState GetAudioClipLoadState(AudioClip audioClip)
        {
            AudioDataLoadState result = AudioDataLoadState.Failed;

            if ((UnityEngine.Object)audioClip != (UnityEngine.Object)null)
            {
                result = audioClip.loadState;
                Manager.audioLoadState.TryGetValue(audioClip, out result);
            }
            return(result);
        }
Example #9
0
        /// <summary>
        /// Facilitates user settable/gettable AudioClip.loadState
        /// </summary>
        /// <returns>AudioDataLoadState.Failed if audioClip is null or audioClip.loadState if this manager did not touch the audioClip</returns>
        public static AudioDataLoadState GetAudioClipLoadState(AudioClip audioClip)
        {
            AudioDataLoadState ret = AudioDataLoadState.Failed;

#if UNITY_4 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7
            // audioLoadState.TryGetValue(audioClip, out ret); // TODO: fix
#else
            if (audioClip != null)
            {
                ret = audioClip.loadState;
                audioClipToLoadState.TryGetValue(audioClip, out ret);
            }
#endif
            return(ret);
        }
    private static int get_loadState(IntPtr L)
    {
        object obj = null;
        int    result;

        try
        {
            obj = ToLua.ToObject(L, 1);
            AudioClip          audioClip = (AudioClip)obj;
            AudioDataLoadState loadState = audioClip.get_loadState();
            ToLua.Push(L, loadState);
            result = 1;
        }
        catch (Exception ex)
        {
            result = LuaDLL.toluaL_exception(L, ex, (obj != null) ? ex.get_Message() : "attempt to index loadState on a nil value");
        }
        return(result);
    }
Example #11
0
    internal void Play(IntroloopAudio music, bool isFade)
    {
        pauseDspTimestamp = 0;
        pauseDspTotal     = 0;

        AudioDataLoadState loadState = music.audioClip.loadState;
        string             musicName = music.audioClip.name;

        FadeVolume = isFade ? 0 : 1;
        if (loadState != AudioDataLoadState.Loaded)
        {
            IntroloopLogger.Log("\"" + musicName + "\" not loaded yet. Loading into memory...");
            StartCoroutine(LoadAndPlayRoutine(music));
        }
        else
        {
            IntroloopLogger.Log("\"" + musicName + "\" already loaded in memory.");
            SetupPlayingSchedule(music);
        }
    }
 public bool AreStoryResourcesReady()
 {
     if (StoryNextImage == null)
     {
         return(false);
     }
     else if (StoryNextMask == null)
     {
         return(false);
     }
     else if (StoryNextSound == null)
     {
         return(false);
     }
     else
     {
         AudioDataLoadState res = StoryNextSound.loadState;
         return(res == AudioDataLoadState.Loaded);
     }
 }
Example #13
0
 public static void SetAudioClipLoadState(AudioClip audioClip, AudioDataLoadState newLoadState)
 {
     audioLoadState[audioClip] = newLoadState;
 }