I have a sound playing once, when some action occurred, and while the sound is playing, I lock the listener for the action, and on EndOfEvent I unlock the listener, so that the sound can be activated again.
Now the problem is, that it works for a while, and then it stops working, where it is specifically the EndOfEvent that fails after the sound has started playing (knowledge gained through prints).
So what I want to know is why the EndOfEvent could fail to activate.
I am new to wwise, so I'm sorry if it is a stupid mistake I made in the syntax or if this has already been resolved somewhere else, but I cannot seem to find anything that relates to this hickup,
I work in Unity with C#, and this is the relevant code:
void FixedUpdate () {
if(!audioFired){
if(runCounter == maxRuns){
CalculateSpeed();
runCounter = 0;
}
runCounter++;
}
}
void CalculateSpeed(){
(...some caluclations to find inputValue...)
if(inputValue >= minActivationSpeed){
AkSoundEngine.PostEvent(WwiseReferenceName, gameObject, (uint) AkCallbackType.AK_EndOfEvent, HandleCallBack, thecookie); //thecookie is a public class holding information about what gameObject we are refering to, and what name it has
}
}
void HandleCallBack(object m_cookie, AkCallbackType m_type, object someObject){
audioFired = true;
if(m_type == AkCallbackType.AK_EndOfEvent){
audioFired = false;
runCounter = 0;
}
}
Best regards
LR