sfxDSVoice.h
Engine/source/sfx/dsound/sfxDSVoice.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 _SFXDSVOICE_H_ 25#define _SFXDSVOICE_H_ 26 27#ifndef _SFXVOICE_H_ 28 #include "sfx/sfxVoice.h" 29#endif 30#ifndef _SFXDSBUFFER_H_ 31 #include "sfx/dsound/sfxDSBuffer.h" 32#endif 33 34#include <dsound.h> 35 36class SFXDSDevice; 37 38 39class SFXDSVoice : public SFXVoice 40{ 41 typedef SFXVoice Parent; 42 43 protected: 44 45 SFXDSVoice( SFXDSDevice *device, 46 SFXDSBuffer *buffer, 47 IDirectSoundBuffer8 *dsBuffer, 48 IDirectSound3DBuffer8 *dsBuffer3d ); 49 50 /// The device used to commit deferred settings. 51 SFXDSDevice *mDevice; 52 53 IDirectSoundBuffer8 *mDSBuffer; 54 55 IDirectSound3DBuffer8 *mDSBuffer3D; 56 57 bool mIsLooping; 58 59 SFXDSBuffer* _getBuffer() const { return ( SFXDSBuffer* ) mBuffer.getPointer(); } 60 61 /// Helper for converting floating point linear volume 62 /// to a logrithmic integer volume for dsound. 63 static LONG _linearToLogVolume( F32 linVolume ); 64 65 // SFXVoice 66 virtual SFXStatus _status() const; 67 virtual void _play(); 68 virtual void _pause(); 69 virtual void _stop(); 70 virtual void _seek( U32 sample ); 71 virtual U32 _tell() const; 72 73 public: 74 75 /// 76 static SFXDSVoice* create( SFXDSDevice *device, 77 SFXDSBuffer *buffer ); 78 79 /// 80 virtual ~SFXDSVoice(); 81 82 // SFXVoice 83 void setMinMaxDistance( F32 min, F32 max ); 84 void play( bool looping ); 85 void setVelocity( const VectorF& velocity ); 86 void setTransform( const MatrixF& transform ); 87 void setVolume( F32 volume ); 88 void setPitch( F32 pitch ); 89 void setCone( F32 innerAngle, F32 outerAngle, F32 outerVolume ); 90 91}; 92 93#endif // _SFXDSBUFFER_H_ 94