Table of Contents

Wwise SDK 2019.2.3
Plugin.h
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  Version: <VERSION> Build: <BUILDNUMBER>
25  Copyright (c) <COPYRIGHTYEAR> Audiokinetic Inc.
26 *******************************************************************************/
27 
28 /// \file
29 /// Wwise plug-in interface master file, used to include all necessary files for plug-in implementation.
30 
31 #pragma once
32 
33 #include <AK/Wwise/Plugin/PluginMFCWindows.h> // Must be set first, as it can include MFC or not
34 
35 #include <AK/Wwise/Plugin/PluginInfoGenerator.h>
36 
37 #include <AK/Wwise/Plugin/Host.h>
38 #include <AK/Wwise/Plugin/HostConversionHelpers.h>
39 #include <AK/Wwise/Plugin/HostObjectMedia.h>
40 #include <AK/Wwise/Plugin/HostObjectStore.h>
41 #include <AK/Wwise/Plugin/HostPropertySet.h>
42 #include <AK/Wwise/Plugin/HostUndoManager.h>
43 #include <AK/Wwise/Plugin/HostDataWriter.h>
44 #include <AK/Wwise/Plugin/HostXml.h>
45 #include <AK/Wwise/Plugin/AudioPlugin.h>
46 #include <AK/Wwise/Plugin/Conversion.h>
47 #include <AK/Wwise/Plugin/MediaConverter.h>
48 #include <AK/Wwise/Plugin/FirstTimeCreationMessage.h>
49 #include <AK/Wwise/Plugin/SinkDevices.h>
50 
51 #ifdef AK_WIN
52 #include <AK/Wwise/Plugin/GUIConversionWindows.h>
53 #include <AK/Wwise/Plugin/GUIWindows.h>
54 #endif
55 
56 namespace AK
57 {
58  namespace Wwise
59  {
60  namespace Plugin
61  {
62  template<typename T>
63  class DefaultPlugin : public T
64  {
65  public:
66  using T::T;
67 
68  // AudioPlugin interface
69  virtual bool IsPlayable() const override { return true; }
70  virtual void Delete() override {}
71  virtual bool Load(XmlReader * in_pReader) override { return false; }
72  virtual bool Save(XmlWriter * in_pWriter) override { return false; }
73  virtual bool CopyInto(AudioPlugin * io_pWObject) const override { return true; }
74  virtual void NotifyCurrentPlatformChanged(const GUID & in_guidCurrentPlatform) override {}
75  virtual void NotifyPropertyChanged(const GUID & in_guidPlatform, const char * in_pszPropertyName) override {}
76  virtual void NotifyInnerObjectPropertyChanged(PropertySet * in_pPSet, const GUID & in_guidPlatform, const char * in_pszPropertyName) override {}
77  virtual void NotifyInnerObjectAddedRemoved(PropertySet * in_pPSet, unsigned int in_uiIndex, NotifyInnerObjectOperation in_eOperation) override {}
78  virtual void NotifyPluginMediaChanged() override {}
79  virtual bool GetBankParameters(const GUID & in_guidPlatform, DataWriter * in_pDataWriter) const override { return false; }
80  virtual bool GetPluginData(const GUID & in_guidPlatform, AkPluginParamID in_idParam, DataWriter * in_pDataWriter) const override { return false; }
81  virtual bool DisplayNameForProp(const char * in_pszPropertyName, char * out_pszDisplayName, uint32_t in_unCharCount) const override { return false; }
82  virtual bool DisplayNamesForPropValues(const char * in_pszPropertyName, char * out_pszValuesName, uint32_t in_unCharCount) const override { return false; }
83  virtual void NotifyMonitorData(const MonitorData * in_pDataArray, unsigned int in_uCount, bool in_bNeedsByteSwap, bool in_bRealtime) override {}
84  virtual LicenseStatus GetLicenseStatus(const GUID & in_guidPlatform, Severity & out_eSeverity, char * out_pszMessage, unsigned int in_uiBufferSize) const override { return LicenseStatus::LicenseStatus_Valid; }
85  virtual bool GetSourceDuration(double & out_dblMinDuration, double & out_dblMaxDuration) const override { out_dblMinDuration = 0.f; out_dblMaxDuration = 0.f; return false; }
86  };
87 
88 #ifdef AK_WIN
89  template<typename T>
90  class DefaultPluginGUI : public T
91  {
92  public:
93  using T::T;
94 
95  virtual HINSTANCE GetResourceHandle() const override { return nullptr; }
96  virtual bool GetDialog(eDialog in_eDialog, uint32_t & out_uiDialogID, PopulateTableItem *& out_pTable) const override { return false; }
97  virtual bool WindowProc(eDialog in_eDialog, HWND in_hWnd, uint32_t in_message, WPARAM in_wParam, LPARAM in_lParam, LRESULT & out_lResult) override { return false; }
98  virtual bool Help(HWND in_hWnd, eDialog in_eDialog, const char * in_szLanguageCode) const override { return false; }
99  };
100 #endif
101  }
102  }
103 }
104 
105 #define AK_AUDIOPLUGIN_USERGENERATEDPLUGININFO_NAMESPACE_NAME2(prefix,suffix) prefix##suffix
106 #define AK_AUDIOPLUGIN_USERGENERATEDPLUGININFO_NAMESPACE_NAME1(prefix,suffix) AK_AUDIOPLUGIN_USERGENERATEDPLUGININFO_NAMESPACE_NAME2(prefix, suffix)
107 #if !defined(__COUNTER__)
108 #define AK_AUDIOPLUGIN_USERGENERATEDPLUGININFO_NAMESPACE_NAME AK_AUDIOPLUGIN_USERGENERATEDPLUGININFO_NAMESPACE_NAME1(UserGeneratedPluginInfo, __LINE__)
109 #elif __COUNTER__ == __COUNTER__
110 #define AK_AUDIOPLUGIN_USERGENERATEDPLUGININFO_NAMESPACE_NAME AK_AUDIOPLUGIN_USERGENERATEDPLUGININFO_NAMESPACE_NAME1(UserGeneratedPluginInfo, __LINE__)
111 #else
112 #define AK_AUDIOPLUGIN_USERGENERATEDPLUGININFO_NAMESPACE_NAME AK_AUDIOPLUGIN_USERGENERATEDPLUGININFO_NAMESPACE_NAME1(UserGeneratedPluginInfo, __COUNTER__)
113 #endif
114 
115 // Declares the audio plug-in container. The container name must be the
116 // plug-in file/xml name. So, it should be AkCompressor for AkCompressor.dll/.xml.
117 #define DECLARE_AUDIOPLUGIN_CONTAINER(ContainerName) extern AK::Wwise::Plugin::PluginContainer& GetPluginContainer ## ContainerName()
118 
119 // Defines the unique audio plug-in container. The container name must be the
120 // plug-in file/xml name. So, it should be AkCompressor for AkCompressor.dll/.xml.
121 #define DEFINE_AUDIOPLUGIN_CONTAINER(ContainerName) \
122  AK::Wwise::Plugin::PluginContainer& GetPluginContainer ## ContainerName() \
123  { \
124  static AK::Wwise::Plugin::PluginContainer singleton; \
125  return singleton; \
126  }
127 
128 // Exports the audio plug-in container. The export name is
129 // ak_wwise_plugin_container_export_ContainerName, where ContainerName must be the
130 // plug-in file/xml name. So, it should be AkCompressor for AkCompressor.dll/.xml.
131 #ifdef AK_WIN
132 #define EXPORT_AUDIOPLUGIN_CONTAINER(ContainerName) \
133  extern "C" __declspec(dllexport) AK::Wwise::Plugin::PluginContainer * ak_wwise_plugin_container_export_ ## ContainerName; \
134  AK::Wwise::Plugin::PluginContainer * ak_wwise_plugin_container_export_ ## ContainerName = &GetPluginContainer ## ContainerName()
135 #else
136 #define EXPORT_AUDIOPLUGIN_CONTAINER(ContainerName) \
137  extern "C" __attribute__ ((visibility ("default"))) AK::Wwise::Plugin::PluginContainer * ak_wwise_plugin_container_export_lib ## ContainerName; \
138  AK::Wwise::Plugin::PluginContainer * ak_wwise_plugin_container_export_lib ## ContainerName = &GetPluginContainer ## ContainerName()
139 #endif
140 
141 #define ADD_AUDIOPLUGIN_CLASS_TO_CONTAINER(ContainerName, WwiseClassName, AudioEngineRegisteredName) \
142  extern AK::PluginRegistration AudioEngineRegisteredName ## Registration; \
143  namespace { namespace AK_AUDIOPLUGIN_USERGENERATEDPLUGININFO_NAMESPACE_NAME { \
144  static struct UserGeneratedPluginInfo : private AK::Wwise::Plugin::PluginInfoGenerator<WwiseClassName> \
145  { \
146  UserGeneratedPluginInfo() : \
147  PluginInfoGenerator(&AudioEngineRegisteredName ## Registration) \
148  { \
149  m_pluginInfo.m_next = GetPluginContainer ## ContainerName().m_pluginInfos; \
150  GetPluginContainer ## ContainerName().m_pluginInfos = &m_pluginInfo; \
151  } \
152  } g_singleton; \
153  } }
154 
155 #define ADD_AUDIOPLUGIN_CLASSID_TO_CONTAINER(ContainerName, WwiseClassName, CompanyID, PluginID, Type) \
156  namespace { namespace AK_AUDIOPLUGIN_USERGENERATEDPLUGININFO_NAMESPACE_NAME { \
157  static struct UserGeneratedPluginInfo : private AK::Wwise::Plugin::PluginInfoGenerator<WwiseClassName> \
158  { \
159  const AkUInt32 m_companyID = CompanyID; \
160  const AkUInt32 m_pluginID = PluginID; \
161  const AkPluginType m_type = Type; \
162  UserGeneratedPluginInfo() : \
163  PluginInfoGenerator(&m_companyID, &m_pluginID, &m_type) \
164  { \
165  m_pluginInfo.m_next = GetPluginContainer ## ContainerName().m_pluginInfos; \
166  GetPluginContainer ## ContainerName().m_pluginInfos = &m_pluginInfo; \
167  } \
168  } g_singleton; \
169  } }
170 
virtual void NotifyPluginMediaChanged() override
Definition: Plugin.h:78
Audiokinetic namespace.
virtual bool Help(HWND in_hWnd, eDialog in_eDialog, const char *in_szLanguageCode) const override
Definition: Plugin.h:98
virtual bool GetDialog(eDialog in_eDialog, uint32_t &out_uiDialogID, PopulateTableItem *&out_pTable) const override
Definition: Plugin.h:96
virtual bool Save(XmlWriter *in_pWriter) override
Definition: Plugin.h:72
virtual bool Load(XmlReader *in_pReader) override
Definition: Plugin.h:71
virtual bool DisplayNameForProp(const char *in_pszPropertyName, char *out_pszDisplayName, uint32_t in_unCharCount) const override
Definition: Plugin.h:81
virtual bool GetSourceDuration(double &out_dblMinDuration, double &out_dblMaxDuration) const override
Definition: Plugin.h:85
virtual bool GetPluginData(const GUID &in_guidPlatform, AkPluginParamID in_idParam, DataWriter *in_pDataWriter) const override
Definition: Plugin.h:80
virtual bool DisplayNamesForPropValues(const char *in_pszPropertyName, char *out_pszValuesName, uint32_t in_unCharCount) const override
Definition: Plugin.h:82
virtual bool CopyInto(AudioPlugin *io_pWObject) const override
Definition: Plugin.h:73
virtual bool IsPlayable() const override
Definition: Plugin.h:69
virtual HINSTANCE GetResourceHandle() const override
Definition: Plugin.h:95
virtual void NotifyInnerObjectAddedRemoved(PropertySet *in_pPSet, unsigned int in_uiIndex, NotifyInnerObjectOperation in_eOperation) override
Definition: Plugin.h:77
virtual void NotifyInnerObjectPropertyChanged(PropertySet *in_pPSet, const GUID &in_guidPlatform, const char *in_pszPropertyName) override
Definition: Plugin.h:76
LicenseStatus
License status.
Definition: Utilities.h:93
virtual void Delete() override
Definition: Plugin.h:70
virtual bool WindowProc(eDialog in_eDialog, HWND in_hWnd, uint32_t in_message, WPARAM in_wParam, LPARAM in_lParam, LRESULT &out_lResult) override
Definition: Plugin.h:97
virtual void NotifyMonitorData(const MonitorData *in_pDataArray, unsigned int in_uCount, bool in_bNeedsByteSwap, bool in_bRealtime) override
Definition: Plugin.h:83
virtual void NotifyPropertyChanged(const GUID &in_guidPlatform, const char *in_pszPropertyName) override
Definition: Plugin.h:75
virtual bool GetBankParameters(const GUID &in_guidPlatform, DataWriter *in_pDataWriter) const override
Definition: Plugin.h:79
virtual LicenseStatus GetLicenseStatus(const GUID &in_guidPlatform, Severity &out_eSeverity, char *out_pszMessage, unsigned int in_uiBufferSize) const override
Definition: Plugin.h:84
virtual void NotifyCurrentPlatformChanged(const GUID &in_guidCurrentPlatform) override
Definition: Plugin.h:74
Severity
Log message severity.
Definition: Utilities.h:103