Community Q&A

Where Wwise users help each other out!

Audiokinetic's Community Q&A is the forum where Wwise users ask and answer questions within the Wwise community. Contact Sales if your project requires a support plan.

I fixed a bug in Wwise UE4 plugin. Can I submit the fix so you can merge it?

0 votes
I fixed a bug where AkAudioDevice was registering non-local PlayerCameraManagers as default listeners causing multiple issues for listen server players when one or more clients are connected.

I was wondering if there is a public repository to submit a pull request or something so you can merge it in your codebase.

Thank you
asked 3 days ago in General Discussion by Franco P. (100 points)

1 Answer

0 votes

Hello, this issue was fixed in 2017.1.3 version of the plugin that came out last week.

WG-35104 Fixed: Do not create a listener on a dedicated server.

https://www.audiokinetic.com/library/edge/?source=UE4&id=whatsnew.html

answered 3 days ago by Fabien B. (Audiokinetic) (8,900 points)
That fix is not correct as it only solves the problem with dedicated servers but the problem persists with listen servers.

Instead of checking AsPlayerCameraManager->GetWorld()->AllowAudioPlayback() to decide wether you setup a listener or not for that player camera manager, you should check if the player camera manager owning controller is a local controller or not.

void FAkAudioDevice::OnActorSpawned(AActor* SpawnedActor)
{
    APlayerCameraManager* AsPlayerCameraManager = Cast<APlayerCameraManager>(SpawnedActor);
    if (AsPlayerCameraManager)
    {
        APlayerController* CameraOwner = Cast<APlayerController>(AsPlayerCameraManager->GetOwner());
        if (CameraOwner && CameraOwner->IsLocalPlayerController())
        {
            UAkComponent* pAkComponent = NewObject<UAkComponent>(SpawnedActor);
            if (pAkComponent != nullptr)
            {
                pAkComponent->RegisterComponentWithWorld(SpawnedActor->GetWorld());
                pAkComponent->AttachToComponent(SpawnedActor->GetRootComponent(), FAttachmentTransformRules::KeepWorldTransform, FName());
                AddDefaultListener(pAkComponent);
            }
        }           
    }
}

The actor owner for PlayerCameraManager will always be the owning controller, so you can cast it safely.

This way everything will work as expected. Dedicated servers won't have any listeners. Listen servers will have listeners only for its local players and clients will have listeners only for its local players.
Hey, thanks for the suggestion, I am reopening the issue so that our dev can look at this fix !
I'm happy to help!
...