Home | nevrax.com |
|
buffer_dsound.hGo to the documentation of this file.00001 00007 /* Copyright, 2001 Nevrax Ltd. 00008 * 00009 * This file is part of NEVRAX NEL. 00010 * NEVRAX NEL is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2, or (at your option) 00013 * any later version. 00014 00015 * NEVRAX NEL is distributed in the hope that it will be useful, but 00016 * WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * General Public License for more details. 00019 00020 * You should have received a copy of the GNU General Public License 00021 * along with NEVRAX NEL; see the file COPYING. If not, write to the 00022 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, 00023 * MA 02111-1307, USA. 00024 */ 00025 00026 #ifndef NL_BUFFER_DSOUND_H 00027 #define NL_BUFFER_DSOUND_H 00028 00029 00030 #include "sound/driver/buffer.h" 00031 00032 00033 namespace NLSOUND { 00034 00035 00045 class CBufferDSound : public IBuffer 00046 { 00047 public: 00048 00050 CBufferDSound(); 00052 virtual ~CBufferDSound(); 00053 00054 virtual void presetName(const std::string &bufferName); 00055 00057 virtual void setFormat( TSampleFormat format, uint freq ); 00058 00060 virtual bool fillBuffer( void *src, uint32 bufsize ); 00061 00063 virtual uint32 getSize() const { return _Size; } 00064 00066 virtual float getDuration() const; 00067 00069 virtual bool isStereo() const { return (_Format == Stereo8) || (_Format == Stereo16); } 00070 00072 virtual void getFormat( TSampleFormat& format, uint& freq ) const { format = _Format; freq = _Freq; } 00073 00074 00078 virtual bool isFillMoreSupported() const { return false; } 00079 00081 //virtual void setSize( uint32 size ) { throw ESoundDriverNotSupp(); } 00082 00088 //virtual bool fillMore( void *src, uint32 srcsize ) { throw ESoundDriverNotSupp(); } 00089 00090 00092 virtual bool loadWavFile(const char* filename); 00093 00095 virtual uint8* getData() const { return _Data; } 00096 00098 virtual const std::string& getName() { return _Name; } 00099 00100 virtual bool isBufferLoaded() { return _Data != 0; } 00101 00102 private: 00103 00104 std::string _Name; 00105 00106 uint8* _Data; 00107 00108 uint32 _Size; 00109 00110 TSampleFormat _Format; 00111 00112 uint _Freq; 00113 00114 00115 #if USE_LOCDEFER 00116 LPDIRECTSOUNDBUFFER _SecondaryBuffer; 00117 LPDIRECTSOUND3DBUFFER _3DBuffer; 00118 #endif 00119 00120 }; 00121 00122 00123 } // NLSOUND 00124 00125 00126 #endif // NL_BUFFER_DSOUND_H 00127 |