1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-14 17:15:21 +02:00

[CSM] Add support for positional audio. (#5516)

Fixes parts of #5389.
This commit is contained in:
red-001
2017-04-06 07:14:31 +01:00
committed by Loïc Blot
parent 6da828c471
commit 4ee6be856d
5 changed files with 51 additions and 23 deletions

View File

@@ -30,12 +30,7 @@ int ModApiSound::l_sound_play(lua_State *L)
read_soundspec(L, 1, spec);
bool looped = lua_toboolean(L, 2);
s32 handle;
if (Client *client = getClient(L))
handle = client->getSoundManager()->playSound(spec, looped);
// Main menu doesn't have access to client, use guiEngine
else
handle = getGuiEngine(L)->playSound(spec, looped);
s32 handle = getGuiEngine(L)->playSound(spec, looped);
lua_pushinteger(L, handle);
@@ -46,11 +41,7 @@ int ModApiSound::l_sound_stop(lua_State *L)
{
u32 handle = luaL_checkinteger(L, 1);
if (Client *client = getClient(L))
client->getSoundManager()->stopSound(handle);
// Main menu doesn't have access to client, use guiEngine
else
getGuiEngine(L)->stopSound(handle);
getGuiEngine(L)->stopSound(handle);
return 1;
}