UGameplayStatics::PlaySoundAttached never works if sound is less than 1 second in duration

Kory
Sun, 12 Apr 2015 03:49:54 +0000
Audio

I have some sounds and a sound cue available to a dev on a dropbox in case you want to test this yourself.

We have multiple sounds controlled by a crossfade by param node in a sound cue (see attached picture).

In UGameplayStatics::PlaySoundAttached function it calls FAudioDevice::CreateComponent which calls Sound->IsAudibleSimple. If duration of sound cue is less than 1.0 seconds then this function always returns false because GetMaxAudibleDistance() is always returning 1.0 and I still cannot find out where this is getting set for this SoundCue.

Anyhow, if I make one of sounds greater than 1 second thereby making SoundCue’s duration larger than one second then it will always work.

I think USoundBase::IsAudibleSimple function needs to be reworked because this sound should be audible. Also, we have attenuation settings in our sound cue but it does not even look there and passes NULL/nullptr, otherwise this may work.

I am testing with Play In Editor on UE4 4.7 (release branch from github).

Thanks so much,
Kory

17 posts - 1 participant