sfxFMODEventGroup.h
Engine/source/sfx/fmod/sfxFMODEventGroup.h
Classes:
class
Detailed Description
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 GarageGames, LLC 4// 5// Permission is hereby granted, free of charge, to any person obtaining a copy 6// of this software and associated documentation files (the "Software"), to 7// deal in the Software without restriction, including without limitation the 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 9// sell copies of the Software, and to permit persons to whom the Software is 10// furnished to do so, subject to the following conditions: 11// 12// The above copyright notice and this permission notice shall be included in 13// all copies or substantial portions of the Software. 14// 15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS 21// IN THE SOFTWARE. 22//----------------------------------------------------------------------------- 23 24#ifndef _SFXFMODEVENTGROUP_H_ 25#define _SFXFMODEVENTGROUP_H_ 26 27#ifndef _SIMDATABLOCK_H_ 28 #include "console/simDatablock.h" 29#endif 30#ifndef _TVECTOR_H_ 31 #include "core/util/tVector.h" 32#endif 33#ifndef _CONSOLETYPES_H_ 34 #include "console/consoleTypes.h" 35#endif 36 37#include "fmod_event.h" 38 39 40class SFXFMODProject; 41class SFXFMODEvent; 42 43 44/// 45class SFXFMODEventGroup : public SimDataBlock 46{ 47 public: 48 49 typedef SimDataBlock Parent; 50 friend class SFXFMODProject; 51 friend class SFXFMODEvent; // mHandle 52 friend class SFXFMODEventSource; // mHandle 53 54 protected: 55 56 /// 57 String mName; 58 59 /// 60 U32 mNumEvents; 61 62 /// 63 U32 mNumGroups; 64 65 /// 66 SFXFMODProject* mProject; 67 68 /// 69 SFXFMODEventGroup* mParent; 70 71 /// 72 SFXFMODEventGroup* mChildren; 73 74 /// 75 SFXFMODEventGroup* mSibling; 76 77 /// 78 SFXFMODEvent* mEvents; 79 80 /// 81 FMOD_EVENTGROUP* mHandle; 82 83 /// 84 U32 mLoadCount; 85 86 /// Project ID for client net sync. 87 S32 mParentId; 88 89 /// Project ID for client net sync. 90 S32 mProjectId; 91 92 /// 93 void _load(); 94 95 /// 96 void _addEvent( SFXFMODEvent* event ); 97 98 /// 99 void _addGroup( SFXFMODEventGroup* group ); 100 101 /// 102 void _removeEvent( SFXFMODEvent* event ); 103 104 /// 105 void _removeGroup( SFXFMODEventGroup* group ); 106 107 public: 108 109 /// 110 SFXFMODEventGroup(); 111 112 /// 113 SFXFMODEventGroup( SFXFMODProject* project, const String& name, SFXFMODEventGroup* parent = NULL ); 114 115 /// 116 SFXFMODEventGroup( SFXFMODProject* project, FMOD_EVENTGROUP* handle, SFXFMODEventGroup* parent = NULL ); 117 118 ~SFXFMODEventGroup(); 119 120 /// Create the event group object on the FMOD device. 121 void acquire( bool recursive = false ); 122 123 /// Release the event group object on the FMOD device. 124 void release(); 125 126 /// 127 const String& getGroupName() const { return mName; } 128 129 /// 130 String getQualifiedName() const; 131 132 /// 133 SFXFMODProject* getProject() const { return mProject; } 134 135 /// Return true if the event data for this group has been loaded. 136 bool isDataLoaded() const; 137 138 /// Load the event data for this group. 139 /// 140 /// @note Loading is reference-counted. 141 bool loadData( bool samples = true, bool streams = true ); 142 143 /// 144 void freeData( bool force = false ); 145 146 // SimDataBlock. 147 virtual bool onAdd(); 148 virtual void onRemove(); 149 virtual bool preload( bool server, String& errorStr ); 150 virtual void packData( BitStream* stream ); 151 virtual void unpackData( BitStream* stream ); 152 153 static void initPersistFields(); 154 155 DECLARE_CONOBJECT( SFXFMODEventGroup ); 156 DECLARE_CATEGORY( "SFX FMOD" ); 157 DECLARE_DESCRIPTION( "An event group in an FMOD Designer project." ); 158}; 159 160#endif // !_SFXFMODEVENTGROUP_H_ 161