커뮤니티 Q&A

Audiokinetic의 커뮤니티 Q&A 포럼에 오신 것을 환영합니다. 이 포럼은 Wwise와 Strata 사용자들이 서로 도움을 주는 곳입니다. Audiokinetic의 직접적인 도움을 얻으려면 지원 티켓 페이지를 사용하세요. 버그를 보고하려면 Audiokinetic 런처에서 Bug Report 옵션을 사용하세요. (Q&A 포럼에 제출된 버그 보고는 거절됩니다. 전용 Bug Report 시스템을 사용하면 보고 내용이 담당자에게 정확히 전달되어 문제 해결 가능성이 크게 높아집니다.)<segment 6493>

빠르고 정확한 답변을 얻으려면 질문을 올릴 때 다음 팁을 참고하세요.

  • 구체적인 내용을 적어주세요: 무엇을 하려는지, 혹은 어떤 특정 문제에 부딪혔는지 설명하세요.
  • 핵심 정보를 포함하세요: Wwise와 게임 엔진 버전, 운영체제 등 관련 정보를 함께 제공하세요.
  • 시도한 방법들을 알려주세요: 문제 해결을 위해 이미 어떤 단계를 시도해봤는지 설명해주세요.
  • 객관적인 사실에 초점을 맞추세요: 문제의 기술적 사실을 중심으로 설명하세요. 문제에 집중할수록 다른 사람들이 더 빠르게 해결책을 찾을 수 있습니다.

0 투표

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

General Discussion Lisbeth R. (250 포인트) 로 부터
Hi Lisbeth,

Did you figured out how to solve this problem and make it work? I'm having exactly the same problem with EndOfEvent, sometimes it work and sometimes it doesn't.

Cheers.
As I recall it, we did not find out why it did so. Also I have not looked at that for more than a month now. However, I have some theories about it.

One is that the 'package' from wwise gets lost on the way, while another concerns with the soundmixer (or what it was we were using at that point) entered a form of 'sleep' mode.

A thing I can suggest instead of the end of event is 'custom cues', 'exit' and 'enter'. Those seems to be really reliable in this way. But I will check in with the wwise guy tomorrow, because of a conversation I had with him today about the different systems in wwise. I'll be back with an update tomorrow.

If you need the coding examples of how to get the custom cue, enter or exit, let me know :)
After struggling with this and testing it over and over, at one point  I got this message on the console:

WwiseUnity: EventCallbackPackage not found for <-907605440>.
UnityEngine.Debug:LogError(Object)
AkCallbackManager:PostCallbacks() (at Assets/Wwise/Deployment/API/Handwritten/AkCallbackManager.cs:354)
AkSoundEngineController:LateUpdate() (at Assets/Wwise/Deployment/Components/AkSoundEngineController.cs:79)
UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

I am not really a programmer at all so I don't really know what it means, but looking for this error I end up here:

https://www.audiokinetic.com/library/edge/?source=Unity&id=unity__wwise__types.html

In case you still want to solve this and give it a try, I changed my code with the one on the second example on the link and now it works perfectly.

Although the callbacks are working for me now, I am indeed interested in the custom cues if you can share that code :)
The error seems to be that the 'package' sent form wwise to unity either got lost, or did not exist in the first place (e.g. you posted an event and made a typo in the name of the event). As it is converted the the integer "907605440", I cannot get specific on any other thoughts related to the error.

I am happy that you solved it, I will deff try it out as soon as possible :)

In regards to the custom cues, this is the relevant code (C#)



(imported libraries)

public class SomeAwesomeNameHere(){

    public class TheCookie{
        public string theWWiseName = "";
        public GameObject thisGameObject = null;

        public TheCookie(string theWwiseName, GameObject thisGameobject){
            this.theWWiseName = theWwiseName;
            this.thisGameObject = thisGameobject;
        }
    }

    public TheCookie thecookie;

    void Start () {
        (...some pretty code here...)
    }

    void Update(){
        (...more pretty code...)
        if(some condition to fire my function){
            startingMyPostEvent()
        }
    }

    void startingMyPostEvent(){
        AkSoundEngine.PostEvent( "pretty wwisename", theGameObjectToPlayFrom
            (uint) AkCallbackType.AK_MusicPlayStarted |   
            (uint) AkCallbackType.AK_MusicSyncEntry |
            (uint) AkCallbackType.AK_MusicSyncBar |
            (uint) AkCallbackType.AK_MusicSyncBeat |
            (uint) AkCallbackType.AK_MusicSyncExit |
            (uint) AkCallbackType.AK_MusicSyncUserCue| //what you want
            (uint) AkCallbackType.AK_EndOfEvent,
            HandleStateChanges, thecookie);
    }

    void HandleStateChanges(object m_cookie, AkCallbackType m_type, AkCallbackInfo m_info){

        (...irrelevant code omitted...)

        if( m_type == AkCallbackType.AK_MusicSyncUserCue ) {
            Debug.Log(((AkMusicSyncCallbackInfo) m_info).userCueName);
            
    }
    }
}



Also, just passing on some knowledge I learned, any messages to and from wwise, will first take effect at the end of a frame.

Or in other words, at the beginning of a frame all code is read through by the program, and all that relates to wwise is stored to only be sent/executed in the end of the frame.

This means that if you in the above HandleStateChanges() for instance call another normal void funciton, that function would run first before any of the other code in the HandleStateChanges() is executed.

1 답변

0 투표
 
우수 답변

I encountered the same problem and I think I've figured it out.

REASON: Reused Cookies.

The destructor of EventCallbackPackage calls AkCallbackManager.RemoveEventCallbackCookie, which literally removes all registered callbacks with the same cookie.
The EventCallbackPackage won't be finalized until GC happens. That should explain why callbacks will work for a while but fail then after.

Passing a new cookie every time fixed the problem for me.

Jue H. (440 포인트) 로 부터
선택됨 Lisbeth R. 로 부터
Due to a change in the system setup we are no longer using a continous listen for end of event. But if we are going to use it again, I will be sure to test out this method.

It seems to be very possible however, and I am going to mark your answer as the solution.

Thank you very much for it :)
...