sfxXAudioDevice.h
Engine/source/sfx/xaudio/sfxXAudioDevice.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 _SFXXAUDIODEVICE_H_ 25#define _SFXXAUDIODEVICE_H_ 26 27class SFXProvider; 28 29#ifndef _SFXDEVICE_H_ 30#include "sfx/sfxDevice.h" 31#endif 32 33#ifndef _SFXPROVIDER_H_ 34#include "sfx/sfxProvider.h" 35#endif 36 37#ifndef _SFXXAUDIOVOICE_H_ 38#include "sfx/xaudio/sfxXAudioVoice.h" 39#endif 40 41#ifndef _SFXXAUDIOBUFFER_H_ 42#include "sfx/xaudio/sfxXAudioBuffer.h" 43#endif 44 45#include <xaudio2.h> 46#include <x3daudio.h> 47 48 49class SFXXAudioDevice : public SFXDevice 50{ 51 public: 52 53 typedef SFXDevice Parent; 54 friend class SFXXAudioVoice; // mXAudio 55 56 protected: 57 58 /// The XAudio engine interface passed 59 /// on creation from the provider. 60 IXAudio2 *mXAudio; 61 62 /// The X3DAudio instance. 63 X3DAUDIO_HANDLE mX3DAudio; 64 65 /// The one and only mastering voice. 66 IXAudio2MasteringVoice* mMasterVoice; 67 68 /// The details of the master voice. 69 XAUDIO2_VOICE_DETAILS mMasterVoiceDetails; 70 71 /// The one listener. 72 X3DAUDIO_LISTENER mListener; 73 74 SFXDistanceModel mDistanceModel; 75 F32 mRolloffFactor; 76 F32 mDopplerFactor; 77 78 public: 79 80 SFXXAudioDevice( SFXProvider* provider, 81 const String& name, 82 IXAudio2 *xaudio, 83 U32 deviceIndex, 84 U32 speakerChannelMask, 85 U32 maxBuffers ); 86 87 virtual ~SFXXAudioDevice(); 88 89 // SFXDevice 90 virtual SFXBuffer* createBuffer( const ThreadSafeRef< SFXStream>& stream, SFXDescription* description ); 91 virtual SFXVoice* createVoice( bool is3D, SFXBuffer *buffer ); 92 virtual void update(); 93 virtual void setListener( U32 index, const SFXListenerProperties& listener ); 94 virtual void setDistanceModel( SFXDistanceModel model ); 95 virtual void setRolloffFactor( F32 factor ); 96 virtual void setDopplerFactor( F32 factor ); 97 98 /// Called from the voice when its about to start playback. 99 void _setOutputMatrix( SFXXAudioVoice *voice ); 100}; 101 102#endif // _SFXXAUDIODEVICE_H_ 103