sfxFMODEvent.h
Engine/source/sfx/fmod/sfxFMODEvent.h
Classes:
class
An event in an FMOD Designer project.
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 _SFXFMODEVENT_H_ 25#define _SFXFMODEVENT_H_ 26 27#ifndef _SFXTRACK_H_ 28 #include "sfx/sfxTrack.h" 29#endif 30#ifndef _CONSOLETYPES_H_ 31 #include "console/consoleTypes.h" 32#endif 33#ifndef _MPOINT2_H_ 34 #include "math/mPoint2.h" 35#endif 36 37#include "fmod_event.h" 38 39 40class SFXFMODProject; 41class SFXFMODEventGroup; 42 43 44/// An event in an FMOD Designer project. 45/// 46/// This class must not be manually instanced by the user. Instead, SFXFMODEvents 47/// are automatically created when an SFXFMODProject is loaded. 48/// 49/// Be aware that as all the playback happens internally within FMOD's event system, 50/// this bypasses the SFX layer and will thus not work with features that rely the 51/// structures there. Namely, sound occlusion (except for FMOD's own occlusion) will 52/// not work with FMOD events. 53/// 54/// The parameters of an FMOD event are automatically created and designed using the 55/// information in the project. 56/// 57class SFXFMODEvent : public SFXTrack 58{ 59 public: 60 61 typedef SFXTrack Parent; 62 friend class SFXFMODEventGroup; 63 friend class SFXFMODEventSource; 64 65 protected: 66 67 /// Name of the event in the Designer project. 68 String mName; 69 70 /// Event group that this event belongs to. 71 SFXFMODEventGroup* mGroup; 72 73 /// Next event in the group's event chain. 74 SFXFMODEvent* mSibling; 75 76 /// FMOD event handle when event is open. Client-side only. 77 FMOD_EVENT* mHandle; 78 79 /// 80 Point2F mParameterRanges[ MaxNumParameters ]; 81 82 /// 83 F32 mParameterValues[ MaxNumParameters ]; 84 85 /// Group ID for client net sync. 86 S32 mGroupId; 87 88 /// 89 void _createParameters(); 90 91 public: 92 93 /// 94 SFXFMODEvent(); 95 96 /// 97 SFXFMODEvent( SFXFMODEventGroup* group, const String& name ); 98 99 /// 100 SFXFMODEvent( SFXFMODEventGroup* group, FMOD_EVENT* handle ); 101 102 ~SFXFMODEvent(); 103 104 /// Create the event object on the FMOD device. 105 void acquire(); 106 107 /// Release the event object on the FMOD device. 108 void release(); 109 110 /// 111 const String& getEventName() const { return mName; } 112 113 /// 114 SFXFMODEventGroup* getEventGroup() const { return mGroup; } 115 116 /// 117 String getQualifiedName() const; 118 119 /// 120 bool isDataLoaded() const; 121 122 // SFXTrack. 123 virtual bool onAdd(); 124 virtual void onRemove(); 125 virtual bool preload( bool server, String& errorStr ); 126 virtual void packData( BitStream* stream ); 127 virtual void unpackData( BitStream* stream ); 128 129 static void initPersistFields(); 130 131 DECLARE_CONOBJECT( SFXFMODEvent ); 132 DECLARE_CATEGORY( "SFX FMOD" ); 133 DECLARE_DESCRIPTION( "An FMOD Designer event." ); 134}; 135 136#endif // !_SFXFMODEVENT_H_ 137