Download

How to spatialize a Procedural and Generated wave sound with UE >4.21?

Until UE 4.19.2 I was able to spatialize the user’s voice chat: when entering the multiplayer level I took the player’s voice (an AudioComponent), deactivate it, set spatialization/attenuation features and re-activate it. The deactivation/activation trick was necessary because the attenuation/spatialization settings are initialized once and are not applied if I set them while the audio is playing.

With UE 4.21 a block of code has been added (actually with UE 4.20, but it has been modified in UE 4.21) in the class FAudioDevice, inside of the method AddNewActiveSound(FActiveSound&):


USoundWave* SoundWave = Cast<USoundWave>(Sound);
if (SoundWave && SoundWave->bProcedural && SoundWave->IsGenerating())
{
FString SoundWaveName;
SoundWave->GetName(SoundWaveName);
UE_LOG(LogAudio, Warning, TEXT("Replaying a procedural sound '%s' without stopping the previous instance. Only one sound instance per procedural sound wave is supported."), *SoundWaveName)
return;
}


This block prevents the sound from being played “again”, but, actually, if the audio has been stopped it can’t be resumed because it is always “generating”, so that check always succeeds and the following code is not executed. Is this a bug or am I missing something?

I’m running into this as well. For some reason my on level travel the voiptalker for the host pawn on my client machine is hitting this block of code when arriving at the destination level. This makes the voip permanently cut out for the client. As far as I can tell this is some race condition that is very unlikely triggering it because whenever I make a simpler project I cannot reproduce it outside of in my main game project.