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

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