mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-25 13:31:37 +00:00
- removed the limiter flags again and addressed the underlying problem properly.
The real issue is that the number of unattenuated sounds was unchecked and the near limit never kicked in. To do this properly it is necessary to adjust the limit distance by the attenuation - zero attenuation must mean infinite distance and for high attenuations the distance must be lowered for limiting to work as intended. The limit for the Doom boss sounds was increased to 4 to compensate for this change. # Conflicts: # src/common/audio/sound/oalsound.cpp
This commit is contained in:
parent
2ebf38c9c9
commit
d4d187e27b
5 changed files with 14 additions and 13 deletions
|
@ -556,7 +556,6 @@ OpenALSoundRenderer::OpenALSoundRenderer()
|
|||
ALC.EXT_disconnect = !!alcIsExtensionPresent(Device, "ALC_EXT_disconnect");
|
||||
ALC.SOFT_HRTF = !!alcIsExtensionPresent(Device, "ALC_SOFT_HRTF");
|
||||
ALC.SOFT_pause_device = !!alcIsExtensionPresent(Device, "ALC_SOFT_pause_device");
|
||||
ALC.SOFT_output_limiter = !!alcIsExtensionPresent(Device, "ALC_SOFT_output_limiter");
|
||||
|
||||
const ALCchar *current = NULL;
|
||||
if(alcIsExtensionPresent(Device, "ALC_ENUMERATE_ALL_EXT"))
|
||||
|
@ -593,11 +592,6 @@ OpenALSoundRenderer::OpenALSoundRenderer()
|
|||
else
|
||||
attribs.Push(ALC_DONT_CARE_SOFT);
|
||||
}
|
||||
if (ALC.SOFT_output_limiter)
|
||||
{
|
||||
attribs.Push(ALC_OUTPUT_LIMITER_SOFT);
|
||||
attribs.Push(ALC_TRUE /* or ALC_FALSE or ALC_DONT_CARE_SOFT */);
|
||||
}
|
||||
// Other attribs..?
|
||||
attribs.Push(0);
|
||||
|
||||
|
|
|
@ -463,7 +463,7 @@ FSoundChan *SoundEngine::StartSound(int type, const void *source,
|
|||
}
|
||||
|
||||
// If this sound doesn't like playing near itself, don't play it if that's what would happen.
|
||||
if (near_limit > 0 && CheckSoundLimit(sfx, pos, near_limit, limit_range, type, source, channel))
|
||||
if (near_limit > 0 && CheckSoundLimit(sfx, pos, near_limit, limit_range, type, source, channel, attenuation))
|
||||
{
|
||||
chanflags |= CHANF_EVICTED;
|
||||
}
|
||||
|
@ -675,7 +675,7 @@ void SoundEngine::RestartChannel(FSoundChan *chan)
|
|||
|
||||
// If this sound doesn't like playing near itself, don't play it if
|
||||
// that's what would happen.
|
||||
if (chan->NearLimit > 0 && CheckSoundLimit(&S_sfx[chan->SoundID], pos, chan->NearLimit, chan->LimitRange, 0, NULL, 0))
|
||||
if (chan->NearLimit > 0 && CheckSoundLimit(&S_sfx[chan->SoundID], pos, chan->NearLimit, chan->LimitRange, 0, NULL, 0, chan->DistanceScale))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -816,7 +816,7 @@ bool SoundEngine::CheckSingular(int sound_id)
|
|||
//==========================================================================
|
||||
|
||||
bool SoundEngine::CheckSoundLimit(sfxinfo_t *sfx, const FVector3 &pos, int near_limit, float limit_range,
|
||||
int sourcetype, const void *actor, int channel)
|
||||
int sourcetype, const void *actor, int channel, float attenuation)
|
||||
{
|
||||
FSoundChan *chan;
|
||||
int count;
|
||||
|
@ -835,7 +835,9 @@ bool SoundEngine::CheckSoundLimit(sfxinfo_t *sfx, const FVector3 &pos, int near_
|
|||
}
|
||||
|
||||
CalcPosVel(chan, &chanorigin, NULL);
|
||||
if ((chanorigin - pos).LengthSquared() <= limit_range)
|
||||
// scale the limit distance with the attenuation. An attenuation of 0 means the limit distance is infinite and all sounds within the level are inside the limit.
|
||||
float attn = std::min(chan->DistanceScale, attenuation);
|
||||
if (attn <= 0 || (chanorigin - pos).LengthSquared() <= limit_range / attn)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
|
|
|
@ -234,7 +234,7 @@ private:
|
|||
bool CheckSingular(int sound_id);
|
||||
virtual TArray<uint8_t> ReadSound(int lumpnum) = 0;
|
||||
protected:
|
||||
virtual bool CheckSoundLimit(sfxinfo_t* sfx, const FVector3& pos, int near_limit, float limit_range, int sourcetype, const void* actor, int channel);
|
||||
virtual bool CheckSoundLimit(sfxinfo_t* sfx, const FVector3& pos, int near_limit, float limit_range, int sourcetype, const void* actor, int channel, float attenuation);
|
||||
virtual FSoundID ResolveSound(const void *ent, int srctype, FSoundID soundid, float &attenuation);
|
||||
|
||||
public:
|
||||
|
|
|
@ -95,10 +95,10 @@ class DoomSoundEngine : public SoundEngine
|
|||
S_sfx[ndx].UserData[0] = 0;
|
||||
return ndx;
|
||||
}
|
||||
bool CheckSoundLimit(sfxinfo_t* sfx, const FVector3& pos, int near_limit, float limit_range, int sourcetype, const void* actor, int channel) override
|
||||
bool CheckSoundLimit(sfxinfo_t* sfx, const FVector3& pos, int near_limit, float limit_range, int sourcetype, const void* actor, int channel, float attenuation) override
|
||||
{
|
||||
if (sourcetype != SOURCE_Actor) actor = nullptr; //ZDoom did this.
|
||||
return SoundEngine::CheckSoundLimit(sfx, pos, near_limit, limit_range, sourcetype, actor, channel);
|
||||
return SoundEngine::CheckSoundLimit(sfx, pos, near_limit, limit_range, sourcetype, actor, channel, attenuation);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -321,6 +321,9 @@ spider/attack dsshotgn
|
|||
spider/death dsspidth
|
||||
spider/walk dsmetal
|
||||
|
||||
$limit spider/sight 4
|
||||
$limit spider/death 4
|
||||
|
||||
// Arachnotron
|
||||
|
||||
baby/sight dsbspsit
|
||||
|
@ -341,6 +344,8 @@ cyber/pain dsdmpain
|
|||
cyber/death dscybdth
|
||||
cyber/hoof dshoof
|
||||
|
||||
$limit cyber/sight 4
|
||||
$limit cyber/death 4
|
||||
// Pain Elemental
|
||||
|
||||
pain/sight dspesit
|
||||
|
|
Loading…
Reference in a new issue