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
Everything seems to work correctly.But my rtpcValue won't update from default.

I am able to set my rtpc value through SetRTPCValue.
I can hear that the RTPC is working.
GetRTPCValue accapts my default value.
AKRESULT is debugging me "successfull"
I am using the RTPCValue_Global type, which should ignore both in_gameObjectID and in_playingID.

But still my float rtpcValue won't update. Have anybody encountered that problem before?

This is my code:

    float rtpcValue;
    public string rtpcID = "rtpc_sunrise";
    public string in_playingID;
    int type1 = 1;

  void Update ()
    {

        if (Input.GetKey(KeyCode.Alpha7))
        {
            AkSoundEngine.SetRTPCValue(rtpcID, 0);
        }

        if (Input.GetKey(KeyCode.Alpha8))
        {
            AkSoundEngine.SetRTPCValue(rtpcID, 90);
        }

        AKRESULT result = AkSoundEngine.GetRTPCValue(rtpcID, gameObject, 0, out rtpcValue, ref type1);
        Debug.Log("Reult: " + result.ToString() + " value " + rtpcValue);
    }
in General Discussion by M. Riddersholm (230 points)

1 Answer

0 votes

Hi,

the AkSoundEngine.GetRTPCValue function can modify the value of your type1 variable if the value is not found on the scope requested, which probably happens on your first Update() execution since the RTPC doesn't seem to be assigned yet.

Since the scope of that variable is bigger than the Update function, all future GetRTPCValue calls will be made with the incorrect type1 value, most likely requesting the DefaultValue instead of the GlobalValue.

 

I would advise declaring that variable inside the scope of your Update function and preferably right before using it, like so:

 

void Update()

{

    ...

 

    int valueType = (int)AkQueryRTPCValue.RTPCValue_Global;  // 1 like your type1 variable

    AKRESULT result = AkSoundEngine.GetRTPCValue(rtpcID, null, 0, out rtpcValue, ref valueType);

}

 

If you want to confirm this, you can output the value of your type1 variable in your log along with the rtpc value

Cheerz

by Martin S. (590 points)
Hi Martin

Thank you for the answer.

I figured it out myself, with the help of my programmor.
But I didn't manage to figure out why excatly RTPCtype is set with a ref in the GetRTPCValue method.
Why excatly is that? why would you ever need the type to be set to default by itself?
The function starts by trying to find the rtpc value at the scope requested. If the value is not found, it tries a more general scope until it finds it.

Once the function returns, you can test valueType again to know the scope of the value returned.
...