GetRTPCValue errors (wwise impl)

I’m trying to get a RTPC value from wwise into my game - this RTPC is being set by the wwise Meter effect so I can get bus volumes into my game to generate vfx.

Firstly, I didn’t see any way to do this in the current audio implementation code but if I missed something please let me know!

Here’s what I am trying:

In my game’s gem I have a component where I am using the wwise sdk to make the following call:

float AudioManagerComponent::GetRtpcValue(AZStd::string rtpcName){
      AK::SoundEngine::Query::RTPCValue_type valueType = AK::SoundEngine::Query::RTPCValue_Global;
      AkRtpcValue outValue = 0.0f;
      const AKRESULT result = AK::SoundEngine::Query::GetRTPCValue(
        rtpcName.c_str(),
        AK_INVALID_GAME_OBJECT,
        0,
        outValue,
        valueType
      ); // exception thrown here
      return (float)outValue;
    }

However this code throws a runtime exception @ the GetRTPCValue call:

Exception thrown at 0x00007FFE317E3DCA (Gem.Polywave.bcd009055f6345a1a3f8457d3ce5ad02.v0.1.0.dll) in PolywaveLauncher.exe: 0xC0000005: Access violation reading location 0x0000000000000030.

Also when running with debug, I can’t seem to step into that function call since I’m assuming the wwise sdk code isn’t being included? I’m fairly new to c++ so if there is a way for me to debug the wwise sdk it might help me track the problem down as well.

In wwise I’m pretty sure everything is setup correctly - I see my meter and RTPC values being updated during a capture session. I do not see the query request coming in however, so I’m assuming that the GetRTPCValue call is failing before it even sends anything to wwise.

I believe the issue was my class inherited from AZ::Component which uses the wrong memory allocator, but ended up getting it to work another way by adding an implementation in the AudioEngineWwise gem

    float CAudioSystemImpl_wwise::GetGlobalRtpcValue(const char* rtpcName){
      AK::SoundEngine::Query::RTPCValue_type valueType = AK::SoundEngine::Query::RTPCValue_Global;
      AkRtpcValue outValue = 0.0f;
      AKRESULT result = AK::SoundEngine::Query::GetRTPCValue(
        rtpcName,
        AK_INVALID_GAME_OBJECT,
        AK_INVALID_PLAYING_ID,
        outValue,
        valueType 
      );
      // mayb pass by ref later instead?
      return (float)outValue;
    }

and added the call to the audio implementation request bus, called from my component like this

      Audio::AudioSystemImplementationRequestBus::BroadcastResult(
        drumsVal,
        &Audio::AudioSystemImplementationRequestBus::Events::GetGlobalRtpcValue,
        "stem_drums_meter");

Since the rtpcs I care about are all global thats all I needed.

2 Likes