Table of Contents

Wwise SDK 2018.1.11
AkBytesMem.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: <VERSION> Build: <BUILDNUMBER>
25  Copyright (c) <COPYRIGHTYEAR> Audiokinetic Inc.
26 *******************************************************************************/
27 
28 // AkBytesMem.h
29 
30 /// \file
31 /// IReadBytes / IWriteBytes implementation on a growing memory buffer. This
32 /// version uses the AK::MemoryMgr memory pools.
33 
34 #pragma once
35 
36 #include <AK/IBytes.h>
38 
39 namespace AK
40 {
41  class ReadBytesMem
42  : public AK::IReadBytes
43  {
44  public:
45 
48  const void * in_pBytes,
49  AkInt32 in_cBytes
50  );
52 
53  // IReadBytes implementation
54 
55  AKSOUNDENGINE_API virtual bool ReadBytes(
56  void * in_pData,
57  AkInt32 in_cBytes,
58  AkInt32 & out_cRead
59  );
60 
61  // Public methods
62 
64  const void * in_pBytes,
65  AkInt32 in_cBytes
66  );
67 
68  private:
69  AkInt32 m_cBytes;
70  const AkUInt8 * m_pBytes;
71 
72  AkInt32 m_cPos;
73  };
74 
76  : public AK::IWriteBuffer
77  {
78  public:
79 
82 
83  // IWriteBytes implementation
84 
85  AKSOUNDENGINE_API virtual bool WriteBytes(
86  const void * in_pData,
87  AkInt32 in_cBytes,
88  AkInt32& out_cWritten);
89 
90  // IWriteBuffer implementation
91 
92  AKSOUNDENGINE_API virtual bool Reserve(
93  AkInt32 in_cBytes
94  );
95 
96  AKSOUNDENGINE_API virtual AkInt32 Count() const;
97 
98  AKSOUNDENGINE_API virtual void SetCount(
99  AkInt32 in_cBytes
100  );
101 
102  AKSOUNDENGINE_API virtual AkUInt8 * Bytes() const;
103 
104  AKSOUNDENGINE_API virtual AkUInt8 * Detach();
105 
106  AKSOUNDENGINE_API virtual void Clear();
107 
108  // Public methods
109 
110  AKSOUNDENGINE_API void SetMemPool( AkMemPoolId in_pool );
111 
112  private:
113  AkInt32 m_cBytes;
114  AkUInt8 * m_pBytes;
115 
116  AkInt32 m_cPos;
117 
118  AkMemPoolId m_pool;
119  };
120 }
virtual bool Reserve(AkInt32 in_cBytes)
virtual ~WriteBytesMem()
#define AKSOUNDENGINE_API
uint8_t AkUInt8
Unsigned 8-bit integer.
Definition: AkTypes.h:77
Audiokinetic namespace.
virtual void SetCount(AkInt32 in_cBytes)
Set number of bytes written.
virtual void Clear()
Clear the buffer contents.
virtual bool WriteBytes(const void *in_pData, AkInt32 in_cBytes, AkInt32 &out_cWritten)
int32_t AkInt32
Signed 32-bit integer.
Definition: AkTypes.h:92
virtual ~ReadBytesMem()
virtual bool ReadBytes(void *in_pData, AkInt32 in_cBytes, AkInt32 &out_cRead)
virtual AkUInt8 * Detach()
Return pointer to buffer and clear internal pointer.
virtual AkInt32 Count() const
virtual AkUInt8 * Bytes() const
void Attach(const void *in_pBytes, AkInt32 in_cBytes)
AkInt32 AkMemPoolId
Memory pool ID.
Definition: AkTypes.h:72
void SetMemPool(AkMemPoolId in_pool)