NLSOUND::CAsyncFileManagerSound::CLoadWavFile Class Reference

Inheritance diagram for NLSOUND::CAsyncFileManagerSound::CLoadWavFile:

NLMISC::IRunnable

Public Member Functions

 CLoadWavFile (IBuffer *pdestBuffer, const std::string &filename)
virtual void getName (std::string &result) const
void run (void)

Data Fields

std::string _Filename

Private Attributes

IBuffer_pDestbuffer

Constructor & Destructor Documentation

NLSOUND::CAsyncFileManagerSound::CLoadWavFile::CLoadWavFile IBuffer pdestBuffer,
const std::string &  filename
 

Definition at line 137 of file async_file_manager_sound.cpp.

References _pDestbuffer, and nlwarning.

00138 :_Filename(filename), _pDestbuffer(pdestBuffer)
00139 {
00140         if (_Filename.empty())
00141         {
00142                 nlwarning("CAsyncFileManagerSound::CLoadWavFile::CLoadWavFile : file name is empty !");
00143         }
00144         if (_pDestbuffer == 0)
00145         {
00146                 nlwarning("CAsyncFileManagerSound::CLoadWavFile::CLoadWavFile : dest buffer ptr is null!");
00147         }
00148 }


Member Function Documentation

virtual void NLMISC::IRunnable::getName std::string &  result  )  const [inline, virtual, inherited]
 

Reimplemented in NL3D::CAsyncFileManager3D::CMeshLoad, NL3D::CAsyncFileManager3D::CIGLoad, NL3D::CAsyncFileManager3D::CIGLoadUser, NL3D::CAsyncFileManager3D::CTextureLoad, NL3D::CZoneLoadingTask, NLPACS::CGlobalRetriever::CLrLoader, NLMISC::CAsyncFileManager::CFileLoad, NLMISC::CAsyncFileManager::CMultipleFileLoad, and NLMISC::CAsyncFileManager::CSignal.

Definition at line 74 of file thread.h.

Referenced by NLMISC::CTaskManager::run().

00075         {
00076                 result = "NoName";
00077         }

void NLSOUND::CAsyncFileManagerSound::CLoadWavFile::run void   )  [virtual]
 

Implements NLMISC::IRunnable.

Definition at line 150 of file async_file_manager_sound.cpp.

References _pDestbuffer, buffer, NLMISC::CIFile::getFileSize(), NLSOUND::CAudioMixerUser::getSoundDriver(), nldebug, nlwarning, NLSOUND::ISoundDriver::readWavBuffer(), NLMISC::CIFile::serialBuffer(), size, uint, and uint8.

00151 {
00152         NL_ALLOC_CONTEXT(NLSOUND_CAsyncFileManagerSound);
00153         nldebug("Loading sample %s...", _Filename.c_str());
00154 //      nlSleep(500);
00155         CAudioMixerUser *mixer = CAudioMixerUser::instance();
00156         if (mixer == 0)
00157         {
00158                 nlwarning("CAsyncFileManagerSound::CLoadWavFile::run : mixer is not avalable !");
00159                 return;
00160         }
00161         
00162         ISoundDriver *sndDrv = mixer->getSoundDriver();
00163         if (sndDrv == 0)
00164         {
00165                 nlwarning("CAsyncFileManagerSound::CLoadWavFile::run : sound driver is null !");
00166                 return;
00167         }
00168         
00169         if (_pDestbuffer == 0)
00170         {
00171                 nlwarning("CAsyncFileManagerSound::CLoadWavFile::run : dest buffer is null !");
00172                 return;
00173         }
00174 
00175         if (_Filename.empty())
00176         {
00177                 nlwarning("CAsyncFileManagerSound::CLoadWavFile::run : filename is empty !");
00178                 return;
00179         }
00180         try
00181         {
00182                 NLMISC::CIFile  ifile(NLMISC::CPath::lookup(_Filename));
00183                 uint size = ifile.getFileSize();
00184                 uint8 *buffer = new uint8[ifile.getFileSize()];
00185                 ifile.serialBuffer(buffer, size);
00186                 sndDrv->readWavBuffer(_pDestbuffer, _Filename, buffer, size);
00187                 delete [] buffer;
00188         }
00189         catch(...)
00190         {
00191                 nlwarning("CAsyncFileManagerSound::CLoadWavFile::run : Exeption detected during IDriver::loadWavFile(%p, %s)", _pDestbuffer, _Filename.c_str());
00192         }
00193 }


Field Documentation

std::string NLSOUND::CAsyncFileManagerSound::CLoadWavFile::_Filename
 

Definition at line 76 of file async_file_manager_sound.h.

Referenced by NLSOUND::CCancelLoadWavFile::callback().

IBuffer* NLSOUND::CAsyncFileManagerSound::CLoadWavFile::_pDestbuffer [private]
 

Definition at line 73 of file async_file_manager_sound.h.

Referenced by CLoadWavFile(), and run().


The documentation for this class was generated from the following files:
Generated on Tue Mar 16 14:28:17 2004 for NeL by doxygen 1.3.6