在 Audiokinetic 社区问答论坛上,用户可对 Wwise 和 Strata 相关问题进行提问和解答。如需从 Audiokinetic 技术支持团队获取答复,请务必使用技术支持申请单页面。

Invalid State Group ID with Short IDs set to 0

+3 投票

Hello, I am having an issue in UE4 4.24 with Wwise integration 2019.2.4.7329.1721
I've rolled back my project and the problem persists so I know it isn't likely to be an issue with the version.
I have a state called TerrainType that switches between a Dirt and Asphalt state whenever the player moves over the respective material.
Whenever I run my project, I am met with a "Error: Invalid State Group ID" message any time I try to switch the states using the Set State node in Blueprints. 

I've deleted and regenerated all of my banks multiple times and they load in Unreal without issue as far as I can tell.
What's odd to me is that all of the state uassets that are created have a Group Short ID of 0. The longer Group ID looks fine, but even when I create new states besides my TerrainType, the Group Short ID is always 0. To me that doesn't seem like desired behavior.

Here's a look at the details of my states: https://imgur.com/a/3rtyqQV

The long IDs here match up with the IDs in my Init.txt so I feel like, for the most part, the Init bank is loaded correctly. I don't know how to check what the short IDs should be or if it even matters.
But something weird is going on here and I don't know if anybody has ever run into anything similar or might know why this is the only error I am getting.
Thank you in advance for any help and let me know if you need more info.

最新提问 7月 23, 2020 分类:General Discussion | 用户: Evan C. (140 分)

2 个回答

0 投票
Hi Evan, I have the same problem. How did you solve?
最新回答 8月 21, 2020 用户: Giuseppe P. (140 分)
Sadly, I never truly did solve this. I was able to get my sounds working by using a Wwise Switch instead of a State. For whatever reason, switches acted normal and didn't have any ID issues, but creating states always generated a uasset with a short ID of 0. Unfortunately my solution wasn't much of a real fix because in many cases you may want or need to use states instead of switches. I was "lucky" enough that the logic I was trying to implement worked just as well with switches as it should have with states.
+2 投票

We have run into the same issue. Looking at the code, it turns out that short IDs of zero are actually expected on AkAudioTypes (which is what these are). If they are zero, then the short ids are generated at load time from the name of the asset. The problem is that the name of the asset for states is a combination of the state group name and the state name, so the short id generated isn't the same as the one the API generates when you pass it the individual strings.

We modified the Wwise plugin to fix this. Perhaps it will be useful to you. it's in AkGroupValue.cpp.

UPDATE: Read the comment below from Tom V. It may more correct in UAkStateValue.cpp instead.

void UAkGroupValue::Load()
{
  // ShortIDs are supposed to be the hash of the name. It seems like sometimes Wwise fills these in, and sometimes they leave them zero.
  //   When they are zero, they are supposed to be filled in with the hash of the name at load time. However, States have a group id and a short id
  //   and the name contains both strings. So, we need to split them up and get the right short id for each part.
  //   I think this is an oversight by Wwise. The AkAudioType from which this derives sets the short id if it isn't set, but does so with the full name
  //   and not just the approproate part.
  if (auto AudioDevice = FAkAudioDevice::Get())
  {
    // GroupValues' asset names are a combination of group name AND switch name, so we need to parse that out of the name
    FString FullName = GetName();
    int32 Index;
    if (FullName.FindChar('-', Index))
    {
      auto GroupIdFromName = AudioDevice->GetIDFromString(FullName.Mid(0, Index));
      auto idFromName = AudioDevice->GetIDFromString(FullName.Mid(Index+1));
      if (GroupShortID == 0)
      {
        GroupShortID = GroupIdFromName;
      }
      else if (GroupShortID != 0 && GroupShortID != GroupIdFromName)
      {
        UE_LOG(LogAkAudio, Error, TEXT("%s -> %s - Current Group Short ID '%u' is different from ID from the name '%u'"), *GetName(), *FullName.Mid(0, Index), GroupShortID, GroupIdFromName);
      }

      if (ShortID == 0)
      {
        ShortID = idFromName;
      }
      else if (ShortID != 0 && ShortID != idFromName)
      {
        UE_LOG(LogAkAudio, Error, TEXT("%s -> %s - Current Short ID '%u' is different from ID from the name '%u'"), *GetName(), *FullName.Mid(Index+1), ShortID, idFromName);
      }
    }
  }

  Super::Load(); // Must be called after the above
  // THE REST OF THE EXISTING FUNCTION GOES HERE
}
 
最新回答 9月 17, 2020 用户: Shannon P. (230 分)
修改于 3月 27, 2021 用户:Shannon P.
Thank you very much for this. We ran into the same issue with States that were missing their GroupShortID & this fixed the issue for us.

However just wanted to point out two things you might want to change, for anyone else copy pasting this code!

- The line setting GroupShortID above is wrong, it is setting it equal to idFromName when it should be setting it to GroupIdFromName
- I'm not sure if this code applies to all UAkGroupValue types. Specifically, I think it might not apply to Switch values, as it would report some of our (functional) Switch values as having incorrect ShortID values. To stay on the safe side I added this code to UAkStateValue::Load rather than UAkGroupValue::Load so that it only affected our broken switches and not any other classes.

Thanks again!
You're absolutely right. I modified my code above to fix the error so no one else accidentally copies the wrong thing.

You may also be right about the Group vs State thing. I'm not sure because there's no documentation about what these IDs actually are, but we were getting some seemingly false positives as well. I have also moved our code into new override for UAkStateValue::Load().
...