Trying to spatialize the remote talker voice (AudioComponent)
I'm trying to spatialize players' voice by attaching their voice to their character.
I succeeded in doing this with the Null subsystem with the following code:
i.e. I take all the active sounds, I search for those associated with an AudioComponent and, only on these, I set some boolean properties (is not UI sound, allow spatialization).
In my blueprint I call this function and, for each AudioComponent, I attach it to the relative player.
Before of attaching it I apply to the AudioComponent the following Attenuation Settings.
It works very well with the Null subsystem. Sounds are spatialized and attenuated relatively to the players' positions. But neither spatialization nor attenuation work when changing the subsystem with the Oculus' one (I correctly retrieve the AudioComponent, but it seems it ignore my Attenuation Settings).
Is there something else I need to do in order to let it work with Oculus?
I succeeded in doing this with the Null subsystem with the following code:
TArray<UAudioComponent*> USessionVoiceManager::GetAudioComponents() {
TArray<UAudioComponent*> audioComponents = TArray<UAudioComponent*>();
TArray<FActiveSound*> activeSounds = MyGameInstance->GetEngine()->GetMainAudioDevice()->GetActiveSounds();
for (int i = 0; i < activeSounds.Num(); i++) {
FActiveSound* activeSound = activeSounds;
UAudioComponent *audioComponent = UAudioComponent::GetAudioComponentFromID(activeSound->GetAudioComponentID());
if (audioComponent != nullptr) {
activeSound->bAlwaysPlay = true;
activeSound->bIsUISound = false;
activeSound->bAllowSpatialization = true;
audioComponents.Add(audioComponent);
}
}
return audioComponents;
}i.e. I take all the active sounds, I search for those associated with an AudioComponent and, only on these, I set some boolean properties (is not UI sound, allow spatialization).
In my blueprint I call this function and, for each AudioComponent, I attach it to the relative player.
Before of attaching it I apply to the AudioComponent the following Attenuation Settings.
It works very well with the Null subsystem. Sounds are spatialized and attenuated relatively to the players' positions. But neither spatialization nor attenuation work when changing the subsystem with the Oculus' one (I correctly retrieve the AudioComponent, but it seems it ignore my Attenuation Settings).
Is there something else I need to do in order to let it work with Oculus?
