Version

menu_open

include/AK/SoundEngine/Common/AkBytesMem.h

Go to the documentation of this file.
00001 /*******************************************************************************
00002 The content of this file includes portions of the AUDIOKINETIC Wwise Technology
00003 released in source code form as part of the SDK installer package.
00004 
00005 Commercial License Usage
00006 
00007 Licensees holding valid commercial licenses to the AUDIOKINETIC Wwise Technology
00008 may use this file in accordance with the end user license agreement provided 
00009 with the software or, alternatively, in accordance with the terms contained in a
00010 written agreement between you and Audiokinetic Inc.
00011 
00012 Apache License Usage
00013 
00014 Alternatively, this file may be used under the Apache License, Version 2.0 (the 
00015 "Apache License"); you may not use this file except in compliance with the 
00016 Apache License. You may obtain a copy of the Apache License at 
00017 http://www.apache.org/licenses/LICENSE-2.0.
00018 
00019 Unless required by applicable law or agreed to in writing, software distributed
00020 under the Apache License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
00021 OR CONDITIONS OF ANY KIND, either express or implied. See the Apache License for
00022 the specific language governing permissions and limitations under the License.
00023 
00024   Version: <VERSION>  Build: <BUILDNUMBER>
00025   Copyright (c) <COPYRIGHTYEAR> Audiokinetic Inc.
00026 *******************************************************************************/
00027 
00028 // AkBytesMem.h
00029 
00030 /// \file 
00031 /// IReadBytes / IWriteBytes implementation on a growing memory buffer. This
00032 /// version uses the AK::MemoryMgr memory pools.
00033 
00034 #pragma once
00035 
00036 #include <AK/IBytes.h>
00037 #include <AK/SoundEngine/Common/AkSoundEngineExport.h>
00038 
00039 namespace AK
00040 {
00041     class ReadBytesMem
00042         : public AK::IReadBytes
00043     {
00044     public:
00045 
00046         AKSOUNDENGINE_API ReadBytesMem();
00047         AKSOUNDENGINE_API ReadBytesMem(
00048             const void * in_pBytes, 
00049             AkInt32 in_cBytes
00050             );
00051         AKSOUNDENGINE_API virtual ~ReadBytesMem();
00052 
00053         // IReadBytes implementation
00054 
00055         AKSOUNDENGINE_API virtual bool ReadBytes(
00056             void * in_pData, 
00057             AkInt32 in_cBytes, 
00058             AkInt32 & out_cRead
00059             );
00060 
00061         // Public methods
00062 
00063         AKSOUNDENGINE_API void Attach(
00064             const void * in_pBytes, 
00065             AkInt32 in_cBytes
00066             );
00067 
00068     private:
00069         AkInt32   m_cBytes;
00070         const AkUInt8 * m_pBytes;
00071 
00072         AkInt32   m_cPos;
00073     };
00074 
00075     class WriteBytesMem
00076         : public AK::IWriteBuffer
00077     {
00078     public:
00079     
00080         AKSOUNDENGINE_API WriteBytesMem();
00081         AKSOUNDENGINE_API virtual ~WriteBytesMem();
00082     
00083         // IWriteBytes implementation
00084 
00085         AKSOUNDENGINE_API virtual bool WriteBytes(
00086             const void * in_pData, 
00087             AkInt32 in_cBytes, 
00088             AkInt32& out_cWritten);
00089     
00090         // IWriteBuffer implementation
00091 
00092         AKSOUNDENGINE_API virtual bool Reserve(
00093             AkInt32 in_cBytes
00094             );
00095 
00096         AKSOUNDENGINE_API virtual AkInt32 Count() const;
00097 
00098         AKSOUNDENGINE_API virtual void SetCount(
00099             AkInt32 in_cBytes
00100             );
00101 
00102         AKSOUNDENGINE_API virtual AkUInt8 * Bytes() const;
00103 
00104         AKSOUNDENGINE_API virtual AkUInt8 * Detach();
00105     
00106         AKSOUNDENGINE_API virtual void Clear();
00107     
00108         // Public methods
00109 
00110         AKSOUNDENGINE_API void SetMemPool( AkMemPoolId in_pool );
00111     
00112     private:
00113         AkInt32     m_cBytes;
00114         AkUInt8 *   m_pBytes;
00115     
00116         AkInt32 m_cPos;
00117     
00118         AkMemPoolId m_pool;
00119     };
00120 }

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