Version
menu

Wwise SDK 2025.1.0
HostReferenceSet.h
Go to the documentation of this file.
1 /*******************************************************************************
2 The content of this file includes portions of the AUDIOKINETIC Wwise Technology
3 released in source code form as part of the SDK installer package.
4 
5 Commercial License Usage
6 
7 Licensees holding valid commercial licenses to the AUDIOKINETIC Wwise Technology
8 may use this file in accordance with the end user license agreement provided
9 with the software or, alternatively, in accordance with the terms contained in a
10 written agreement between you and Audiokinetic Inc.
11 
12 Apache License Usage
13 
14 Alternatively, this file may be used under the Apache License, Version 2.0 (the
15 "Apache License"); you may not use this file except in compliance with the
16 Apache License. You may obtain a copy of the Apache License at
17 http://www.apache.org/licenses/LICENSE-2.0.
18 
19 Unless required by applicable law or agreed to in writing, software distributed
20 under the Apache License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
21 OR CONDITIONS OF ANY KIND, either express or implied. See the Apache License for
22 the specific language governing permissions and limitations under the License.
23 
24  Copyright (c) 2025 Audiokinetic Inc.
25 *******************************************************************************/
26 
27 /**
28  * \brief Wwise Authoring Plug-ins - Plug-in API for reference sets.
29  * \file AK/Wwise/Plugin/HostReferenceSet.h
30  */
31 
32 #pragma once
33 
34 #include "PluginInfoGenerator.h"
35 
36 /**
37  * \brief Interface used to interact with reference sets.
38  *
39  * A reference set is a dictionary of references to other Objects that exist in a user's Authoring
40  * project. Whenever a reference name is specified, it corresponds to the reference name set in
41  * the plug-in's XML. These Object references can be resolved to GUIDs for use in the
42  * Authoring project, or to Short IDs for use in the Wwise Runtime.
43  *
44  * The methods in this interface which use in_guidPlatform as an input parameter assume that you have
45  * access to a Platform defined as a GUID, either provided by the caller function or retrieved through
46  * the Host interface.
47  *
48  * You can retrieve GUIDs in the following ways:
49  *
50  * - Use the in_guidPlatform provided as an input parameter in \ref ak_wwise_plugin_audio_plugin_v1::GetBankParameters
51  * or \ref ak_wwise_plugin_custom_data_v1::GetPluginData
52  * - Poll the currently-active platform from \ref ak_wwise_plugin_host_v1::GetCurrentPlatform or
53  * \ref ak_wwise_plugin_host_v1::GetAuthoringPlaybackPlatform
54  *
55  * You can also provide GUID_NULL as a parameter, which accesses data for all platforms at once
56  * as a linked value. However, GUID_NULL only works when no platform-specific data is possible
57  * for a value. Using the current platform is always the preferred access method.
58  *
59  * \sa
60  * - \ref wwiseplugin_xml_properties_tag
61  * - \ref wwiseplugin_referenceset
62  * - \ref ak_wwise_plugin_notifications_reference_set_v1
63  * - \ref ak_wwise_plugin_host_object_store_v1
64  */
66 #ifdef __cplusplus
68 #endif
69 {
70 #ifndef __cplusplus
71  ak_wwise_plugin_base_interface m_baseInterface;
72 #endif
73 
74 #ifdef __cplusplus
75  /// Base host-provided instance type for ak_wwise_plugin_host_reference_set_v1.
79  {}
80 #endif
81 
82  /**
83  * \brief Retrieves the value of a specific reference as a GUID.
84  * \sa
85  * - \ref wwiseplugin_bank
86  *
87  * \param[in] in_this Current instance of this interface.
88  * \param[in] in_guidPlatform The unique ID of the queried platform.
89  * \param[in] in_pszReferenceName The name of the queried reference, based on the XML definition file.
90  * \return The returned GUID for the referenced object. If no reference is set, GUID_NULL is returned.
91  */
94  const GUID* in_guidPlatform,
95  const char * in_pszReferenceName
96  );
97 
98  /**
99  * \brief Returns the Unique ID (or "ShortID") of the corresponding object.
100  *
101  * For the plug-in reference set, this is equivalent to the ID field in the project files.
102  * This Unique ID can be used in the runtime to reference other objects through sound engine APIs,
103  * such as RTPCs, Sidechain Mix sharesets, or Events.
104  *
105  * \aknote
106  * The ID might change on Undo or Redo operations and should not be cached.
107  * Typically, this should only be used when serializing bank data for a plug-in.
108  * \endaknote
109  *
110  * \param[in] in_this Current instance of this interface.
111  * \param[in] in_guidPlatform The unique ID of the queried platform.
112  * \param[in] in_pszReferenceName The name of the queried reference, based on the XML definition file.
113  * \return Unique ID of the corresponding object. Returns AK_INVALID_UNIQUE_ID if no reference set.
114  */
117  const GUID* in_guidPlatform,
118  const char* in_pszReferenceName
119  );
120 
121  /**
122  * \brief Updates the value of a specific reference to the provided GUID.
123  *
124  * Updates the reference at \c in_pszReferenceName to the referenced object by the GUID
125  * under the \c in_guidPlatform platform. The referenced object must be a compatible type
126  * as defined in the plug-in XML definition file.
127  *
128  * If the GUID is not a valid reference or the referring object is not a valid type,
129  * the reference is set to None.
130  *
131  * \sa
132  * - \ref wwiseplugin_bank
133  *
134  * \param[in] in_this Current instance of this interface.
135  * \param[in] in_guidPlatform The unique ID of the platform whose reference you want to modify.
136  * \param[in] in_pszReferenceName The name of the reference to update, based on the XML definition file.
137  * \param[out] in_guidReference The GUID of the new referenced object.
138  * \return true if the reference was set to a valid object. False if the object is not found or is an incompatible type.
139  */
142  const GUID* in_guidPlatform,
143  const char * in_pszReferenceName,
144  const GUID* in_guidReference
145  );
146 
147  /**
148  * \brief Returns whether the specified reference has at least some linked platforms.
149  *
150  * By default, all platforms are linked.
151  *
152  * \param[in] in_this Current instance of this interface.
153  * \param[in] in_pszReferenceName The name of the queried reference, based on the XML definition file.
154  * \return true if that particular reference has some linked platforms.
155  */
158  const char * in_pszReferenceName
159  );
160 
161  /**
162  * \brief Returns whether the specified reference has one or more platforms that are not linked.
163  *
164  * By default, all platforms are linked.
165  *
166  * \param[in] in_this Current instance of this interface.
167  * \param[in] in_pszReferenceName The name of the queried reference, based on the XML definition file.
168  * \return true if that particular reference has one or more unlinked platforms.
169  */
172  const char * in_pszReferenceName
173  );
174 
175  /**
176  * \brief Returns whether the specified reference's platform is linked.
177  *
178  * By default, all platforms are linked.
179  *
180  * \param[in] in_this Current instance of this interface.
181  * \param[in] in_guidPlatform The unique ID of the queried platform.
182  * \param[in] in_pszReferenceName The name of the queried reference, based on the XML definition file.
183  * \return true if the specified reference specifically has the specified platform linked.
184  */
187  const GUID* in_guidPlatform,
188  const char * in_pszReferenceName
189  );
190 
191  /**
192  * \brief Retrieves the name of a referenced object.
193  *
194  * \aknote
195  * The returned pointer is provided by Wwise Authoring, and contains a TLS copy of the name as a string.
196  * It is guaranteed to be valid until the next Host interface function call. If you
197  * wish to retain this string, you should make a copy at the earliest convenience.
198  * \endaknote
199  *
200  * \param[in] in_this Current instance of this interface.
201  * \param[in] in_guidPlatform The unique ID of the queried platform.
202  * \param[in] in_pszReferenceName The name of the queried reference, based on the XML definition file.
203  * \return Null-terminated string of the name of the referenced object. Returns nullptr if no object is referenced.
204  */
205  const char* (*GetReferenceName)(
207  const GUID* in_guidPlatform,
208  const char * in_pszReferenceName
209  );
210 };
211 
212 
214 #ifdef __cplusplus
216 #endif
217 {
218 #ifndef __cplusplus
219  ak_wwise_plugin_base_interface m_baseInterface;
220 #endif
221 
222 #ifdef __cplusplus
223  /// Base instance type for receiving notifications on reference set's changes.
225 
228  {}
229 #endif
230 
231  /**
232  * \brief This function is called by Wwise when a plug-in reference changes.
233  *
234  * For example, data can change through interaction with a UI control bound to a reference,
235  * or through undo/redo operations.
236  *
237  * \sa
238  * - \ref wwiseplugin_referenceset_notification
239  *
240  * \param[in] in_this Current instance of this interface.
241  * \param[in] in_guidPlatform The unique ID of the queried platform.
242  * \param[in] in_pszReferenceName The name of the affected reference.
243  */
246  const GUID* in_guidPlatform,
247  const char * in_pszReferenceName
248  );
249 };
250 
251 
252 #define AK_WWISE_PLUGIN_HOST_REFERENCE_SET_V1_ID() \
253  AK_WWISE_PLUGIN_BASE_INTERFACE_FROM_ID(AK_WWISE_PLUGIN_INTERFACE_TYPE_HOST_REFERENCE_SET, 1)
254 #define AK_WWISE_PLUGIN_HOST_REFERENCE_SET_V1_CTOR() \
255 { \
256  .m_baseInterface = AK_WWISE_PLUGIN_HOST_REFERENCE_SET_V1_ID() \
257 }
258 
259 #define AK_WWISE_PLUGIN_NOTIFICATIONS_REFERENCE_SET_V1_ID() \
260  AK_WWISE_PLUGIN_BASE_INTERFACE_FROM_ID(AK_WWISE_PLUGIN_INTERFACE_TYPE_NOTIFICATIONS_REFERENCE_SET, 1)
261 #define AK_WWISE_PLUGIN_NOTIFICATIONS_REFERENCE_SET_V1_CTOR(/* ak_wwise_plugin_info* */ in_pluginInfo, /* void* */ in_data) \
262 { \
263  .m_baseInterface = AK_WWISE_PLUGIN_BASE_INTERFACE_CTOR(AK_WWISE_PLUGIN_NOTIFICATIONS_REFERENCE_SET_V1_ID(), in_pluginInfo, in_data) \
264 }
265 
266 
267 #ifdef __cplusplus
268 namespace AK::Wwise::Plugin
269 {
271 
272  /// \copydoc ak_wwise_plugin_host_reference_set_v1
273  template<typename CHostReferenceSetT = CHostReferenceSet, int interface_version = 1>
274  class ReferenceSetBase : public CBaseInstanceGlue<CHostReferenceSetT>
275  {
276  public:
278 
279  /**
280  * \brief The interface type, as requested by this plug-in.
281  */
282  enum : InterfaceTypeValue
283  {
284  /**
285  * \brief The interface type, as requested by this plug-in.
286  */
288  };
289  /**
290  * \brief The interface version, as requested by this plug-in.
291  */
292  enum : InterfaceVersion
293  {
294  /**
295  * \brief The interface version, as requested by this plug-in.
296  */
297  k_interfaceVersion = interface_version
298  };
299 
300  /**
301  * \brief Retrieves the value of a specific reference as a GUID.
302  * \sa
303  * - \ref wwiseplugin_bank
304  *
305  * \param[in] in_guidPlatform The unique ID of the queried platform.
306  * \param[in] in_pszReferenceName The name of the queried reference, based on the XML definition file.
307  * \return The returned GUID for referenced object. If no reference is set, GUID_NULL is returned.
308  */
309  inline GUID GetReferenceGuid(
310  const GUID& in_guidPlatform,
311  const char* in_pszReferenceName
312  ) const
313  {
314  return this->g_cinterface->GetReferenceGuid(this, &in_guidPlatform, in_pszReferenceName);
315  }
316 
317  /**
318  * \brief Returns the Unique ID (or "ShortID") of the corresponding object.
319  *
320  * For the plug-in reference set, this is equivalent to the ID field in the project files.
321  * This Unique ID can be used in the runtime to reference other objects through sound engine APIs,
322  * such as RTPCs, Sidechain Mix sharesets, or Events.
323  *
324  * \aknote
325  * The ID might change on Undo or Redo operations, and should not be cached.
326  * Typically, this should only be used when serializing bank data for a plug-in.
327  * \endaknote
328  *
329  * \param[in] in_guidPlatform The unique ID of the queried platform.
330  * \param[in] in_pszReferenceName The name of the queried reference, based on the XML definition file.
331  * \return Unique ID of the corresponding object. Returns AK_INVALID_UNIQUE_ID if no reference set.
332  */
334  const GUID& in_guidPlatform,
335  const char* in_pszReferenceName
336  ) const
337  {
338  return this->g_cinterface->GetReferenceShortId(this, &in_guidPlatform, in_pszReferenceName);
339  }
340 
341  /**
342  * \brief Updates the value of a specific reference to the provided GUID.
343  *
344  * Updates the reference at \c in_pszReferenceName to the referenced object by the GUID
345  * under the \c in_guidPlatform platform. The referenced object must be a compatible type
346  * as defined in the plug-in XML definition file.
347  *
348  * If the GUID is not a valid reference, or the referring object is not a valid type,
349  * the reference is set to None.
350  *
351  * \sa
352  * - \ref wwiseplugin_bank
353  *
354  * \param[in] in_guidPlatform The unique ID of the platform whose reference you want to modify.
355  * \param[in] in_pszReferenceName The name of the reference to update, based on the XML definition file.
356  * \param[out] in_guidReference The GUID of the new referenced object.
357  * \return true if the reference was set to a valid object. False if the object is not found, or type is incompatible.
358  */
359  inline bool SetReferenceByGuid(
360  const GUID& in_guidPlatform,
361  const char* in_pszReferenceName,
362  const GUID& in_guidReference
363  )
364  {
365  return MKBOOL(this->g_cinterface->SetReferenceByGuid(this, &in_guidPlatform, in_pszReferenceName, &in_guidReference));
366  }
367 
368  /**
369  * \brief Returns whether the specified reference has one or more platforms that are not linked.
370  *
371  * By default, all platforms are linked.
372  *
373  * \param[in] in_pszReferenceName The name of the queried reference, based on the XML definition file.
374  * \return true if that particular reference has some unlinked platforms.
375  */
376  inline bool ReferenceHasUnlinked(
377  const char* in_pszReferenceName
378  ) const
379  {
380  return MKBOOL(this->g_cinterface->ReferenceHasUnlinked(this, in_pszReferenceName));
381  }
382 
383  /**
384  * \brief Returns whether the specified reference's platform is linked.
385  *
386  * By default, all platforms are linked.
387  *
388  * \param[in] in_guidPlatform The unique ID of the queried platform.
389  * \param[in] in_pszReferenceName The name of the queried reference, based on the XML definition file.
390  * \return true if the specified reference specifically has the specified platform linked.
391  */
393  const GUID& in_guidPlatform,
394  const char* in_pszReferenceName
395  ) const
396  {
397  return MKBOOL(this->g_cinterface->ReferencePlatformIsLinked(this, &in_guidPlatform, in_pszReferenceName));
398  }
399 
400  /**
401  * \brief Retrieves the name of an object being referenced.
402  *
403  * \aknote
404  * The returned pointer is provided by Authoring, and contains a TLS copy of the property
405  * value string. It is guaranteed to be valid until the next Host function call. If you
406  * wish to retain this string, you should make a copy at the earliest convenience.
407  * \endaknote
408  *
409  * \param[in] in_guidPlatform The unique ID of the queried platform.
410  * \param[in] in_pszReferenceName The name of the queried reference, based on the XML definition file.
411  * \return Null-terminated UTF-8 string of the name of the referenced object. Returns empty string if no object is referenced.
412  */
413  inline const char* GetReferenceName(
414  const GUID& in_guidPlatform,
415  const char* in_pszReferenceName
416  ) const
417  {
418  return this->g_cinterface->GetReferenceName(this, &in_guidPlatform, in_pszReferenceName);
419  }
420 
421  };
422 
424 
425  namespace Notifications
426  {
428 
429  /// \copydoc ak_wwise_plugin_notifications_reference_set_v1
431  {
432  public:
433  /**
434  * \copydoc CReferenceSet_::Instance
435  */
437 
438  /**
439  * \brief The interface type, as provided by this plug-in.
440  */
441  enum : InterfaceTypeValue
442  {
443  /**
444  * \brief The interface type, as provided by this plug-in.
445  */
447  };
448  /**
449  * \brief The interface version, as provided by this plug-in.
450  */
451  enum : InterfaceVersion
452  {
453  /**
454  * \brief The interface version, as provided by this plug-in.
455  */
457  };
458 
459  /**
460  * \brief The C interface, fulfilled by your plug-in.
461  */
462  struct Interface : public CReferenceSet_
463  {
466  {
469  const GUID* in_guidPlatform,
470  const char* in_pszReferenceName)
471  {
472  static_cast<Instance*>(in_this)->NotifyReferenceChanged(
473  *in_guidPlatform,
474  in_pszReferenceName);
475  };
476  }
477  };
478 
480  static Interface g_interface;
481  return &g_interface;
482  }
484  return this;
485  }
487  return this;
488  }
489 
492  {
493  }
494 
495  virtual ~ReferenceSet_() {}
496 
497  /**
498  * \brief This function is called by Wwise when a plug-in reference changes.
499  *
500  * For example, data can change through interaction with a UI control bound to a reference,
501  * or through undo/redo operations.
502  *
503  * This function is not called on the Object Store or any inner reference sets.
504  *
505  * \sa
506  * - \ref wwiseplugin_referenceset_notification
507  *
508  * \param[in] in_guidPlatform The unique ID of the queried platform.
509  * \param[in] in_pszReferenceName The name of the affected reference.
510  */
512  const GUID& in_guidPlatform, ///< The unique ID of the queried platform
513  const char* in_pszReferenceName ///< The name of the reference
514  ) {}
515  };
516  } // of namespace Notifications
517 
518  /**
519  * \brief Requests a ReferenceSet interface, provided as m_referenceSet variable.
520  *
521  * If you derive your plug-in class from RequestReferenceSet, both the ReferenceSet and Notifications::ReferenceSet_ interfaces are requested.
522  * You can then derive from the virtual functions as defined in Notifications::ReferenceSet_, and
523  * access the host-provided functions in the `m_referenceSet` member variable.
524  *
525  */
527 
528  namespace Notifications
529  {
530  /// Latest version of the C ReferenceSet notification interface.
532  /// Latest version of the C++ ReferenceSet notification interface.
534  }
535 
540 } // of namespace AK::Wwise::Plugin
541 
542 #endif
@ k_interfaceType
The interface type, as requested by this plug-in.
bool(* ReferenceHasUnlinked)(const struct ak_wwise_plugin_host_reference_set_instance_v1 *in_this, const char *in_pszReferenceName)
Returns whether the specified reference has one or more platforms that are not linked.
ak_wwise_plugin_notifications_reference_set_v1 CReferenceSet_
AkUniqueID GetReferenceShortId(const GUID &in_guidPlatform, const char *in_pszReferenceName) const
Returns the Unique ID (or "ShortID") of the corresponding object.
static GluedInterface * g_cinterface
The unique instance of the CInterface interface. Defined at nullptr first, overridden by the Host onc...
decltype(BaseInterface::m_version) InterfaceVersion
PluginInfoGenerator: Type for the m_version value in BaseInterface.
@ k_interfaceType
The interface type, as provided by this plug-in.
const CReferenceSet_::Instance * GetInstancePointer() const
AkUInt32 AkUniqueID
Unique 32-bit ID.
Definition: AkTypedefs.h:39
bool ReferenceHasUnlinked(const char *in_pszReferenceName) const
Returns whether the specified reference has one or more platforms that are not linked.
@ AK_WWISE_PLUGIN_INTERFACE_TYPE_HOST_REFERENCE_SET
2025.1 Reference Set host service. ak_wwise_plugin_host_reference_set_v1
@ AK_WWISE_PLUGIN_INTERFACE_TYPE_NOTIFICATIONS_REFERENCE_SET
2025.1 Reference Set modification notification. ak_wwise_plugin_notifications_reference_set_v1
ak_wwise_plugin_notifications_reference_set_instance_v1 Instance
Base instance type for receiving notifications on reference set's changes.
Wwise Authoring Plug-ins - C++ class helper to automatically determine the plug-in interfaces used in...
PluginInfoGenerator: Associates an existing C Interface with a variable that can be used....
CInterfacePtr InterfacePtr
@ k_interfaceVersion
The interface version, as provided by this plug-in.
Interface used to interact with reference sets.
const char *(* GetReferenceName)(const struct ak_wwise_plugin_host_reference_set_instance_v1 *in_this, const GUID *in_guidPlatform, const char *in_pszReferenceName)
Retrieves the name of a referenced object.
std::underlying_type< InterfaceType >::type InterfaceTypeValue
PluginInfoGenerator: Underlying storage type for the m_interface value in BaseInterface.
@ k_interfaceVersion
The interface version, as requested by this plug-in.
The C interface, fulfilled by your plug-in.
AkUniqueID(* GetReferenceShortId)(const struct ak_wwise_plugin_host_reference_set_instance_v1 *in_this, const GUID *in_guidPlatform, const char *in_pszReferenceName)
Returns the Unique ID (or "ShortID") of the corresponding object.
const char * GetReferenceName(const GUID &in_guidPlatform, const char *in_pszReferenceName) const
Retrieves the name of an object being referenced.
virtual void NotifyReferenceChanged(const GUID &in_guidPlatform, const char *in_pszReferenceName)
This function is called by Wwise when a plug-in reference changes.
AK_WWISE_PLUGIN_SPECIALIZE_INTERFACE_VERSION(AudioPlugin)
bool(* ReferenceHasLinked)(const struct ak_wwise_plugin_host_reference_set_instance_v1 *in_this, const char *in_pszReferenceName)
Returns whether the specified reference has at least some linked platforms.
bool(* SetReferenceByGuid)(struct ak_wwise_plugin_host_reference_set_instance_v1 *in_this, const GUID *in_guidPlatform, const char *in_pszReferenceName, const GUID *in_guidReference)
Updates the value of a specific reference to the provided GUID.
GUID GetReferenceGuid(const GUID &in_guidPlatform, const char *in_pszReferenceName) const
Retrieves the value of a specific reference as a GUID.
Interface description and base class for every Wwise Authoring plug-in interface.
GUID(* GetReferenceGuid)(const struct ak_wwise_plugin_host_reference_set_instance_v1 *in_this, const GUID *in_guidPlatform, const char *in_pszReferenceName)
Retrieves the value of a specific reference as a GUID.
ak_wwise_plugin_host_reference_set_v1 CHostReferenceSet
bool SetReferenceByGuid(const GUID &in_guidPlatform, const char *in_pszReferenceName, const GUID &in_guidReference)
Updates the value of a specific reference to the provided GUID.
Base host-provided instance type for ak_wwise_plugin_host_reference_set_v1.
#define MKBOOL(cond)
Definition: PluginHelpers.h:79
CReferenceSet_::Instance * GetInstancePointer()
void(* NotifyReferenceChanged)(struct ak_wwise_plugin_notifications_reference_set_instance_v1 *in_this, const GUID *in_guidPlatform, const char *in_pszReferenceName)
This function is called by Wwise when a plug-in reference changes.
bool(* ReferencePlatformIsLinked)(const struct ak_wwise_plugin_host_reference_set_instance_v1 *in_this, const GUID *in_guidPlatform, const char *in_pszReferenceName)
Returns whether the specified reference's platform is linked.
#define AK_WWISE_PLUGIN_SPECIALIZE_HOST_INTERFACE(in_name, in_varname,...)
PluginInfoGenerator: Creates a C++ host specialization for interface class specified in in_name,...
bool ReferencePlatformIsLinked(const GUID &in_guidPlatform, const char *in_pszReferenceName) const
Returns whether the specified reference's platform is linked.
Interface used to interact with reference sets.
Base instance type for receiving notifications on reference set's changes.
AK_WWISE_PLUGIN_SPECIALIZE_INTERFACE_CLASS(AudioPlugin)

Was this page helpful?

Need Support?

Questions? Problems? Need more info? Contact us, and we can help!

Visit our Support page

Tell us about your project. We're here to help.

Register your project and we'll help you get started with no strings attached!

Get started with Wwise