Audiokinetic's Community Q&A is the forum where users can ask and answer questions within the Wwise and Strata communities. If you would like to get an answer from Audiokinetic's Technical support team, make sure you use the Support Tickets page.

0 votes

Hello, I'm trying to write a custom effect plugin in Wwise for the first time and used the wp.py workflow described in the documentation. I'd like my plugin Execute function to read the current value of a state group. I'm unable to call AK::SoundEngine::Query::GetState or access the AkStateMgr due to link errors (the functions are undefined)

When I do add the following libraries under Additional Dependencies in my Linker input settings, I then get an error "LNK 2005 g_pAKPluginList already defined" from my plugin as well as AkEffectsMgr.obj 

  • AkMemoryMgr.lib
  • AkSoundEngine.lib
  • AkMusicEngine.lib
  • AkStreamMgr.lib
  • CommunicationCentral.lib

Am I going about this the wrong way? Should I be modifying AK::IAkGlobalPluginContextEx to expose functionality to my plugin?

Thank you

in General Discussion by Sheri B. (290 points)

1 Answer

0 votes
 
Best answer

The sound engine libraries you listed here are indeed meant for a game to link with and cannot be used for plug-ins. Accessing sound engine services from a plug-in is possible, but it is limited to what is offered to the plug-in context: AK::IAkGlobalPluginContext.

Some details on the infrastructure of plug-ins to understand the error: each plug-in library exports a linked-list of plug-ins it contains through the global symbol g_pAKPluginList. A corresponding linked-list in the sound engine SDK libraries contains the aggregated linked-list from all plug-ins, which is built at static initialization through the AK::PluginRegistration instances generated by the AK_STATIC_LINK_PLUGIN macro located in the factory file of the plug-in, or loaded as needed when using dynamic libraries (in which case the game does not include the factory file). Having both your plug-in and the sound engine SDK define g_pAKPluginList is why you get the "LNK 2005 g_pAKPluginList already defined" error.

Now, instead of querying for a specific state group, you should rely on the parameter abstraction so that any state group can be used and so that the mapping of values is user-defined.
To add an RTPC-enabled parameter to your plug-in that supports states, add the SupportRTPCType="Additive" attribute to a property in your plug-in XML definition; details can be found on the documentation page Plug-in Property and Custom Property XML Description. Refer to the AkDelay sample effect plug-in found in "SDK/samples/Plugins/AkDelay" for an example of such plug-in that supports states.

by Samuel L. (Audiokinetic) (23.6k points)
selected by Sheri B.
Thank you for the detailed answer!

Is there a way for Reference type parameters to support RTPCs? I'd like to write to a different RTPC depending on a State.
Not sure what is the end goal for "writing to a different RTPC" from your plug-in's perspective, but references do not support RTPCs. You can always have a property with Enumeration restriction to select from a range of predefined values.
Ok, I figured as much and have essentially done that, thank you.
The plugin is to help us with dynamic mixing, outputting different RTPCs based on a state to duck busses differently.

Sorry, one last question for you about reading the Object Reference Id when it's set in the authoring tool. The NotifyPropertyChanged I've implemented on my plugin is called, but it's unclear how to read its unique Id.
I can see that guids are written to the xml on save, but querying the m_propertySet appears to give an uninitialized value, and SetParam on the parameters is not called.
...