[詳解]
44 #define AK_WWISESDK_VERSION_NATIVE_COMBINED ((AK_WWISESDK_VERSION_MAJOR << 19) | (AK_WWISESDK_VERSION_MINOR << 16) | AK_WWISESDK_VERSION_SUBMINOR)
61 template <
bool = false>
84 template <
typename CInterface>
102 template <
typename CInterface,
typename CInstance =
typename CInterface::Instance>
125 template <
typename CPPInstance,
bool in_baseInstance>
139 template <
typename CPPInstance>
160 static CInstance* GetCInterfaceInstance()
163 for (
int i = 0; i < pluginInfo->m_arraySize; ++i)
188 template <InterfaceType in_
interfaceType, InterfaceVersion in_
interfaceVersion>
205 #define AK_WWISE_PLUGIN_SPECIALIZE_INTERFACE_CLASS(in_name) \
206 template<> struct KnownInterfaceClass<(AK::Wwise::Plugin::InterfaceType)in_name::k_interfaceType, in_name::k_interfaceVersion> \
208 using Type = in_name; \
209 using Interface = typename Type::Interface; \
221 template <
typename T>
237 #define AK_WWISE_PLUGIN_SPECIALIZE_HOST_INTERFACE(in_name, in_varname, ...) \
239 class RequestedHostInterface<in_name> : public HostInterfaceGlue<in_name, true> __VA_ARGS__ \
242 using HostInterfaceDefinition = HostInterfaceGlue<in_name, true>; \
243 in_name::Interface& g_ ## in_varname ## Interface = HostInterfaceDefinition::g_cppinterface; \
244 HostInterfaceDefinition::Instance& m_ ## in_varname = *HostInterfaceDefinition::m_instance; \
246 RequestedHostInterface() {} \
262 #define AK_WWISE_PLUGIN_SPECIALIZE_HOST_INTERFACE_NO_BASE_INSTANCE(in_name, in_varname) \
264 class RequestedHostInterface<in_name> : public HostInterfaceGlue<in_name, false> \
267 using HostInterfaceDefinition = HostInterfaceGlue<in_name, false>; \
268 in_name::Interface& g_ ## in_varname ## Interface = HostInterfaceDefinition::g_cppinterface; \
270 RequestedHostInterface() {} \
281 template <InterfaceType in_
interfaceType>
295 #define AK_WWISE_PLUGIN_SPECIALIZE_INTERFACE_VERSION(in_interface) \
297 struct LatestInterfaceVersion<(InterfaceType)in_interface::k_interfaceType> \
299 enum { k_interfaceVersion = (InterfaceVersion)in_interface::k_interfaceVersion }; \
326 template <
typename PluginT>
334 template <InterfaceType in_
interfaceType>
350 template <uint32_t... in_versions>
351 struct VersionPack :
public std::integer_sequence<uint32_t, in_versions...>
360 return (in_versions, ...);
375 template <uint32_t in_interfaceVersion =
k_latestInterfaceVersion, uint32_t... in_requestedVersions, uint32_t... in_providedVersions>
378 if constexpr (in_interfaceVersion >= 1)
382 std::is_base_of_v<RequestedHostInterface<InterfaceClass>, PluginT>,
383 VersionPack<in_interfaceVersion, in_requestedVersions...>,
384 VersionPack<in_requestedVersions...>>;
386 std::is_base_of_v<InterfaceClass, PluginT>,
387 VersionPack<in_interfaceVersion, in_providedVersions...>,
388 VersionPack<in_providedVersions...>>;
396 return std::pair<VersionPack<in_requestedVersions...>, VersionPack<in_providedVersions...>>();
435 k_requested = RequestedInterfaceVersions::size() >= 1,
443 k_provides = ProvidedInterfaceVersions::size() >= 1,
448 k_has = k_requested || k_provides
451 static_assert(RequestedInterfaceVersions::size() <= 1,
"Plugin can't request more than one version of the same interface");
452 static_assert(ProvidedInterfaceVersions::size() <= 1,
"Plugin can't provide more than one version of the same interface");
453 static_assert(!(k_requested && k_provides),
"Requested interfaces can't be provided and provided interfaces can't be requested");
469 if constexpr (k_requested)
471 return RequestedInterfaceVersions::GetLatest();
473 else if constexpr (k_provides)
475 return ProvidedInterfaceVersions::GetLatest();
532 return &s_placeholder;
578 template <InterfaceType in_
interfaceType>
600 template <InterfaceType in_
interfaceType>
605 GenerateInterfaceArray<(InterfaceType)(in_interfaceType + 1)>(
615 return out_interfaces;
623 template <InterfaceType in_
interfaceType>
656 template <InterfaceType in_
interfaceType = (InterfaceType)(AK_WWISE_PLUGIN_INTERFACE_TYPE_UNKNOWN + 1)>
724 auto plugin =
new PluginT;
744 auto voidinstance = in_instance[0].
m_instance;
748 delete[] in_instance;
760 &in_pluginRegistration->m_ulCompanyID,
761 &in_pluginRegistration->m_ulPluginID,
762 &in_pluginRegistration->m_eType,
764 in_pluginRegistration,
774 uint32_t in_pluginFlags = 0) :
797 #define AK_PLUGIN_USERGENERATEDPLUGININFO_NAMESPACE_NAME2(prefix,suffix) prefix##suffix
798 #define AK_PLUGIN_USERGENERATEDPLUGININFO_NAMESPACE_NAME1(prefix,suffix) AK_PLUGIN_USERGENERATEDPLUGININFO_NAMESPACE_NAME2(prefix, suffix)
801 #if defined(DOXYGEN_INCLUDE)
805 #define AK_PLUGIN_USERGENERATEDPLUGININFO_NAMESPACE_NAME AK_PLUGIN_USERGENERATEDPLUGININFO_NAMESPACE_NAME1(UserGeneratedPluginInfo, __COUNTER__)
806 #elif !defined(__COUNTER__)
807 #define AK_PLUGIN_USERGENERATEDPLUGININFO_NAMESPACE_NAME AK_PLUGIN_USERGENERATEDPLUGININFO_NAMESPACE_NAME1(UserGeneratedPluginInfo, __LINE__)
808 #elif __COUNTER__ == __COUNTER__
809 #define AK_PLUGIN_USERGENERATEDPLUGININFO_NAMESPACE_NAME AK_PLUGIN_USERGENERATEDPLUGININFO_NAMESPACE_NAME1(UserGeneratedPluginInfo, __LINE__)
811 #define AK_PLUGIN_USERGENERATEDPLUGININFO_NAMESPACE_NAME AK_PLUGIN_USERGENERATEDPLUGININFO_NAMESPACE_NAME1(UserGeneratedPluginInfo, __COUNTER__)
824 #define AK_DECLARE_PLUGIN_CONTAINER(ContainerName) \
825 extern "C" __declspec(dllexport) AK::Wwise::Plugin::PluginContainer* GetPluginContainer ## ContainerName()
827 #define AK_DECLARE_PLUGIN_CONTAINER(ContainerName) \
828 extern "C" __attribute__ ((visibility ("default"))) AK::Wwise::Plugin::PluginContainer* GetPluginContainer ## ContainerName()
838 #define AK_DEFINE_PLUGIN_CONTAINER(ContainerName) \
840 AK::Wwise::Plugin::PluginContainer* GetPluginContainer ## ContainerName() \
842 static AK::Wwise::Plugin::PluginContainer singleton; \
857 #define AK_EXPORT_PLUGIN_CONTAINER(ContainerName) \
858 extern "C" __declspec(dllexport) AK::Wwise::Plugin::PluginContainer * ak_wwise_plugin_container_export_ ## ContainerName; \
859 AK::Wwise::Plugin::PluginContainer * ak_wwise_plugin_container_export_ ## ContainerName = GetPluginContainer ## ContainerName()
861 #define AK_EXPORT_PLUGIN_CONTAINER(ContainerName) \
862 extern "C" __attribute__ ((visibility ("default"))) AK::Wwise::Plugin::PluginContainer * ak_wwise_plugin_container_export_lib ## ContainerName; \
863 AK::Wwise::Plugin::PluginContainer * ak_wwise_plugin_container_export_lib ## ContainerName = GetPluginContainer ## ContainerName()
882 #define AK_ADD_PLUGIN_CLASS_TO_CONTAINER(ContainerName, WwiseClassName, AudioEngineRegisteredName) \
883 extern AK::PluginRegistration AudioEngineRegisteredName ## Registration; \
884 namespace { namespace AK_PLUGIN_USERGENERATEDPLUGININFO_NAMESPACE_NAME { \
885 static struct UserGeneratedPluginInfo : private AK::Wwise::Plugin::PluginInfoGenerator<WwiseClassName> \
887 UserGeneratedPluginInfo() : \
888 PluginInfoGenerator(&AudioEngineRegisteredName ## Registration) \
890 m_pluginInfo.m_next = GetPluginContainer ## ContainerName()->m_pluginInfos; \
891 GetPluginContainer ## ContainerName()->m_pluginInfos = &m_pluginInfo; \
911 #define AK_ADD_PLUGIN_CLASSID_TO_CONTAINER(ContainerName, WwiseClassName, CompanyID, PluginID, Type) \
912 namespace { namespace AK_PLUGIN_USERGENERATEDPLUGININFO_NAMESPACE_NAME { \
913 static struct UserGeneratedPluginInfo : private AK::Wwise::Plugin::PluginInfoGenerator<WwiseClassName> \
915 const AkUInt32 m_companyID = CompanyID; \
916 const AkUInt32 m_pluginID = PluginID; \
917 const AkPluginType m_type = Type; \
918 UserGeneratedPluginInfo() : \
919 PluginInfoGenerator(&m_companyID, &m_pluginID, &m_type) \
921 m_pluginInfo.m_next = GetPluginContainer ## ContainerName()->m_pluginInfos; \
922 GetPluginContainer ## ContainerName()->m_pluginInfos = &m_pluginInfo; \
928 #define AK_AUDIOPLUGIN_USERGENERATEDPLUGININFO_NAMESPACE_NAME AK_PLUGIN_USERGENERATEDPLUGININFO_NAMESPACE_NAME
931 #define DECLARE_AUDIOPLUGIN_CONTAINER(x) AK_DECLARE_PLUGIN_CONTAINER(x)
934 #define DEFINE_AUDIOPLUGIN_CONTAINER(x) AK_DEFINE_PLUGIN_CONTAINER(x)
937 #define EXPORT_AUDIOPLUGIN_CONTAINER(x) AK_EXPORT_PLUGIN_CONTAINER(x)
940 #define ADD_AUDIOPLUGIN_CLASS_TO_CONTAINER(x, y, z) AK_ADD_PLUGIN_CLASS_TO_CONTAINER(x, y, z)
943 #define ADD_AUDIOPLUGIN_CLASSID_TO_CONTAINER(x, y, a, b, c) AK_ADD_PLUGIN_CLASSID_TO_CONTAINER(x, y, a, b, c)
945 #endif // of __cplusplus
static void UpdateCInterface(const InterfaceArrayItem in_original[k_interfaceCount], int in_count=0)
PluginInfoGenerator: For each plug-in interface type, provides a single static instance used througho...
static void Constructor(InterfaceArrayItem &out_interface, const InterfaceArrayItem &in_original, PluginT *in_instance)
static void Constructor(InterfaceArrayItem out_interfaces[k_interfaceCount], const InterfaceArrayItem in_original[k_interfaceCount], PluginT *in_instance, int in_count=0)
decltype(BaseInterface::m_interface) InterfaceType
PluginInfoGenerator: Type for the m_interface value in BaseInterface
Generic base for all plug-in instances. In C++, this is derived. In C, they are equivalent.
PluginInfoGenerator(const AkUInt32 *in_companyID, const AkUInt32 *in_pluginID, const AkPluginType *in_pluginType, uint32_t in_pluginFlags=0)
@ AK_WWISE_PLUGIN_INTERFACE_TYPE_PLUGIN_CONTAINER
2021.1 Plug-in container plug-in. Contains all the other plug-ins. ak_wwise_plugin_container
The interface information of the plug-in currently being instantiated.
static constexpr InterfaceArrayItem GenerateInterface()
Generates the InterfaceArrayItem for our particular type.
ak_wwise_plugin_interface_type m_interface
Interface type (see ak_wwise_plugin_interface_type)
typename UsedInterfaceVersions::first_type RequestedInterfaceVersions
VersionPack containing the requested versions of the interface by the plug-in.
static constexpr InterfaceArrayItem * GenerateInterfaceArray(InterfaceArrayItem out_interfaces[k_interfaceCount])
typename UsedInterfaceVersions::second_type ProvidedInterfaceVersions
VersionPack containing the provided versions of the interface by the plug-in.
static GluedInterface * g_cinterface
The unique instance of the CInterface interface. Defined at nullptr first, overridden by the Host onc...
Interface used to interact with the frontend model.
typename Super::CInstance CInstance
typename CInterface::Instance Instance
decltype(BaseInterface::m_version) InterfaceVersion
PluginInfoGenerator: Type for the m_version value in BaseInterface
typename KnownInterfaceClass< in_interfaceType, k_interfaceVersion >::Type InterfaceClass
Interface class of the versioned interface type.
static GluedInterface g_cppinterface
The unique interface for this plug-in interface.
InterfaceArrayItem m_interfaceArray[k_interfaceCount]
Array of all used interfaces for the plug-in.
typename Super::Instance Instance
CInterfaceArrayItem InterfaceArrayItem
A single instantiatable plug-in interface.
Casts the plug-in class to the requested interface class.
uint32_t m_version
Version of the interface
PluginInfoGenerator: Compile-time dictionary of known interface-version.
~PluginInfoGenerator()=default
static void UpdateCInterface(const InterfaceArrayItem &in_original)
#define AK_WWISESDK_VERSION_NATIVE_COMBINED
The specific version for native plug-in interfaces. Must be identical down to the build number.
Generates the constructor for our particular type
PluginInfoGenerator: Requests a host-provided service, and optionally receives a variable containing ...
@ k_latestInterfaceVersion
Most up-to-date version of the interface in the current SDK.
Compile-time dictionary about a particular interface type.
PluginInfoGenerator: Defines a compile-time dictionary with the latest version known to the SDK for e...
Root interface allowing a logical unit (variable, library) to contain more than one interface.
static InterfaceArrayItem * Instantiate(PluginInfo *in_pluginInfo)
Plug-in instance constructor, as shared with the host.
static constexpr void GenerateInterfaceArray(InterfaceArrayItem out_interfaces[k_interfaceCount], int in_count, InterfaceArrayItem)
Recursively generates an interface array of all the Interfaces pointers.
static thread_local PluginInfo * tls_pluginInfo
static void Disembody(InterfaceArrayItem *in_instance)
Plug-in instance destructor, as shared to the host.
Generic base for all plug-in instances in C++
PluginInfoGenerator: Associates an existing C Interface with a variable that can be used....
CPluginContainer PluginContainer
Root interface allowing a logical unit (variable, library) to contain more than one interface.
HostInterfaceGlue(CInstance *in_instance)
PluginInfo m_pluginInfo
The unique m_pluginInfo used in the ak_wwise_plugin_container for that particular plug-in.
Compile-time container of version numbers.
CInterface GluedInterface
PluginInfoGenerator(PluginRegistration *in_pluginRegistration, uint32_t in_pluginFlags=0)
PluginInfoGenerator: Base class for every C++ instance that retrieves a service from the Wwise Author...
decltype(GetUsedInterfaceVersions()) UsedInterfaceVersions
Pair type containing a VersionPack of the requested versions and a VersionPack of the provided versio...
Recursively generates the constructors and interface pointer updater for all the Interfaces.
std::underlying_type< InterfaceType >::type InterfaceTypeValue
PluginInfoGenerator: Underlying storage type for the m_interface value in BaseInterface
@ k_interfaceVersion
Version of the interface used by the plug-in or k_latestInterfaceVersion if unused.
typename CPPInstance::GluedInterface GluedInterface
static constexpr uint32_t GetLatest()
Get the latest version stored in the container. Assumes the container is sorted in ascending order.
static constexpr uint32_t GetInterfaceVersion()
Extract the version of the interface used by the plug-in.
static constexpr auto GetUsedInterfaceVersions(VersionPack< in_requestedVersions... >={}, VersionPack< in_providedVersions... >={})
Recursively accumulate each version of the interface requested or provided by the plug-in (there shou...
Interface description and base class for every Wwise Authoring plug-in interface.
static BaseInterface * GetPlaceholderPointer()
Get a Placeholder Pointer object.
C++ PluginInfo Generator.
Wwise Authoring Plug-ins - Root interface allowing a logical unit (variable, library) to contain more...
uint32_t AkUInt32
Unsigned 32-bit integer
constexpr static InterfaceClass * Cast(PluginT *in_plugin)
A single instantiatable plug-in interface.
typename Super::GluedInterface GluedInterface
@ AK_WWISE_PLUGIN_INTERFACE_TYPE_UNKNOWN
2021.1 Unknown plug-in ID (0 - error, invalid, uninitialized)
CPPInstance * m_instance
The default instance for this plug-in interface.
@ AK_WWISE_PLUGIN_INTERFACE_TYPE_NUM
typename CPPInstance::Instance CInstance
ak_wwise_plugin_instance_ptr m_instance
That particular instance.
struct ak_wwise_plugin_interface_array_item * m_interfaces
ak_wwise_plugin_interface_ptr m_interface
The interface. Should be identical for every instance of this DLL.
@ k_interfaceCount
Number of interfaces we are currently using.
static constexpr size_t CountInterfaces()
Count the number of interfaces we are currently using.
あなたのプロジェクトについて教えてください。ご不明な点はありませんか。
プロジェクトを登録していただくことで、ご利用開始のサポートをいたします。
Wwiseからはじめよう