Merge pull request #1874 from John3/readmeUpdate
[Torque-3d.git] / Engine / source / sfx / fmod / sfxFMODVoice.h
blob14a5f7ced71360ae680cd56b8f412d56c275daa3
1 //-----------------------------------------------------------------------------
2 // Copyright (c) 2012 GarageGames, LLC
3 //
4 // Permission is hereby granted, free of charge, to any person obtaining a copy
5 // of this software and associated documentation files (the "Software"), to
6 // deal in the Software without restriction, including without limitation the
7 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
8 // sell copies of the Software, and to permit persons to whom the Software is
9 // furnished to do so, subject to the following conditions:
11 // The above copyright notice and this permission notice shall be included in
12 // all copies or substantial portions of the Software.
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
20 // IN THE SOFTWARE.
21 //-----------------------------------------------------------------------------
23 #ifndef _SFXFMODVOICE_H_
24 #define _SFXFMODVOICE_H_
26 #ifndef _SFXDEVICE_H_
27 #include "sfx/sfxDevice.h"
28 #endif
29 #ifndef _SFXVOICE_H_
30 #include "sfx/sfxVoice.h"
31 #endif
32 #ifndef _BITSET_H_
33 #include "core/bitSet.h"
34 #endif
36 #include "fmod.h"
38 class SFXSource;
39 class SFXFMODBuffer;
40 class SFXFMODDevice;
43 class SFXFMODVoice : public SFXVoice
45 typedef SFXVoice Parent;
46 friend class SFXFMODBuffer;
48 protected:
50 SFXFMODDevice *mDevice;
52 mutable FMOD_CHANNEL *mChannel;
54 enum ESettings
56 SET_MinMaxDistance = BIT( 0 ),
57 SET_Velocity = BIT( 1 ),
58 SET_Transform = BIT( 2 ),
59 SET_Volume = BIT( 3 ),
60 SET_Pitch = BIT( 4 ),
61 SET_Cone = BIT( 5 ),
62 SET_Priority = BIT( 6 ),
63 SET_Reverb = BIT( 7 ),
66 BitSet32 mSetFlags;
68 FMOD_MODE mMode;
69 F32 mMinDistance;
70 F32 mMaxDistance;
71 F32 mVolume;
72 F32 mPriority;
73 F32 mFrequency;
74 F32 mConeInnerAngle;
75 F32 mConeOuterAngle;
76 F32 mConeOuterVolume;
77 FMOD_VECTOR mVelocity;
78 FMOD_VECTOR mPosition;
79 FMOD_VECTOR mDirection;
80 FMOD_REVERB_CHANNELPROPERTIES mReverb;
82 ///
83 SFXFMODVoice( SFXFMODDevice *device,
84 SFXFMODBuffer *buffer );
86 // prep for playback
87 bool _assignChannel();
89 SFXFMODBuffer* _getBuffer() const { return ( SFXFMODBuffer* ) mBuffer.getPointer(); }
91 // SFXVoice.
92 virtual SFXStatus _status() const;
93 virtual void _play();
94 virtual void _pause();
95 virtual void _stop();
96 virtual void _seek( U32 sample );
97 virtual U32 _tell() const;
99 public:
102 static SFXFMODVoice* create( SFXFMODDevice *device,
103 SFXFMODBuffer *buffer );
106 virtual ~SFXFMODVoice();
108 /// SFXVoice
109 void setMinMaxDistance( F32 min, F32 max );
110 void play( bool looping );
111 void setVelocity( const VectorF& velocity );
112 void setTransform( const MatrixF& transform );
113 void setVolume( F32 volume );
114 void setPriority( F32 priority );
115 void setPitch( F32 pitch );
116 void setCone( F32 innerAngle, F32 outerAngle, F32 outerVolume );
117 void setReverb( const SFXSoundReverbProperties& reverb );
118 bool isVirtual() const;
121 #endif // _SFXFMODBUFFER_H_