社区问答

欢迎来到 Audiokinetic 社区问答论坛。在此,Wwise 和 Strata 用户可互帮互助。如需我们团队直接提供协助,请前往技术支持申请单页面。若要报告问题,请在 Audiokinetic Launcher 中选择“报告错误”选项(注意,问答论坛并不会接收错误报告)。我们内部设有专门的错误报告系统,会有专人查看报告并设法解决问题。

要想尽快得到满意的解答,请在提问时注意以下几点:

  • 描述尽量具体:比如,想达到什么样的目的,或者具体哪里有问题。
  • 包含关键细节:比如,Wwise 和游戏引擎版本以及所用操作系统等等。
  • 阐明所做努力:阐明自己为了排除故障都采取了哪些措施。
  • 聚焦问题本身:聚焦于问题本身的相关技术细节,以便别人可以快速找到解决方案。

0 投票
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);
    }
分类:General Discussion | 用户: M. Riddersholm (230 分)

1个回答

0 投票

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

用户: Martin S. (590 分)
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.
...