Audiokinetic's Community Q&A is the forum where users can ask and answer questions within the Wwise and Strata communities. If you would like to get an answer from Audiokinetic's Technical support team, make sure you use the Support Tickets page.

UE 4 node question

+1 vote
Is there a node in UE4 or that is added in through wwise that checks if something has ended? For example sound A has ended play sound B

 

-Rob
asked Mar 24, 2015 in General Discussion by Robert M. (4,640 points)

1 Answer

0 votes
That would require us to implement latent actions in Blueprints. This is on our roadmap, but I can't provide a time estimate yet.
answered Mar 25, 2015 by Benoit S. (Audiokinetic) (16,020 points)
For now I would be happy with a C++ callback or a multicast delegate of some kind. Would this be possible in the near future?
It's already possible in the SoundEngine, with the method:
AkPlayingID FAkAudioDevice::PostEvent(
    UAkAudioEvent * in_pEvent,
    AActor * in_pActor,
    AkUInt32 in_uFlags /*= 0*/,
    AkCallbackFunc in_pfnCallback /*= NULL*/,
    void * in_pCookie /*= NULL*/,
    bool in_bStopWhenOwnerDestroyed /*= false*/
    )

For your callback function to be called, simply set the in_uFlags to AK_EndOfEvent, and supply your own callback function in the in_pfnCallback parameter. Details can be found in the SDK file include/AK/SoundEngine/Common/AkCallback.h
Right. Thats what I was trying to avoid though. IMO it should be supported as part of UAKComponent. Is that something we could get as part of the next integration? If not I can add this myself as you suggested.
Adding a multicast delegate to the AkComponent would make this easier to use. I will add the request to our backlog.

Thanks for the suggestion!
I implemented it on my side, but for some reason, 1 time out of 100 there will be a memory leak and the delegate cause our game to crash. I'm attempting to resolve this but the stack goes back into Wwise code that is not accessible... Anyone had that problem?

Otherwise it works fine, we use this solution for two weeks before figuring out that our "rare random crash" was caused by that...
I have similar issue. This is how I fixed:

Try this:

- stop all sounds before closing the level, or stop the sounds which have a callback, prior to unloading the level to load the next level.

OR -

- put the AKCallBackFunc in a global Unreal level that doesn't unload when the next Unreal level.
Hi Benoit S.

I declare a callback function:
static void EndOfEventCallbackFunc(AkCallbackType in_eType, AkCallbackFunc* in_pCallbackInfo);

and pass it when calling the function declared in AkComponet:

PlayingID = pAkComp->PostAkEventByNameWithCallback((in_pAkEvent)->GetName(), AK_EndOfEvent, &EndOfEventCallbackFunc);

However, it fails to compile and gets the error message:

error C2664: 'AkPlayingID UAkComponent::PostAkEventByNameWithCallback(const FString &,AkUInt32,AkCallbackFunc,void *,const TArray<FAkExternalSourceInfo,FDefaultAllocator> &)': cannot convert argument 3 from 'void (__cdecl *)(AkCallbackType,AkCallbackFunc *)' to 'AkCallbackFunc'

note: This conversion requires a reinterpret_cast, a C-style cast or function-style cast

I googled and got nothing. Have you ever met this problem? Any ideas?  I am very appreciative of your assistance.
...