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

Method SetBGMVolume

LuaSTGPlus/LuaWrapper.cpp:1632–1649  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1630 return 0;
1631 }
1632 static int SetBGMVolume(lua_State* L)LNOEXCEPT
1633 {
1634 if (lua_gettop(L) == 1)
1635 {
1636 float x = static_cast<float>(luaL_checknumber(L, 1));
1637 LRES.SetGlobalMusicVolume(max(min(x, 1.f), 0.f));
1638 }
1639 else
1640 {
1641 const char* s = luaL_checkstring(L, 1);
1642 float x = static_cast<float>(luaL_checknumber(L, 2));
1643 ResMusic* p = LRES.FindMusic(s);
1644 if (!p)
1645 return luaL_error(L, "music '%s' not found.", s);
1646 p->SetVolume(x * LRES.GetGlobalMusicVolume());
1647 }
1648 return 0;
1649 }
1650
1651 // 输入控制函数
1652 static int GetKeyState(lua_State* L)LNOEXCEPT

Callers

nothing calls this directly

Calls 4

SetGlobalMusicVolumeMethod · 0.80
FindMusicMethod · 0.80
SetVolumeMethod · 0.80
GetGlobalMusicVolumeMethod · 0.80

Tested by

no test coverage detected