1 //-----------------------------------------------------------------------------
2 // Copyright (c) 2012 GarageGames, LLC
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
21 //-----------------------------------------------------------------------------
23 #ifndef _SFXFMODVOICE_H_
24 #define _SFXFMODVOICE_H_
27 #include "sfx/sfxDevice.h"
30 #include "sfx/sfxVoice.h"
33 #include "core/bitSet.h"
43 class SFXFMODVoice
: public SFXVoice
45 typedef SFXVoice Parent
;
46 friend class SFXFMODBuffer
;
50 SFXFMODDevice
*mDevice
;
52 mutable FMOD_CHANNEL
*mChannel
;
56 SET_MinMaxDistance
= BIT( 0 ),
57 SET_Velocity
= BIT( 1 ),
58 SET_Transform
= BIT( 2 ),
59 SET_Volume
= BIT( 3 ),
62 SET_Priority
= BIT( 6 ),
63 SET_Reverb
= BIT( 7 ),
77 FMOD_VECTOR mVelocity
;
78 FMOD_VECTOR mPosition
;
79 FMOD_VECTOR mDirection
;
80 FMOD_REVERB_CHANNELPROPERTIES mReverb
;
83 SFXFMODVoice( SFXFMODDevice
*device
,
84 SFXFMODBuffer
*buffer
);
87 bool _assignChannel();
89 SFXFMODBuffer
* _getBuffer() const { return ( SFXFMODBuffer
* ) mBuffer
.getPointer(); }
92 virtual SFXStatus
_status() const;
94 virtual void _pause();
96 virtual void _seek( U32 sample
);
97 virtual U32
_tell() const;
102 static SFXFMODVoice
* create( SFXFMODDevice
*device
,
103 SFXFMODBuffer
*buffer
);
106 virtual ~SFXFMODVoice();
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_