Version
menu_open
link
Wwise SDK 2021.1.14
MediaConverter.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  Version: v2021.1.14 Build: 6590
25  Copyright (c) 2006-2023 Audiokinetic Inc.
26 *******************************************************************************/
27 
28 /**
29  * \brief Wwise Authoring Plug-ins - API to convert used object medias to a
30  * format usable by the plug-in's Sound Engine part.
31  * \file AK/Wwise/Plugin/MediaConverter.h
32  */
33 
34 #pragma once
35 
36 #include "PluginInfoGenerator.h"
37 
38 /**
39  * \brief API to convert used object medias to a format usable by the plug-in's Sound Engine part.
40  */
42 #ifdef __cplusplus
44 #endif
45 {
46 #ifndef __cplusplus
47  ak_wwise_plugin_base_interface m_baseInterface;
48 #endif
49 
50 #ifdef __cplusplus
51  /// Base instance type for providing custom media conversion.
53 
56  {}
57 #endif
58 
59  /**
60  * \brief Converts a file.
61  *
62  * \aknote If the conversion failed the function is responsible for deleting any files that may have been
63  * created, even the destination file in case of error. If the function returns false we will use the
64  * string put in io_pError to display an error message.
65  *
66  * \param[in] in_this Current instance of this interface.
67  * \param[in] in_guidPlatform The unique ID of the custom platform being converted for.
68  * \param[in] in_basePlatform The unique ID of the base platform being converted for.
69  * \param[in] in_szSourceFile Source File to convert data from.
70  * \param[in] in_szDestFile Destination File, must be created by the plug-in.
71  * \param[in] in_uSampleRate The target sample rate for the converted file, passing 0 will default to
72  * the platform default.
73  * \param[in] in_uBlockLength The block length, passing 0 will default to the platform default.
74  * \param[in] in_pProgress Optional Progress Bar controller.
75  * \param io_pError Optional error string that can be displayed if ConversionResult is not successful.
76  * \result Whether the conversion was successful or not.
77  */
79  const struct ak_wwise_plugin_media_converter_instance_v1* in_this,
80  const GUID* in_guidPlatform,
81  const BasePlatformID* in_basePlatform,
82  const AkOSChar * in_szSourceFile,
83  const AkOSChar * in_szDestFile,
84  AkUInt32 in_uSampleRate,
85  AkUInt32 in_uBlockLength,
86  AK::Wwise::Plugin::IProgress* in_pProgress,
88  );
89 
90  /**
91  * \brief Calculates the conversion setting's hash.
92  *
93  * The goal of this function is to return a value that can be used to indicate whether the plug-in information changed
94  * between two conversion requests. Each time a SoundBank generation is done, that value is stored, and if it's
95  * different from the previous one, or if the file changed, a new ConvertFile will be called.
96  *
97  * \param[in] in_this Current instance of this interface.
98  * \param[in] in_guidPlatform The unique ID of the custom platform for which the conversion is being done.
99  * \param[in] in_uSampleRate The target sample rate for the converted file, passing 0 will default to
100  * the platform default.
101  * \param[in] in_uBlockLength The block length, passing 0 will default to the platform default.
102  * \return A hash value for all the plug-in parameters.
103  */
105  const struct ak_wwise_plugin_media_converter_instance_v1* in_this,
106  const GUID* in_guidPlatform,
107  AkUInt32 in_uSampleRate,
108  AkUInt32 in_uBlockLength
109  );
110 };
111 #define AK_WWISE_PLUGIN_MEDIA_CONVERTER_V1_ID() \
112  AK_WWISE_PLUGIN_BASE_INTERFACE_FROM_ID(AK_WWISE_PLUGIN_INTERFACE_TYPE_MEDIA_CONVERTER, 1)
113 #define AK_WWISE_PLUGIN_MEDIA_CONVERTER_V1_CTOR(/* ak_wwise_plugin_info* */ in_pluginInfo, /* void* */ in_data) \
114 { \
115  .m_baseInterface = AK_WWISE_PLUGIN_BASE_INTERFACE_CTOR(AK_WWISE_PLUGIN_MEDIA_CONVERTER_V1_ID(), in_pluginInfo, in_data) \
116 }
117 
118 
119 #ifdef __cplusplus
120 namespace AK::Wwise::Plugin
121 {
122  namespace V1
123  {
126  {
127  public:
128  /**
129  * \brief The interface type, as provided by this plug-in.
130  */
131  enum : InterfaceTypeValue
132  {
133  /**
134  * \brief The interface type, as provided by this plug-in.
135  */
137  };
138  /**
139  * \brief The interface version, as provided by this plug-in.
140  */
141  enum : InterfaceVersion
142  {
143  /**
144  * \brief The interface version, as provided by this plug-in.
145  */
147  };
148 
149  /**
150  * \brief The C interface, fulfilled by your plug-in.
151  */
152  struct Interface : public CMediaConverter
153  {
156  {
157  CMediaConverter::ConvertFile = [](const struct ak_wwise_plugin_media_converter_instance_v1* in_this, const GUID* in_guidPlatform, const BasePlatformID* in_basePlatform, const AkOSChar * in_szSourceFile, const AkOSChar * in_szDestFile, AkUInt32 in_uSampleRate, AkUInt32 in_uBlockLength, IProgress* in_pProgress, IWriteString* io_pError)
158  { return (ConversionResult)static_cast<const Instance*>(in_this)->ConvertFile(*in_guidPlatform, *in_basePlatform, in_szSourceFile, in_szDestFile, in_uSampleRate, in_uBlockLength, in_pProgress, io_pError); };
159  CMediaConverter::GetCurrentConversionSettingsHash = [](const struct ak_wwise_plugin_media_converter_instance_v1* in_this, const GUID* in_guidPlatform, AkUInt32 in_uSampleRate, AkUInt32 in_uBlockLength)
160  { return (uint32_t)static_cast<const Instance*>(in_this)->GetCurrentConversionSettingsHash(*in_guidPlatform, in_uSampleRate, in_uBlockLength); };
161  }
162  };
163 
165  static Interface g_interface;
166  return &g_interface;
167  }
169  return this;
170  }
172  return this;
173  }
174 
176  CMediaConverter::Instance()
177  {
178  }
179 
180  virtual ~MediaConverter() {}
181 
182  /**
183  * \brief Converts a file.
184  *
185  * \aknote If the conversion failed the function is responsible for deleting any files that may have been
186  * created, even the destination file in case of error. If the function returns false we will use the
187  * string put in io_pError to display an error message.
188  *
189  * \param[in] in_guidPlatform The unique ID of the custom platform being converted for.
190  * \param[in] in_basePlatform The unique ID of the base platform being converted for.
191  * \param[in] in_szSourceFile Source file to convert data from.
192  * \param[in] in_szDestFile Destination file, must be created by the plug-in.
193  * \param[in] in_uSampleRate The target sample rate for the converted file, passing 0 will default to
194  * the platform default.
195  * \param[in] in_uBlockLength The block length, passing 0 will default to the platform default.
196  * \param[in] in_pProgress Optional Progress Bar controller.
197  * \param io_pError Optional error string that can be displayed if ConversionResult is not successful.
198  * \result Whether the conversion was successful or not.
199  */
201  const GUID& in_guidPlatform,
202  const BasePlatformID& in_basePlatform,
203  const AkOSChar * in_szSourceFile,
204  const AkOSChar * in_szDestFile,
205  AkUInt32 in_uSampleRate,
206  AkUInt32 in_uBlockLength,
207  IProgress* in_pProgress,
208  IWriteString* io_pError
209  ) const = 0;
210 
211  /**
212  * \brief Calculates the conversion setting's hash.
213  *
214  * The goal of this function is to return a value that can be used to indicate whether the plug-in information changed
215  * between two conversion requests. Each time a SoundBank generation is done, that value is stored, and if it's
216  * different from the previous one, or if the file changed, a new ConvertFile will be called.
217  *
218  * \param[in] in_guidPlatform The unique ID of the custom platform for which the conversion is being done.
219  * \param[in] in_uSampleRate The target sample rate for the converted file, passing 0 will default to
220  * the platform default.
221  * \param[in] in_uBlockLength The block length, passing 0 will default to the platform default.
222  * \return A hash value for all the plug-in parameters.
223  */
225  const GUID& in_guidPlatform,
226  AkUInt32 in_uSampleRate = 0,
227  AkUInt32 in_uBlockLength = 0
228  ) const = 0;
229  };
230  } // of namespace V1
231 
232  /// Latest version of the C MediaConverter interface.
234  /// Latest version of the C++ MediaConverter interface.
236 
239 } // of namespace AK::Wwise::Plugin
240 
241 #endif
uint32_t(* GetCurrentConversionSettingsHash)(const struct ak_wwise_plugin_media_converter_instance_v1 *in_this, const GUID *in_guidPlatform, AkUInt32 in_uSampleRate, AkUInt32 in_uBlockLength)
Calculates the conversion setting's hash.
Definition: MediaConverter.h:104
V1::MediaConverter MediaConverter
Latest version of the C++ MediaConverter interface.
Definition: MediaConverter.h:235
The C interface, fulfilled by your plug-in.
Definition: MediaConverter.h:153
API to convert used object medias to a format usable by the plug-in's Sound Engine part.
Definition: MediaConverter.h:45
decltype(BaseInterface::m_version) InterfaceVersion
PluginInfoGenerator: Type for the m_version value in BaseInterface.
Base instance type for providing custom media conversion through ak_wwise_plugin_media_converter_v1.
Definition: PluginDef.h:786
const CMediaConverter::Instance * GetInstancePointer() const
Definition: MediaConverter.h:171
char AkOSChar
Generic character string.
Definition: AkTypes.h:68
virtual ConversionResult ConvertFile(const GUID &in_guidPlatform, const BasePlatformID &in_basePlatform, const AkOSChar *in_szSourceFile, const AkOSChar *in_szDestFile, AkUInt32 in_uSampleRate, AkUInt32 in_uBlockLength, IProgress *in_pProgress, IWriteString *io_pError) const =0
Converts a file.
AK::Wwise::Plugin::ConversionResult(* ConvertFile)(const struct ak_wwise_plugin_media_converter_instance_v1 *in_this, const GUID *in_guidPlatform, const BasePlatformID *in_basePlatform, const AkOSChar *in_szSourceFile, const AkOSChar *in_szDestFile, AkUInt32 in_uSampleRate, AkUInt32 in_uBlockLength, AK::Wwise::Plugin::IProgress *in_pProgress, AK::Wwise::Plugin::IWriteString *io_pError)
Converts a file.
Definition: MediaConverter.h:78
Wwise Authoring Plug-ins - C++ class helper to automatically determine the plug-in interfaces used in...
CInterfacePtr InterfacePtr
Definition: PluginDef.h:968
CMediaConverter::Instance * GetInstancePointer()
Definition: MediaConverter.h:168
@ k_interfaceVersion
The interface version, as provided by this plug-in.
Definition: MediaConverter.h:146
ConversionResult
Conversion error code.
Definition: PluginDef.h:142
std::underlying_type< InterfaceType >::type InterfaceTypeValue
PluginInfoGenerator: Underlying storage type for the m_interface value in BaseInterface.
ak_wwise_plugin_media_converter_v1 CMediaConverter
Definition: MediaConverter.h:124
AK_WWISE_PLUGIN_SPECIALIZE_INTERFACE_VERSION(AudioPlugin)
Interface description and base class for every Wwise Authoring plug-in interface.
uint32_t AkUInt32
Unsigned 32-bit integer.
Definition: AkTypes.h:59
virtual uint32_t GetCurrentConversionSettingsHash(const GUID &in_guidPlatform, AkUInt32 in_uSampleRate=0, AkUInt32 in_uBlockLength=0) const =0
Calculates the conversion setting's hash.
@ k_interfaceType
The interface type, as provided by this plug-in.
Definition: MediaConverter.h:136
@ AK_WWISE_PLUGIN_INTERFACE_TYPE_MEDIA_CONVERTER
2021.1 Media Converter backend part. ak_wwise_plugin_media_converter_v1
AK_WWISE_PLUGIN_SPECIALIZE_INTERFACE_CLASS(AudioPlugin)
Definition: PluginHelpers.h:46

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