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.

301 Lesson 8 Quiz

0 votes

Hi there, I have three questions about Lesson 8 Quiz.

1. You need to know which type of Custom Cue you are receiving to complete an If Statement.
void CallbackFunction(object in_cookie, AkCallbackType in_type, object in_info){
    if(X == AkCallbackType.AK_MusicSyncUserCue)
    {
        // Do something...
    }
Select the correct variable to replace X.

The Answer is in_type. Could you explain what is object in_cookie, AkCallbackType in_type, object in_info ? Also inside (X ==...)

2.

With Callbacks you can receive multiple Music Notifications simultaneously.

The Answer is True. Does Callbacks in the sentence mean Callback Flags?

3.

You can post Events from a Callback function.

The Answer is True. Does Events in the sentence mean some functions like PushRhythmAction?

 

Thanks

 

asked Sep 26, 2021 in General Discussion by CHI-WEI C. (130 points)

1 Answer

0 votes
 
Best answer

Hey Chi-Wei, 

Thank you for asking. I like how you're engaged in learning this! 

1) The 3 properties object in_cookie, AkCallbackType in_type, object in_info described in the lesson, are merely "attached" information received when you get a callback.
As soon as you set up more than 1x Callback on a certain Event, you'll need some kind of filtering on what type of callback you are receiving. As such, these properties should always be included for extracting information about the callback, whether you use it or not. 

2) No, Callback Flags only refer to the callback type option you choose, e.g. AK_MusicSyncUserCue. A "Callback" is the entire call consisting of information like Callback Flag, but also other information like what's the name of the cue. Here's an example from WAG of extracting more than just the Callback Flags. 
void CallbackFunction(object in_cookie, AkCallbackType in_type, object in_info){
        if (in_type == AkCallbackType.AK_MusicSyncUserCue) { 
            AkMusicSyncCallbackInfo info = (AkMusicSyncCallbackInfo)in_info;
            string callbackText = info.userCueName;
            if (callbackText == "SpawnEnemies" && Quest_ForgeSystem != null) {
                Quest_ForgeSystem.AllowEnemiesToSpawn();
            }
        }
}
3) Well, you could certainly call that function too, but that sentence refers to the ability to add more Events from Callbacks, should you want to. These days, you can get a long way with just using Music Event Cues to call other Events, but if you want to control the posting of events from the game, you can also add a .Post() call inside the Callback Function. 
For instance, say you want to play an alert sound in rhythm with the music when the boss sees the player. In such a case, you could set up a callback function that is called every MusicSyncBar and then checks if the player is in view before posting the "Boss_Alerted" Event. 

I hope this helps to understand the concept of Callbacks. 

answered Sep 27, 2021 by Mads Maretty S. (Audiokinetic) (39,060 points)
selected Sep 27, 2021 by Mads Maretty S. (Audiokinetic)
...