sfxFMODVoice.h
Engine/source/sfx/fmod/sfxFMODVoice.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 _SFXFMODVOICE_H_ 25#define _SFXFMODVOICE_H_ 26 27#ifndef _SFXDEVICE_H_ 28 #include "sfx/sfxDevice.h" 29#endif 30#ifndef _SFXVOICE_H_ 31 #include "sfx/sfxVoice.h" 32#endif 33#ifndef _BITSET_H_ 34 #include "core/bitSet.h" 35#endif 36 37#include "fmod.h" 38 39class SFXSource; 40class SFXFMODBuffer; 41class SFXFMODDevice; 42 43 44class SFXFMODVoice : public SFXVoice 45{ 46 typedef SFXVoice Parent; 47 friend class SFXFMODBuffer; 48 49 protected: 50 51 SFXFMODDevice *mDevice; 52 53 mutable FMOD_CHANNEL *mChannel; 54 55 enum ESettings 56 { 57 SET_MinMaxDistance = BIT( 0 ), 58 SET_Velocity = BIT( 1 ), 59 SET_Transform = BIT( 2 ), 60 SET_Volume = BIT( 3 ), 61 SET_Pitch = BIT( 4 ), 62 SET_Cone = BIT( 5 ), 63 SET_Priority = BIT( 6 ), 64 SET_Reverb = BIT( 7 ), 65 }; 66 67 BitSet32 mSetFlags; 68 69 FMOD_MODE mMode; 70 F32 mMinDistance; 71 F32 mMaxDistance; 72 F32 mVolume; 73 F32 mPriority; 74 F32 mFrequency; 75 F32 mConeInnerAngle; 76 F32 mConeOuterAngle; 77 F32 mConeOuterVolume; 78 FMOD_VECTOR mVelocity; 79 FMOD_VECTOR mPosition; 80 FMOD_VECTOR mDirection; 81 FMOD_REVERB_CHANNELPROPERTIES mReverb; 82 83 /// 84 SFXFMODVoice( SFXFMODDevice *device, 85 SFXFMODBuffer *buffer ); 86 87 // prep for playback 88 bool _assignChannel(); 89 90 SFXFMODBuffer* _getBuffer() const { return ( SFXFMODBuffer* ) mBuffer.getPointer(); } 91 92 // SFXVoice. 93 virtual SFXStatus _status() const; 94 virtual void _play(); 95 virtual void _pause(); 96 virtual void _stop(); 97 virtual void _seek( U32 sample ); 98 virtual U32 _tell() const; 99 100 public: 101 102 /// 103 static SFXFMODVoice* create( SFXFMODDevice *device, 104 SFXFMODBuffer *buffer ); 105 106 /// 107 virtual ~SFXFMODVoice(); 108 109 /// SFXVoice 110 void setMinMaxDistance( F32 min, F32 max ); 111 void play( bool looping ); 112 void setVelocity( const VectorF& velocity ); 113 void setTransform( const MatrixF& transform ); 114 void setVolume( F32 volume ); 115 void setPriority( F32 priority ); 116 void setPitch( F32 pitch ); 117 void setCone( F32 innerAngle, F32 outerAngle, F32 outerVolume ); 118 void setReverb( const SFXSoundReverbProperties& reverb ); 119 bool isVirtual() const; 120}; 121 122#endif // _SFXFMODBUFFER_H_ 123