Version

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

Cette page a-t-elle été utile ?

Besoin d'aide ?

Des questions ? Des problèmes ? Besoin de plus d'informations ? Contactez-nous, nous pouvons vous aider !

Visitez notre page d'Aide

Décrivez-nous de votre projet. Nous sommes là pour vous aider.

Enregistrez votre projet et nous vous aiderons à démarrer sans aucune obligation !

Partir du bon pied avec Wwise