1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2024-12-24 13:45:47 +00:00

Positional audio fixup.

- Finetuned default distance by aspect ratio
- Added a hack to allow entity_sound() to use freq values around 1000 instead of changing all related scripts
- Changed anglerfish bite pitch, 40% only sounds awkward
This commit is contained in:
fgenesis 2011-12-13 18:07:23 +01:00
parent ac2091fb69
commit 99e32e0ee7
4 changed files with 15 additions and 9 deletions

View file

@ -6054,10 +6054,7 @@ void Avatar::splash(bool down)
if (down)
{
int freq = 1000;
if (rolling)
freq = 900;
sound("splash-into", freq);
sound("splash-into", rolling ? 0.9f : 1.0f);
//dsq->postProcessingFx.disable(FXT_RADIALBLUR);
if (_isUnderWater && core->afterEffectManager)
core->afterEffectManager->addEffect(new ShockEffect(Vector(core->width/2, core->height/2),core->screenCenter,0.08,0.05,22,0.2f, 1.2));

View file

@ -2186,10 +2186,13 @@ PlaySfx DSQ::calcPositionalSfx(const Vector &position, float maxdist)
{
Vector diff = position - dsq->game->avatar->position;
// TODO: this might be cooler if finetuned for different aspect ratios.
// This value is suitable enough for widescreen in default zoom, at least -- FG
// Aspect-ratio-adjustment:
// Just multiplying the cut-off distance with aspect increases it too much on widescreen,
// so only a part of it is aspect-corrected to make it sound better.
// Aspect is most likely >= 5/4 here, which results in a higher value than
// the default of 1024; this is intended. -- FG
if (maxdist <= 0)
maxdist = 1024;
maxdist = 724 + (300 * aspect);
float dist = diff.getLength2D();
if (dist < maxdist)

View file

@ -1421,7 +1421,13 @@ luaFunc(entity_sound)
Entity *e = entity(L);
if (e && !dsq->isSkippingCutscene())
{
e->sound(lua_tostring(L, 2), lua_tonumber(L, 3), lua_tonumber(L, 4));
float freq = lua_tonumber(L, 3);
// HACK: most old scripts still use a freq value of ~1000 as normal pitch.
// Pitch values this high produce a barely audible click only,
// so a cheap hack like this fixes it without changing older scripts. -- FG
if (freq >= 100)
freq *= 0.001f;
e->sound(lua_tostring(L, 2), freq, lua_tonumber(L, 4));
}
luaReturnNum(0);
}

View file

@ -234,7 +234,7 @@ function animationKey(me, key)
]]--
elseif key == 3 then
entity_sound(me, "Bite", 400 + math.random(100))
entity_sound(me, "Bite", 700 + math.random(100))
entity_moveTowardsTarget(me, 1, 8000)
end
end