MCPcopy Create free account
hub / github.com/9chu/LuaSTGPlus / LoadMusic

Method LoadMusic

LuaSTGPlus/LuaWrapper.cpp:913–936  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

911 return 0;
912 }
913 static int LoadMusic(lua_State* L)LNOEXCEPT
914 {
915 const char* name = luaL_checkstring(L, 1);
916 const char* path = luaL_checkstring(L, 2);
917
918 ResourcePool* pActivedPool = LRES.GetActivedPool();
919 if (!pActivedPool)
920 return luaL_error(L, "can't load resource at this time.");
921
922 double loop_end = luaL_checknumber(L, 3);
923 double loop_duration = luaL_checknumber(L, 4);
924 double loop_start = max(0., loop_end - loop_duration);
925
926 if (!pActivedPool->LoadMusic(
927 name,
928 path,
929 loop_start,
930 loop_end
931 ))
932 {
933 return luaL_error(L, "load music failed (name=%s, path=%s, loop=%f~%f)", name, path, loop_start, loop_end);
934 }
935 return 0;
936 }
937 static int LoadFont(lua_State* L)LNOEXCEPT
938 {
939 bool bSucceed = false;

Callers

nothing calls this directly

Calls 1

GetActivedPoolMethod · 0.80

Tested by

no test coverage detected