Version
menu_open
link
Wwise SDK 2022.1.11
HostDataWriter.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 write data that can be converted for the target platform.
29  * \file AK/Wwise/Plugin/HostDataWriter.h
30  */
31 
32 #pragma once
33 
34 #include "PluginInfoGenerator.h"
35 
36 /**
37  * \brief Interface used to write data during sound bank generation.
38  *
39  * \aknote
40  * All functions perform the appropriate platform-specific byte reordering, except where noted.
41  * \endaknote
42  *
43  * \sa
44  * - \ref wwiseplugin_bank
45  * - AK::Wwise::Plugin::Plugin::GetBankParameters()
46  */
48 #ifdef __cplusplus
50 #endif
51 {
52 #ifndef __cplusplus
53  ak_wwise_plugin_base_interface m_baseInterface;
54 #endif
55 
56 #ifdef __cplusplus
57  /// Base host-provided instance type for ak_wwise_plugin_host_data_writer_v1.
59 
62  {}
63 #endif
64 
65  /**
66  * \brief Writes a block of data.
67  *
68  * \akcaution
69  * This data will always be written as-is, with no platform-specific conversion.
70  * \endakcaution
71  *
72  * \param[in] in_this Current instance of this interface.
73  * \param[in] in_pData A pointer to the buffer containing the data to be written.
74  * \param[in] in_cBytes The number of bytes to write.
75  * \param[out] out_cWritten The number of bytes actually written.
76  * \return true if successful.
77  */
78  bool(*WriteData)(
80  const void* in_pData,
81  uint32_t in_cBytes,
82  uint32_t* out_cWritten
83  );
84 
85  /**
86  * \brief Writes a string.
87  *
88  * \param[in] in_this Current instance of this interface.
89  * \param[in] in_szString The string to be written (null-terminated).
90  * \return true if successful.
91  */
92  bool(*WriteString)(
94  const char * in_szString
95  );
96 
97  /**
98  * \brief Writes a 64-bit signed integer value.
99  *
100  * \param[in] in_this Current instance of this interface.
101  * \param[in] in_value The value to be written.
102  * \return true if successful.
103  */
104  bool(*WriteInt64)(
106  int64_t in_value
107  );
108 
109  /**
110  * \brief Writes a 32-bit signed integer value.
111  *
112  * \param[in] in_this Current instance of this interface.
113  * \param[in] in_value The value to be written.
114  * \return true if successful.
115  */
116  bool(*WriteInt32)(
118  int32_t in_value
119  );
120 
121  /**
122  * \brief Writes a 16-bit signed integer value.
123  *
124  * \param[in] in_this Current instance of this interface.
125  * \param[in] in_value The value to be written.
126  * \return true if successful.
127  */
128  bool(*WriteInt16)(
130  int16_t in_value
131  );
132 
133  /**
134  * \brief Writes an 8-bit signed integer value.
135  *
136  * \param[in] in_this Current instance of this interface.
137  * \param[in] in_value The value to be written.
138  * \return true if successful.
139  */
140  bool(*WriteInt8)(
142  int8_t in_value
143  );
144 
145  /**
146  * \brief Writes a 64-bit unsigned integer value.
147  *
148  * \param[in] in_this Current instance of this interface.
149  * \param[in] in_value The value to be written.
150  * \return true if successful.
151  */
152  bool(*WriteUInt64)(
154  uint64_t in_value
155  );
156 
157  /**
158  * \brief Writes a 32-bit unsigned integer value.
159  *
160  * \param[in] in_this Current instance of this interface.
161  * \param[in] in_value The value to be written.
162  * \return true if successful.
163  */
164  bool(*WriteUInt32)(
166  uint32_t in_value
167  );
168 
169  /**
170  * \brief Writes a 16-bit unsigned integer value.
171  *
172  * \param[in] in_this Current instance of this interface.
173  * \param[in] in_value The value to be written.
174  * \return true if successful.
175  */
176  bool(*WriteUInt16)(
178  uint16_t in_value
179  );
180 
181  /**
182  * \brief Writes an 8-bit unsigned integer value.
183  *
184  * \param[in] in_this Current instance of this interface.
185  * \param[in] in_value The value to be written.
186  * \return true if successful.
187  */
188  bool(*WriteUInt8)(
190  uint8_t in_value
191  );
192 
193  /**
194  * \brief Writes a 64-bit, double-precision floating point value.
195  *
196  * \param[in] in_this Current instance of this interface.
197  * \param[in] in_value The value to be written.
198  * \return true if successful.
199  */
200  bool(*WriteReal64)(
202  double in_value
203  );
204 
205  /**
206  * \brief Writes a 32-bit, single-precision floating point value.
207  *
208  * \param[in] in_this Current instance of this interface.
209  * \param[in] in_value The value to be written.
210  * \return true if successful.
211  */
212  bool(*WriteReal32)(
214  float in_value
215  );
216 
217  /**
218  * \brief Writes a boolean value.
219  *
220  * \param[in] in_this Current instance of this interface.
221  * \param[in] in_value The boolean to be written.
222  * \return true if successful.
223  */
224  bool(*WriteBool)(
226  bool in_value
227  );
228 };
229 #define AK_WWISE_PLUGIN_HOST_WRITE_V1_ID() \
230  AK_WWISE_PLUGIN_BASE_INTERFACE_FROM_ID(AK_WWISE_PLUGIN_INTERFACE_TYPE_HOST_DATA_WRITER, 1)
231 #define AK_WWISE_PLUGIN_HOST_WRITE_V1_CTOR() \
232 { \
233  .m_baseInterface = AK_WWISE_PLUGIN_HOST_WRITE_V1_ID() \
234 }
235 
236 #ifdef __cplusplus
237 namespace AK::Wwise::Plugin
238 {
239  namespace V1
240  {
242 
243  /// \copydoc ak_wwise_plugin_host_data_writer_v1
244  class DataWriter : public CBaseInstanceGlue<CHostDataWriter>
245  {
246  public:
248 
249  /**
250  * \brief The interface type, as requested by this plug-in.
251  */
252  enum : InterfaceTypeValue
253  {
254  /**
255  * \brief The interface type, as requested by this plug-in.
256  */
258  };
259  /**
260  * \brief The interface version, as requested by this plug-in.
261  */
262  enum : InterfaceVersion
263  {
264  /**
265  * \brief The interface version, as requested by this plug-in.
266  */
268  };
269 
270  /**
271  * \brief Writes a block of data.
272  *
273  * \akcaution
274  * This data will always be written as-is, with no platform-specific conversion.
275  * \endakcaution
276  *
277  * \param[in] in_pData A pointer to the buffer containing the data to be written.
278  * \param[in] in_cBytes The number of bytes to write.
279  * \param[out] out_cWritten The number of bytes actually written.
280  * \return true if successful.
281  */
282  inline bool WriteData(
283  const void* in_pData,
284  uint32_t in_cBytes,
285  uint32_t& out_cWritten
286  )
287  {
288  return MKBOOL(g_cinterface->WriteData(this, in_pData, in_cBytes, &out_cWritten));
289  }
290 
291  /**
292  * \brief Writes a string.
293  *
294  * \param[in] in_szString The string to be written (null-terminated).
295  * \return true if successful.
296  */
297  inline bool WriteString(
298  const char * in_szString
299  )
300  {
301  return MKBOOL(g_cinterface->WriteString(this, in_szString));
302  }
303 
304  /**
305  * \brief Writes a 64-bit signed integer value.
306  *
307  * \param[in] in_value The value to be written.
308  * \return true if successful.
309  */
310  inline bool WriteInt64(
311  int64_t in_value
312  )
313  {
314  return MKBOOL(g_cinterface->WriteInt64(this, in_value));
315  }
316 
317  /**
318  * \brief Writes a 32-bit signed integer value.
319  *
320  * \param[in] in_value The value to be written.
321  * \return true if successful.
322  */
323  inline bool WriteInt32(
324  int32_t in_value
325  )
326  {
327  return MKBOOL(g_cinterface->WriteInt32(this, in_value));
328  }
329 
330  /**
331  * \brief Writes a 16-bit signed integer value.
332  *
333  * \param[in] in_value The value to be written.
334  * \return true if successful.
335  */
336  inline bool WriteInt16(
337  int16_t in_value
338  )
339  {
340  return MKBOOL(g_cinterface->WriteInt16(this, in_value));
341  }
342 
343  /**
344  * \brief Writes an 8-bit signed integer value.
345  *
346  * \param[in] in_value The value to be written.
347  * \return true if successful.
348  */
349  inline bool WriteInt8(
350  int8_t in_value
351  )
352  {
353  return MKBOOL(g_cinterface->WriteInt8(this, in_value));
354  }
355 
356  /**
357  * \brief Writes a 64-bit unsigned integer value.
358  *
359  * \param[in] in_value The value to be written.
360  * \return true if successful.
361  */
362  inline bool WriteUInt64(
363  uint64_t in_value
364  )
365  {
366  return MKBOOL(g_cinterface->WriteUInt64(this, in_value));
367  }
368 
369  /**
370  * \brief Writes a 32-bit unsigned integer value.
371  *
372  * \param[in] in_value The value to be written.
373  * \return true if successful.
374  */
375  inline bool WriteUInt32(
376  uint32_t in_value
377  )
378  {
379  return MKBOOL(g_cinterface->WriteUInt32(this, in_value));
380  }
381 
382  /**
383  * \brief Writes a 16-bit unsigned integer value.
384  *
385  * \param[in] in_value The value to be written.
386  * \return true if successful.
387  */
388  inline bool WriteUInt16(
389  uint16_t in_value
390  )
391  {
392  return MKBOOL(g_cinterface->WriteUInt16(this, in_value));
393  }
394 
395  /**
396  * \brief Writes an 8-bit unsigned integer value.
397  *
398  * \param[in] in_value The value to be written.
399  * \return true if successful.
400  */
401  inline bool WriteUInt8(
402  uint8_t in_value
403  )
404  {
405  return MKBOOL(g_cinterface->WriteUInt8(this, in_value));
406  }
407 
408  /**
409  * \brief Writes a 64-bit, double-precision floating point value.
410  *
411  * \param[in] in_value The value to be written.
412  * \return true if successful.
413  */
414  inline bool WriteReal64(
415  double in_value
416  )
417  {
418  return MKBOOL(g_cinterface->WriteReal64(this, in_value));
419  }
420 
421  /**
422  * \brief Writes a 32-bit, single-precision floating point value.
423  *
424  * \param[in] in_value The value to be written.
425  * \return true if successful.
426  */
427  inline bool WriteReal32(
428  float in_value
429  )
430  {
431  return MKBOOL(g_cinterface->WriteReal32(this, in_value));
432  }
433 
434  /**
435  * \brief Writes a boolean value.
436  *
437  * \param[in] in_value The boolean to be written.
438  * \return true if successful.
439  */
440  inline bool WriteBool(
441  bool in_value
442  )
443  {
444  return MKBOOL(g_cinterface->WriteBool(this, in_value));
445  }
446  };
447 
448  /**
449  * \brief Requests a DataWriter interface.
450  *
451  * Deriving your plug-in class from RequestConversionHelpers will automatically request
452  * DataWriter interface. This is useful for SoundBank generation and parameter
453  * passing to the Sound Engine. You must derive from this interface in order to use the
454  * provided functions.
455  *
456  * \aknote The AK::Wwise::Plugin::RequestPropertySet and AK::Wwise::Plugin::RequestWrite classes are
457  * automatically derived when providing AK::Wwise::Plugin::AudioPlugin in C++. \endaknote
458  */
460 
461  } // of namespace V1
462 
463  /// Latest version of the C DataWriter interface.
465  /// Latest version of the C++ DataWriter interface.
467  /// Latest version of the requested C++ DataWriter interface.
469 
473 } // of namespace AK::Wwise::Plugin
474 
475 #endif
Interface used to write data during sound bank generation.
@ k_interfaceType
The interface type, as requested by this plug-in.
Interface used to write data during sound bank generation.
bool WriteInt64(int64_t in_value)
Writes a 64-bit signed integer value.
@ AK_WWISE_PLUGIN_INTERFACE_TYPE_HOST_DATA_WRITER
2021.1 Data Writer host service. ak_wwise_plugin_host_data_writer_v1
bool(* WriteInt8)(struct ak_wwise_plugin_host_data_writer_instance_v1 *in_this, int8_t in_value)
Writes an 8-bit signed integer value.
static GluedInterface * g_cinterface
The unique instance of the CInterface interface. Defined at nullptr first, overridden by the Host onc...
bool(* WriteReal64)(struct ak_wwise_plugin_host_data_writer_instance_v1 *in_this, double in_value)
Writes a 64-bit, double-precision floating point value.
bool WriteData(const void *in_pData, uint32_t in_cBytes, uint32_t &out_cWritten)
Writes a block of data.
decltype(BaseInterface::m_version) InterfaceVersion
PluginInfoGenerator: Type for the m_version value in BaseInterface.
bool WriteReal64(double in_value)
Writes a 64-bit, double-precision floating point value.
bool(* WriteInt32)(struct ak_wwise_plugin_host_data_writer_instance_v1 *in_this, int32_t in_value)
Writes a 32-bit signed integer value.
bool(* WriteUInt16)(struct ak_wwise_plugin_host_data_writer_instance_v1 *in_this, uint16_t in_value)
Writes a 16-bit unsigned integer value.
bool WriteReal32(float in_value)
Writes a 32-bit, single-precision floating point value.
V1::DataWriter DataWriter
Latest version of the C++ DataWriter interface.
Base host-provided instance type for ak_wwise_plugin_host_data_writer_v1.
Definition: PluginDef.h:618
bool(* WriteInt64)(struct ak_wwise_plugin_host_data_writer_instance_v1 *in_this, int64_t in_value)
Writes a 64-bit signed integer value.
bool(* WriteReal32)(struct ak_wwise_plugin_host_data_writer_instance_v1 *in_this, float in_value)
Writes a 32-bit, single-precision floating point value.
bool(* WriteUInt8)(struct ak_wwise_plugin_host_data_writer_instance_v1 *in_this, uint8_t in_value)
Writes an 8-bit unsigned integer value.
bool WriteInt8(int8_t in_value)
Writes an 8-bit signed integer value.
ak_wwise_plugin_host_data_writer_v1 CHostDataWriter
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....
bool WriteString(const char *in_szString)
Writes a string.
bool WriteInt32(int32_t in_value)
Writes a 32-bit signed integer value.
bool WriteUInt64(uint64_t in_value)
Writes a 64-bit unsigned integer value.
bool WriteInt16(int16_t in_value)
Writes a 16-bit signed integer value.
std::underlying_type< InterfaceType >::type InterfaceTypeValue
PluginInfoGenerator: Underlying storage type for the m_interface value in BaseInterface.
bool(* WriteString)(struct ak_wwise_plugin_host_data_writer_instance_v1 *in_this, const char *in_szString)
Writes a string.
bool WriteBool(bool in_value)
Writes a boolean value.
AK_WWISE_PLUGIN_SPECIALIZE_INTERFACE_VERSION(AudioPlugin)
#define AK_WWISE_PLUGIN_SPECIALIZE_HOST_INTERFACE_NO_BASE_INSTANCE(in_name, in_varname)
PluginInfoGenerator: Creates a C++ host specialization for interface class specified in in_name.
@ k_interfaceVersion
The interface version, as requested by this plug-in.
bool(* WriteBool)(struct ak_wwise_plugin_host_data_writer_instance_v1 *in_this, bool in_value)
Writes a boolean value.
Interface description and base class for every Wwise Authoring plug-in interface.
bool WriteUInt16(uint16_t in_value)
Writes a 16-bit unsigned integer value.
#define MKBOOL(cond)
Definition: PluginHelpers.h:74
RequestedHostInterface< DataWriter > RequestWrite
Requests a DataWriter interface.
bool(* WriteInt16)(struct ak_wwise_plugin_host_data_writer_instance_v1 *in_this, int16_t in_value)
Writes a 16-bit signed integer value.
bool WriteUInt8(uint8_t in_value)
Writes an 8-bit unsigned integer value.
bool(* WriteUInt32)(struct ak_wwise_plugin_host_data_writer_instance_v1 *in_this, uint32_t in_value)
Writes a 32-bit unsigned integer value.
AK_WWISE_PLUGIN_SPECIALIZE_INTERFACE_CLASS(AudioPlugin)
bool WriteUInt32(uint32_t in_value)
Writes a 32-bit unsigned integer value.
bool(* WriteUInt64)(struct ak_wwise_plugin_host_data_writer_instance_v1 *in_this, uint64_t in_value)
Writes a 64-bit unsigned integer value.
bool(* WriteData)(struct ak_wwise_plugin_host_data_writer_instance_v1 *in_this, const void *in_pData, uint32_t in_cBytes, uint32_t *out_cWritten)
Writes a block of data.

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