Community Q&A

Welcome to Audiokinetic’s community-driven Q&A forum. This is the place where Wwise and Strata users help each other out. For direct help from our team, please use the Support Tickets page. To report a bug, use the Bug Report option in the Audiokinetic Launcher. (Note that Bug Reports submitted to the Q&A forum will be rejected. Using our dedicated Bug Report system ensures your report is seen by the right people and has the best chance of being fixed.)

To get the best answers quickly, follow these tips when posting a question:

  • Be Specific: What are you trying to achieve, or what specific issue are you running into?
  • Include Key Details: Include details like your Wwise and game engine versions, operating system, etc.
  • Explain What You've Tried: Let others know what troubleshooting steps you've already taken.
  • Focus on the Facts: Describe the technical facts of your issue. Focusing on the problem helps others find a solution quickly.

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

 

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. 

by Mads Maretty S. (Audiokinetic) (40.2k points)
selected by Mads Maretty S. (Audiokinetic)
...