Beispiel #1
0
        static int play(int L)
        {
            if (!LuaCommon.CheckAndShowArgsError(L, LConst.UserData, LConst.Integer, LConst.NFuction))
            {
                return(0);
            }

            var callbackId    = Lua.LuaL_ref(L, Lua._LUA_REGISTRYINDEX);
            var objectParam   = Lua.Lua_touserdata(L, 2);
            int numberOfLoops = Lua.Lua_tointeger(L, 3);

            var info = Lua.Lua_touserdata(L, 2) as RYTAudioInfo;

            if (info != null)
            {
                Action playCompletedAction = () =>
                {
                    if (callbackId != -1)
                    {
                        LuaManager.GetLuaManager(L).ExecuteCallBackFunction(callbackId, info.LoopCurrentTimes == 0 ? true : false);
                    }
                };

                RYTAudio.Play(string.Empty, info, numberOfLoops, playCompletedAction);
            }

            return(0);
        }
Beispiel #2
0
        static int dispose(int L)
        {
            if (!LuaCommon.CheckAndShowArgsError(L, LConst.UserData))
            {
                return(0);
            }

            var info = Lua.Lua_touserdata(L, 2) as RYTAudioInfo;

            RYTAudio.Dispose(info);
            return(0);
        }
Beispiel #3
0
        static int load(int L)
        {
            if (!LuaCommon.CheckAndShowArgsError(L, LConst.String))
            {
                return(0);
            }

            var uri = Lua.Lua_tostring(L, -1);

            if (!string.IsNullOrEmpty(uri))
            {
                object page = LuaManager.GetLuaManager(L).DetailV_;
                var    info = RYTAudio.Load(uri, string.Empty, page, null);
                Lua.Lua_pushlightuserdata(L, info);
                return(1);
            }
            Lua.Lua_pushnil(L);
            return(0);
        }
Beispiel #4
0
 static int pause(int L)
 {
     RYTAudio.Pause();
     return(0);
 }
Beispiel #5
0
 static int resume(int L)
 {
     RYTAudio.Resume();
     return(0);
 }
Beispiel #6
0
 static int stop(int L)
 {
     RYTAudio.Stop();
     return(0);
 }