Version
menu_open
link

include/AK/SpatialAudio/Common/AkSpatialAudioTypes.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 /// \file 
00029 /// Spatial audio data type definitions.
00030 
00031 #pragma once
00032 
00033 #include <AK/Tools/Common/AkKeyArray.h>
00034 #include <AK/Tools/Common/AkSet.h>
00035 #include <AK/Tools/Common/AkString.h>
00036 
00037 class AkAcousticRoom;
00038 class AkAcousticPortal;
00039 class AkImageSourceTriangle;
00040 class AkImageSourcePlane;
00041 
00042 #define AK_MAX_REFLECT_ORDER 4
00043 
00044 const AkReal32 kDefaultMaxPathLength = 100.f;
00045 
00046 extern AkMemPoolId g_SpatialAudioPoolId;
00047 
00048 AK_DEFINE_ARRAY_POOL(_ArrayPoolSpatialAudio, g_SpatialAudioPoolId);
00049 typedef AkArrayAllocatorNoAlign<_ArrayPoolSpatialAudio> ArrayPoolSpatialAudio;
00050 typedef AkArrayAllocatorAlignedSimd<_ArrayPoolSpatialAudio> ArrayPoolSpatialAudioSIMD;
00051 
00052 namespace AK
00053 {
00054     namespace SpatialAudio
00055     {
00056         typedef AkString<ArrayPoolSpatialAudio, wchar_t> WString;       ///< Wide string type for use in Wwise Spatial Audio
00057         typedef AkString<ArrayPoolSpatialAudio, AkOSChar> OsString;     ///< OS string type for use in Wwise Spatial Audio
00058         typedef AkString<ArrayPoolSpatialAudio, char> String;           ///< String type for use in Wwise Spatial Audio
00059     }
00060 }
00061 
00062 /// Base type for ID's used by Wwise spatial audio.  
00063 struct AkSpatialAudioID
00064 {
00065     /// Default constructor.  Creates an invalid ID.
00066     AkSpatialAudioID() : id((AkUInt64)-1) {}
00067     
00068     /// Construct from a 64-bit int.
00069     AkSpatialAudioID(AkUInt64 _id) : id(_id) {}
00070 
00071     /// Conversion from a pointer to a AkSpatialAudioID
00072     explicit AkSpatialAudioID(const void * ptr) : id(reinterpret_cast<AkUInt64>(ptr)) {}
00073 
00074     bool operator == (AkSpatialAudioID rhs) const { return id == rhs.id; }
00075     bool operator != (AkSpatialAudioID rhs) const { return id != rhs.id; }
00076     bool operator < (AkSpatialAudioID rhs) const { return id < rhs.id; }
00077     bool operator > (AkSpatialAudioID rhs) const { return id > rhs.id; }
00078     bool operator <= (AkSpatialAudioID rhs) const { return id <= rhs.id; }
00079     bool operator >= (AkSpatialAudioID rhs) const { return id >= rhs.id; }
00080 
00081     /// Determine if this ID is valid.
00082     bool IsValid() const { return id != (AkUInt64)-1; }
00083 
00084     /// Conversion function used internally to convert from a AkSpatialAudioID to a AkGameObjectID.
00085     AkGameObjectID AsGameObjectID() const { return (AkGameObjectID)id; }
00086     
00087     AkUInt64 id;
00088 };
00089 
00090 /// Spatial Audio Room ID type.  This ID type exists in the same ID-space as game object ID's.  The client is responsible for not choosing room ID's
00091 /// that conflict with registered game objects' ID's.  Internally, the spatial audio rooms and portals API manages registration and un-registration of game objects that 
00092 /// represent rooms using AkRoomID's provided by the client; AkRoomID's are convertied to AkGameObjectID's by calling AsGameObjectID(). 
00093 /// \sa 
00094 /// - \ref AK::SpatialAudio::AddRoom
00095 /// - \ref AK::SpatialAudio::RemoveRoom
00096 struct AkRoomID : public AkSpatialAudioID
00097 {
00098     /// A game object ID that is in the reserved range, used for 'outdoor' rooms, ie when not in a room.
00099     static const AkGameObjectID OutdoorsGameObjID = (AkGameObjectID)-4;
00100 
00101     /// Default constructor.  Creates an invalid ID.
00102     AkRoomID() : AkSpatialAudioID() {}
00103 
00104     /// Construct from a 64-bit int.
00105     AkRoomID(AkUInt64 _id) : AkSpatialAudioID(_id) {}
00106 
00107     /// Conversion from a pointer to a AkRoomID
00108     explicit AkRoomID(const void * ptr) : AkSpatialAudioID(ptr) {}
00109 
00110     /// Conversion function used internally to convert AkRoomID's to AkGameObjectIDs.
00111     AkGameObjectID AsGameObjectID() const { return IsValid() ? (AkGameObjectID)id : OutdoorsGameObjID; }
00112 };
00113 
00114 ///< Unique ID for portals.  This ID type exists in the same ID-space as game object ID's.  The client is responsible for not choosing portal ID's
00115 /// that conflict with registered game objects' ID's.  Internally, the spatial audio rooms and portals API manages registration and un-registration of game objects that 
00116 /// represent portals using AkPortalID's provided by the client; AkPortalID's are convertied to AkGameObjectID's by calling AsGameObjectID(). 
00117 /// \sa 
00118 /// - \ref AK::SpatialAudio::AddPortal
00119 /// - \ref AK::SpatialAudio::RemovePortal  
00120 typedef AkSpatialAudioID AkPortalID;        
00121 
00122 ///< Unique ID for identifying geometry sets.  Chosen by the client using any means desired.  
00123 /// \sa 
00124 /// - \ref AK::SpatialAudio::AddGeometrySet
00125 /// - \ref AK::SpatialAudio::RemoveGeometrySet
00126 typedef AkSpatialAudioID AkGeometrySetID;

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