mirror of
https://github.com/AquariaOSE/Aquaria.git
synced 2025-10-17 03:49:28 +00:00
Implement stereo to mono mixing for proper L/R separation even for stereo samples.
This mixes only those sounds that are supposed to be played positional. All centered (default) sounds are played in stereo, as usual.
This commit is contained in:
parent
66802e1935
commit
cf6556b94d
5 changed files with 51 additions and 14 deletions
|
@ -2299,6 +2299,7 @@ void DSQ::playPositionalSfx(const std::string &name, const Vector &position, flo
|
|||
sfx.freq = f;
|
||||
sfx.name = name;
|
||||
sfx.relative = false;
|
||||
sfx.positional = true;
|
||||
sfx.x = position.x;
|
||||
sfx.y = position.y;
|
||||
|
||||
|
|
|
@ -2774,6 +2774,7 @@ luaFunc(entity_playSfx)
|
|||
float fadeOut = lua_tonumber(L, 6);
|
||||
sfx.maxdist = lua_tonumber(L, 7);
|
||||
sfx.relative = false;
|
||||
sfx.positional = true;
|
||||
|
||||
h = core->sound->playSfx(sfx);
|
||||
if (fadeOut != 0)
|
||||
|
@ -5944,8 +5945,12 @@ luaFunc(playSfx)
|
|||
if (sfx.vol <= 0)
|
||||
sfx.vol = 1;
|
||||
sfx.loops = lua_tointeger(L, 4);
|
||||
sfx.x = lua_tonumber(L, 5);
|
||||
sfx.y = lua_tonumber(L, 6);
|
||||
if(lua_isnumber(L, 6) && lua_isnumber(L, 7))
|
||||
{
|
||||
sfx.x = lua_tonumber(L, 5);
|
||||
sfx.y = lua_tonumber(L, 6);
|
||||
sfx.positional = true;
|
||||
}
|
||||
sfx.maxdist = lua_tonumber(L, 7);
|
||||
if(lua_isnoneornil(L, 8))
|
||||
sfx.relative = (sfx.x == 0 && sfx.y == 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue