GetAudioClipCompressed() public method

Returns an AudioClip generated from the downloaded data that is compressed in memory (Read Only).

public GetAudioClipCompressed ( ) : AudioClip
return AudioClip
コード例 #1
0
        static int _m_GetAudioClipCompressed(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            UnityEngine.WWW __cl_gen_to_be_invoked = (UnityEngine.WWW)translator.FastGetCSObj(L, 1);


            int __gen_param_count = LuaAPI.lua_gettop(L);

            try {
                if (__gen_param_count == 1)
                {
                    UnityEngine.AudioClip __cl_gen_ret = __cl_gen_to_be_invoked.GetAudioClipCompressed(  );
                    translator.Push(L, __cl_gen_ret);



                    return(1);
                }
                if (__gen_param_count == 2 && LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 2))
                {
                    bool threeD = LuaAPI.lua_toboolean(L, 2);

                    UnityEngine.AudioClip __cl_gen_ret = __cl_gen_to_be_invoked.GetAudioClipCompressed(threeD);
                    translator.Push(L, __cl_gen_ret);



                    return(1);
                }
                if (__gen_param_count == 3 && LuaTypes.LUA_TBOOLEAN == LuaAPI.lua_type(L, 2) && translator.Assignable <UnityEngine.AudioType>(L, 3))
                {
                    bool threeD = LuaAPI.lua_toboolean(L, 2);
                    UnityEngine.AudioType audioType; translator.Get(L, 3, out audioType);

                    UnityEngine.AudioClip __cl_gen_ret = __cl_gen_to_be_invoked.GetAudioClipCompressed(threeD, audioType);
                    translator.Push(L, __cl_gen_ret);



                    return(1);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.WWW.GetAudioClipCompressed!"));
        }
コード例 #2
0
 static public int GetAudioClipCompressed(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 1)
         {
             UnityEngine.WWW self = (UnityEngine.WWW)checkSelf(l);
             var             ret  = self.GetAudioClipCompressed();
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (argc == 2)
         {
             UnityEngine.WWW self = (UnityEngine.WWW)checkSelf(l);
             System.Boolean  a1;
             checkType(l, 2, out a1);
             var ret = self.GetAudioClipCompressed(a1);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (argc == 3)
         {
             UnityEngine.WWW self = (UnityEngine.WWW)checkSelf(l);
             System.Boolean  a1;
             checkType(l, 2, out a1);
             UnityEngine.AudioType a2;
             a2 = (UnityEngine.AudioType)LuaDLL.luaL_checkinteger(l, 3);
             var ret = self.GetAudioClipCompressed(a1, a2);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function GetAudioClipCompressed to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
コード例 #3
0
    static int GetAudioClipCompressed(IntPtr L)
    {
#if UNITY_EDITOR
        ToluaProfiler.AddCallRecord("UnityEngine.WWW.Register");
#endif
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1)
            {
                UnityEngine.WWW       obj = (UnityEngine.WWW)ToLua.CheckObject <UnityEngine.WWW>(L, 1);
                UnityEngine.AudioClip o   = obj.GetAudioClipCompressed();
                ToLua.PushSealed(L, o);
                return(1);
            }
            else if (count == 2)
            {
                UnityEngine.WWW       obj  = (UnityEngine.WWW)ToLua.CheckObject <UnityEngine.WWW>(L, 1);
                bool                  arg0 = LuaDLL.luaL_checkboolean(L, 2);
                UnityEngine.AudioClip o    = obj.GetAudioClipCompressed(arg0);
                ToLua.PushSealed(L, o);
                return(1);
            }
            else if (count == 3)
            {
                UnityEngine.WWW       obj  = (UnityEngine.WWW)ToLua.CheckObject <UnityEngine.WWW>(L, 1);
                bool                  arg0 = LuaDLL.luaL_checkboolean(L, 2);
                UnityEngine.AudioType arg1 = (UnityEngine.AudioType)ToLua.CheckObject(L, 3, typeof(UnityEngine.AudioType));
                UnityEngine.AudioClip o    = obj.GetAudioClipCompressed(arg0, arg1);
                ToLua.PushSealed(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.WWW.GetAudioClipCompressed"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #4
0
ファイル: Lua_UnityEngine_WWW.cs プロジェクト: liqt/uLui
 static public int GetAudioClipCompressed(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 1)
         {
             UnityEngine.WWW self = (UnityEngine.WWW)checkSelf(l);
             var             ret  = self.GetAudioClipCompressed();
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (argc == 2)
         {
             UnityEngine.WWW self = (UnityEngine.WWW)checkSelf(l);
             System.Boolean  a1;
             checkType(l, 2, out a1);
             var ret = self.GetAudioClipCompressed(a1);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (argc == 3)
         {
             UnityEngine.WWW self = (UnityEngine.WWW)checkSelf(l);
             System.Boolean  a1;
             checkType(l, 2, out a1);
             UnityEngine.AudioType a2;
             checkEnum(l, 3, out a2);
             var ret = self.GetAudioClipCompressed(a1, a2);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #5
0
    static int GetAudioClipCompressed(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.WWW)))
            {
                UnityEngine.WWW       obj = (UnityEngine.WWW)ToLua.ToObject(L, 1);
                UnityEngine.AudioClip o   = obj.GetAudioClipCompressed();
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.WWW), typeof(bool)))
            {
                UnityEngine.WWW       obj  = (UnityEngine.WWW)ToLua.ToObject(L, 1);
                bool                  arg0 = LuaDLL.lua_toboolean(L, 2);
                UnityEngine.AudioClip o    = obj.GetAudioClipCompressed(arg0);
                ToLua.Push(L, o);
                return(1);
            }
            else if (count == 3 && TypeChecker.CheckTypes(L, 1, typeof(UnityEngine.WWW), typeof(bool), typeof(UnityEngine.AudioType)))
            {
                UnityEngine.WWW       obj  = (UnityEngine.WWW)ToLua.ToObject(L, 1);
                bool                  arg0 = LuaDLL.lua_toboolean(L, 2);
                UnityEngine.AudioType arg1 = (UnityEngine.AudioType)ToLua.ToObject(L, 3);
                UnityEngine.AudioClip o    = obj.GetAudioClipCompressed(arg0, arg1);
                ToLua.Push(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.WWW.GetAudioClipCompressed"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #6
0
    static int GetAudioClipCompressed(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 1)
            {
                UnityEngine.WWW       obj = (UnityEngine.WWW)ToLua.CheckObject <UnityEngine.WWW>(L, 1);
                UnityEngine.AudioClip o   = obj.GetAudioClipCompressed();
                ToLua.PushSealed(L, o);
                return(1);
            }
            else if (count == 2)
            {
                UnityEngine.WWW       obj  = (UnityEngine.WWW)ToLua.CheckObject <UnityEngine.WWW>(L, 1);
                bool                  arg0 = LuaDLL.luaL_checkboolean(L, 2);
                UnityEngine.AudioClip o    = obj.GetAudioClipCompressed(arg0);
                ToLua.PushSealed(L, o);
                return(1);
            }
            else if (count == 3)
            {
                UnityEngine.WWW       obj  = (UnityEngine.WWW)ToLua.CheckObject <UnityEngine.WWW>(L, 1);
                bool                  arg0 = LuaDLL.luaL_checkboolean(L, 2);
                UnityEngine.AudioType arg1 = (UnityEngine.AudioType)LuaDLL.luaL_checknumber(L, 3);
                UnityEngine.AudioClip o    = obj.GetAudioClipCompressed(arg0, arg1);
                ToLua.PushSealed(L, o);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: UnityEngine.WWW.GetAudioClipCompressed"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
コード例 #7
0
 static int QPYX_GetAudioClipCompressed_YXQP(IntPtr L_YXQP)
 {
     try
     {
         int QPYX_count_YXQP = LuaDLL.lua_gettop(L_YXQP);
         if (QPYX_count_YXQP == 1)
         {
             UnityEngine.WWW       QPYX_obj_YXQP = (UnityEngine.WWW)ToLua.CheckObject <UnityEngine.WWW>(L_YXQP, 1);
             UnityEngine.AudioClip QPYX_o_YXQP   = QPYX_obj_YXQP.GetAudioClipCompressed();
             ToLua.PushSealed(L_YXQP, QPYX_o_YXQP);
             return(1);
         }
         else if (QPYX_count_YXQP == 2)
         {
             UnityEngine.WWW       QPYX_obj_YXQP  = (UnityEngine.WWW)ToLua.CheckObject <UnityEngine.WWW>(L_YXQP, 1);
             bool                  QPYX_arg0_YXQP = LuaDLL.luaL_checkboolean(L_YXQP, 2);
             UnityEngine.AudioClip QPYX_o_YXQP    = QPYX_obj_YXQP.GetAudioClipCompressed(QPYX_arg0_YXQP);
             ToLua.PushSealed(L_YXQP, QPYX_o_YXQP);
             return(1);
         }
         else if (QPYX_count_YXQP == 3)
         {
             UnityEngine.WWW       QPYX_obj_YXQP  = (UnityEngine.WWW)ToLua.CheckObject <UnityEngine.WWW>(L_YXQP, 1);
             bool                  QPYX_arg0_YXQP = LuaDLL.luaL_checkboolean(L_YXQP, 2);
             UnityEngine.AudioType QPYX_arg1_YXQP = (UnityEngine.AudioType)ToLua.CheckObject(L_YXQP, 3, typeof(UnityEngine.AudioType));
             UnityEngine.AudioClip QPYX_o_YXQP    = QPYX_obj_YXQP.GetAudioClipCompressed(QPYX_arg0_YXQP, QPYX_arg1_YXQP);
             ToLua.PushSealed(L_YXQP, QPYX_o_YXQP);
             return(1);
         }
         else
         {
             return(LuaDLL.luaL_throw(L_YXQP, "invalid arguments to method: UnityEngine.WWW.GetAudioClipCompressed"));
         }
     }
     catch (Exception e_YXQP)                {
         return(LuaDLL.toluaL_exception(L_YXQP, e_YXQP));
     }
 }
コード例 #8
0
 public static AudioClip GetAudioClipCompressed(this WWW www, bool threeD, AudioType audioType)
 {
     return(www.GetAudioClipCompressed(threeD, audioType));
 }
コード例 #9
0
 public static AudioClip GetAudioClipCompressed(this WWW www, bool threeD)
 {
     return(www.GetAudioClipCompressed(threeD));
 }
コード例 #10
0
 public static AudioClip GetAudioClipCompressed(this WWW www)
 {
     return(www.GetAudioClipCompressed());
 }
コード例 #11
0
 public static AudioClip GetAudioClipCompressed(this WWW www)
 {
     return(www.GetAudioClipCompressed(false, AudioType.UNKNOWN));
 }
コード例 #12
0
	IEnumerator soundHelper(searchResult sr,bool download)
	{
		//first check to make sure it wasnt already downloaded/cached
		if (!cacheSounds.ContainsKey (sr.id)) {
			Dictionary <string,string> headers = new Dictionary<string, string> ();
			headers.Add ("Authorization", "Bearer " + gv.accessToken);
			string wholeUrl = "https://www.freesound.org/apiv2/sounds/" + sr.id + "/download/";
			WWW www = new WWW (wholeUrl, null, headers);
			Debug.Log ("Loading " + www.url);
			//yield return www;

			while (!www.isDone) {
				progressTrack.text = "downloaded " + (www.progress * 100).ToString () + "%...";
				yield return null;
			}
			progressTrack.text = "";

			if (www.error == null)
				Debug.Log ("done");
			else
				Debug.Log (www.error);
			//AudioClip loadedClip = www.GetAudioClip(false,false,AudioType.WAV);
			playSource.clip = www.GetAudioClipCompressed (false, AudioType.WAV);
			playSource.clip.name = sr.name;//will change to name at some point
			cacheSounds.Add (sr.id, playSource.clip);

			//create a directory if there isnt one
			if (!System.IO.Directory.Exists (Application.persistentDataPath + "/Downloads"))//change to persistent?
				System.IO.Directory.CreateDirectory (Application.persistentDataPath + "/Downloads");//change to persistent

			string fullPath = Application.persistentDataPath + "/Downloads/" + playSource.clip.name + ".wav";//just testing, need to change to persistent
			File.WriteAllBytes (fullPath, www.bytes);

			//delete when navigated away from this page
			if (!download) {
				playSource.Play ();
				deleteList.Add (playSource.clip.name);
			} else {
				gv.gameObject.GetComponent<soundBank> ().addedSounds.Add (playSource.clip.name + ".wav");
			}




		}
		//sound has been cached
		else {
			AudioClip tempClip;
			cacheSounds.TryGetValue (sr.name, out tempClip);
			playSource.clip = tempClip;
			playSource.Play ();
		}

		//maybe some sort of cache system, to avoid downloading again?
		//check to make sure it has not already been downloaded


	}