From 0ea5fc66924303d1bf73ba283a383e2aadee02f2 Mon Sep 17 00:00:00 2001 From: neodarz Date: Sat, 11 Aug 2018 20:21:34 +0200 Subject: Initial commit --- docs/doxygen/nel/a03418.html | 1776 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1776 insertions(+) create mode 100644 docs/doxygen/nel/a03418.html (limited to 'docs/doxygen/nel/a03418.html') diff --git a/docs/doxygen/nel/a03418.html b/docs/doxygen/nel/a03418.html new file mode 100644 index 00000000..fa0271fa --- /dev/null +++ b/docs/doxygen/nel/a03418.html @@ -0,0 +1,1776 @@ + + +NeL: NLSOUND::CSoundDriverAL class Reference + + + +
+

NLSOUND::CSoundDriverAL Class Reference

#include <sound_driver_al.h> +

+

Inheritance diagram for NLSOUND::CSoundDriverAL: +

+ +NLSOUND::ISoundDriver + +

Detailed Description

+OpenAL sound driver

+The caller of the create methods is responsible for the deletion of the created objects These objects must be deleted before deleting the ISoundDriver instance.

+

Author:
Olivier Cado

+Nevrax France

+
Date:
2001
+ +

+ +

+Definition at line 91 of file sound_driver_al.h. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Public Member Functions

void applyRolloffFactor (float f)
 Change the rolloff factor and apply to all sources.

virtual void commit3DChanges ()
 Commit all the changes made to 3D settings of listener and sources.

virtual uint countMaxSources ()
 Return the maximum number of sources that can created.

virtual IBuffercreateBuffer ()
 Create a sound buffer.

virtual IListenercreateListener ()
 Create the listener instance.

virtual ISourcecreateSource ()
 Create a source.

 CSoundDriverAL ()
 Constructor.

virtual void displayBench (NLMISC::CLog *log)
virtual void endBench ()
virtual bool init ()
 Initialization.

virtual bool loadWavFile (IBuffer *destbuffer, const char *filename)
 Temp.

virtual bool readRawBuffer (IBuffer *destbuffer, const std::string &name, uint8 *rawData, uint dataSize, TSampleFormat format, uint32 frequency)
virtual bool readWavBuffer (IBuffer *destbuffer, const std::string &name, uint8 *wavData, uint dataSize)
 Temp.

virtual void startBench ()
virtual void writeProfile (std::ostream &out)
 Write information about the driver to the output stream.

virtual ~CSoundDriverAL ()
 Destructor.


Static Public Member Functions

ISoundDrivercreateDriver (bool useEax, IStringMapperProvider *stringMapper)
CSoundDriverALinstance ()
 Return the instance of the singleton.


Static Public Attributes

const uint32 InterfaceVersion = 0x08
 Version of the driver interface. To increment when the interface change.


Protected Member Functions

void allocateNewItems (TGenFunctionAL algenfunc, TTestFunctionAL altestfunc, std::vector< ALuint > &names, uint index, uint nb)
 Allocate nb new buffers or sources.

friend CBufferAL::~CBufferAL ()
uint compactAliveNames (std::vector< ALuint > &names, TTestFunctionAL testfunc)
 Remove names of deleted items and return the number of valid items.

ALuint createItem (TGenFunctionAL algenfunc, TTestFunctionAL altestfunc, std::vector< ALuint > &names, uint &index, uint allocrate)
 Create a sound buffer or a sound source.

friend CSourceAL::~CSourceAL ()
bool deleteItem (ALuint name, TGenFunctionAL aldeletefunc, std::vector< ALuint > &names)
 Delete a buffer or a source.

void generateItems (TGenFunctionAL algenfunc, TTestFunctionAL altestfunc, uint nb, ALuint *array)
 Generate nb buffers.

void removeBuffer (IBuffer *buffer)
 Remove a buffer.

void removeSource (ISource *source)
 Remove a source.


Private Attributes

std::vector< ALuint > _Buffers
uint _NbExpBuffers
uint _NbExpSources
float _RolloffFactor
std::vector< ALuint > _Sources

Static Private Attributes

CSoundDriverAL_Instance = NULL
+


Constructor & Destructor Documentation

+

+ + + + +
+ + + + + + + + + +
NLSOUND::CSoundDriverAL::CSoundDriverAL  ) 
+
+ + + + + +
+   + + +

+Constructor. +

+ +

+Definition at line 129 of file sound_driver_al.cpp. +

+References nlerror. +

+

00129                                :
+00130         ISoundDriver(), _NbExpBuffers( 0 ), _NbExpSources( 0 ), _RolloffFactor( 1.0f )
+00131 {
+00132         if ( _Instance == NULL )
+00133         {
+00134                 _Instance = this;
+00135         }
+00136         else
+00137         {
+00138                 nlerror( "Sound driver singleton instanciated twice" );
+00139         }
+00140 }
+
+
+

+ + + + +
+ + + + + + + + + +
NLSOUND::CSoundDriverAL::~CSoundDriverAL  )  [virtual]
+
+ + + + + +
+   + + +

+Destructor. +

+ +

+Definition at line 146 of file sound_driver_al.cpp. +

+References _Buffers, and compactAliveNames(). +

+

00147 {
+00148         // Remove the allocated (but not exported) source and buffer names
+00149         alDeleteSources( compactAliveNames( _Sources, alIsSource ), &*_Sources.begin() );
+00150         alDeleteBuffers( compactAliveNames( _Buffers, alIsBuffer ), &*_Buffers.begin() );
+00151 
+00152         // OpenAL exit
+00153         alutExit();
+00154 
+00155         _Instance = NULL;
+00156 }
+
+

+ + + + +
+ + + + + + + + + +
NLSOUND::CSoundDriverAL::CBufferAL::~CBufferAL  )  [protected]
+
+ + + + + +
+   + + +

+

+

+ + + + +
+ + + + + + + + + +
NLSOUND::CSoundDriverAL::CSourceAL::~CSourceAL  )  [protected]
+
+ + + + + +
+   + + +

+

+


Member Function Documentation

+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NLSOUND::CSoundDriverAL::allocateNewItems TGenFunctionAL  algenfunc,
TTestFunctionAL  altestfunc,
std::vector< ALuint > &  names,
uint  index,
uint  nb
[protected]
+
+ + + + + +
+   + + +

+Allocate nb new buffers or sources. +

+ +

+Definition at line 215 of file sound_driver_al.cpp. +

+References generateItems(), index, nlassert, NLSOUND::TGenFunctionAL, NLSOUND::TTestFunctionAL, and uint. +

+Referenced by createItem(), and init(). +

+

00217 {
+00218         nlassert( index == names.size() );
+00219         names.resize( index + nb );
+00220         generateItems( algenfunc, altestfunc, nb, &(names[index]) );
+00221 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLSOUND::CSoundDriverAL::applyRolloffFactor float  f  ) 
+
+ + + + + +
+   + + +

+Change the rolloff factor and apply to all sources. +

+ +

+Definition at line 400 of file sound_driver_al.cpp. +

+References _RolloffFactor, and TestALError. +

+

00401 {
+00402         _RolloffFactor = f;
+00403         vector<ALuint>::iterator ibn;
+00404         for ( ibn=_Sources.begin(); ibn!=_Sources.end(); ++ibn )
+00405         {
+00406                 alSourcef( *ibn, AL_ROLLOFF_FACTOR, _RolloffFactor );
+00407         }
+00408         TestALError();
+00409 }
+
+

+ + + + +
+ + + + + + + + + +
virtual void NLSOUND::CSoundDriverAL::commit3DChanges  )  [inline, virtual]
+
+ + + + + +
+   + + +

+Commit all the changes made to 3D settings of listener and sources. +

+ +

+Implements NLSOUND::ISoundDriver. +

+Definition at line 132 of file sound_driver_al.h. +

+

00132 {}
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
uint NLSOUND::CSoundDriverAL::compactAliveNames std::vector< ALuint > &  names,
TTestFunctionAL  testfunc
[protected]
+
+ + + + + +
+   + + +

+Remove names of deleted items and return the number of valid items. +

+ +

+Definition at line 323 of file sound_driver_al.cpp. +

+References nlassert, NLSOUND::TTestFunctionAL, and uint. +

+Referenced by createItem(), and ~CSoundDriverAL(). +

+

00324 {
+00325         vector<ALuint>::iterator iball, ibcompacted;
+00326         for ( iball=names.begin(), ibcompacted=names.begin(); iball!=names.end(); ++iball )
+00327         {
+00328                 // iball is incremented every iteration
+00329                 // ibcompacted is not incremented if a buffer is not valid anymore
+00330                 if ( altestfunc( *iball ) )
+00331                 {
+00332                         *ibcompacted = *iball;
+00333                         ++ibcompacted;
+00334                 }
+00335         }
+00336         nlassert( ibcompacted <= names.end() );
+00337         return ibcompacted - names.begin();
+00338 }
+
+

+ + + + +
+ + + + + + + + + +
virtual uint NLSOUND::CSoundDriverAL::countMaxSources  )  [inline, virtual]
+
+ + + + + +
+   + + +

+Return the maximum number of sources that can created. +

+ +

+Implements NLSOUND::ISoundDriver. +

+Definition at line 111 of file sound_driver_al.h. +

+References uint. +

+

00111 { return 32; }
+
+

+ + + + +
+ + + + + + + + + +
IBuffer * NLSOUND::CSoundDriverAL::createBuffer  )  [virtual]
+
+ + + + + +
+   + + +

+Create a sound buffer. +

+ +

+Implements NLSOUND::ISoundDriver. +

+Definition at line 264 of file sound_driver_al.cpp. +

+References _Buffers, _NbExpBuffers, BUFFER_ALLOC_RATE, and createItem(). +

+

00265 {
+00266         NL_ALLOC_CONTEXT(NLSOUND_CSoundDriverAL);
+00267         return new CBufferAL( createItem( alGenBuffers, alIsBuffer, _Buffers, _NbExpBuffers, BUFFER_ALLOC_RATE ) );
+00268 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
ISoundDriver * NLSOUND::ISoundDriver::createDriver bool  useEax,
IStringMapperProvider stringMapper
[static, inherited]
+
+ + + + + +
+   + + +

+The static method which builds the sound driver instance In case of failure, can throw one of these ESoundDriver exception objects: ESoundDriverNotFound, ESoundDriverCorrupted, ESoundDriverOldVersion, ESoundDriverUnknownVersion

+You can request support for EAX. If EAX is requested and if there is enougth hardware buffer replay, then only hardware buffer are created when calling createBuffer. If the number of available hardware buffer is less than 10, then EAX is ignored. +

+Definition at line 61 of file sound_driver.cpp. +

+References buffer, NLSOUND::ISDRV_CREATE_PROC, NLSOUND::ISDRV_VERSION_PROC, nlinfo, and nlwarning. +

+

00062 {
+00063         ISDRV_CREATE_PROC       createSoundDriver = NULL;
+00064         ISDRV_VERSION_PROC      versionDriver = NULL;
+00065 
+00066 #ifdef NL_OS_WINDOWS
+00067 
+00068         // WINDOWS code.
+00069         HINSTANCE                       hInst;
+00070 
+00071         hInst = LoadLibrary(NLSOUND_DLL_NAME);
+00072 
+00073         if (!hInst)
+00074         {
+00075                 throw ESoundDriverNotFound();
+00076         }
+00077 
+00078         char buffer[1024], *ptr;
+00079         SearchPath (NULL, NLSOUND_DLL_NAME, NULL, 1023, buffer, &ptr);
+00080         nlinfo ("Using the library '"NLSOUND_DLL_NAME"' that is in the directory: '%s'", buffer);
+00081 
+00082         createSoundDriver = (ISDRV_CREATE_PROC) GetProcAddress (hInst, IDRV_CREATE_PROC_NAME);
+00083         if (createSoundDriver == NULL)
+00084         {
+00085                 nlinfo( "Error: %u", GetLastError() );
+00086                 throw ESoundDriverCorrupted();
+00087         }
+00088 
+00089         versionDriver = (ISDRV_VERSION_PROC) GetProcAddress (hInst, IDRV_VERSION_PROC_NAME);
+00090         if (versionDriver != NULL)
+00091         {
+00092                 if (versionDriver()<ISoundDriver::InterfaceVersion)
+00093                         throw ESoundDriverOldVersion();
+00094                 else if (versionDriver()>ISoundDriver::InterfaceVersion)
+00095                         throw ESoundDriverUnknownVersion();
+00096         }
+00097 
+00098 #elif defined (NL_OS_UNIX)
+00099 
+00100         // Unix code
+00101         void *handle = dlopen(NLSOUND_DLL_NAME, RTLD_NOW);
+00102 
+00103         if (handle == NULL)
+00104         {
+00105                 nlwarning ("when loading dynamic library '%s': %s", NLSOUND_DLL_NAME, dlerror());
+00106                 throw ESoundDriverNotFound();
+00107         }
+00108 
+00109         /* Not ANSI. Might produce a warning */
+00110         createSoundDriver = (ISDRV_CREATE_PROC) dlsym (handle, IDRV_CREATE_PROC_NAME);
+00111         if (createSoundDriver == NULL)
+00112         {
+00113                 nlwarning ("when getting function in dynamic library '%s': %s", NLSOUND_DLL_NAME, dlerror());
+00114                 throw ESoundDriverCorrupted();
+00115         }
+00116 
+00117         versionDriver = (ISDRV_VERSION_PROC) dlsym (handle, IDRV_VERSION_PROC_NAME);
+00118         if (versionDriver != NULL)
+00119         {
+00120                 if (versionDriver()<ISoundDriver::InterfaceVersion)
+00121                         throw ESoundDriverOldVersion();
+00122                 else if (versionDriver()>ISoundDriver::InterfaceVersion)
+00123                         throw ESoundDriverUnknownVersion();
+00124         }
+00125 
+00126 #else // NL_OS_UNIX
+00127 #error "Dynamic DLL loading not implemented!"
+00128 #endif // NL_OS_UNIX
+00129 
+00130         ISoundDriver *ret = createSoundDriver(useEax, stringMapper);
+00131         if ( ret == NULL )
+00132         {
+00133                 throw ESoundDriverCantCreateDriver();
+00134         }
+00135         return ret;
+00136 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
ALuint NLSOUND::CSoundDriverAL::createItem TGenFunctionAL  algenfunc,
TTestFunctionAL  altestfunc,
std::vector< ALuint > &  names,
uint index,
uint  allocrate
[protected]
+
+ + + + + +
+   + + +

+Create a sound buffer or a sound source. +

+ +

+Definition at line 289 of file sound_driver_al.cpp. +

+References allocateNewItems(), compactAliveNames(), generateItems(), index, nlassert, NLSOUND::TGenFunctionAL, NLSOUND::TTestFunctionAL, and uint. +

+Referenced by createBuffer(), and createSource(). +

+

00291 {
+00292         NL_ALLOC_CONTEXT(NLSOUND_CSoundDriverAL);
+00293         nlassert( index <= names.size() );
+00294         if ( index == names.size() )
+00295         {
+00296                 // Generate new items
+00297                 uint nbalive = compactAliveNames( names, altestfunc );
+00298                 if ( nbalive == names.size() )
+00299                 {
+00300                         // Extend vector of names
+00301                         allocateNewItems( algenfunc, altestfunc, names, index, allocrate );
+00302                 }
+00303                 else
+00304                 {
+00305                         // Take the room of the deleted names
+00306                         nlassert( nbalive < names.size() );
+00307                         index = nbalive;
+00308                         generateItems( algenfunc, altestfunc, names.size() - nbalive, &(names[nbalive]) );
+00309                 }
+00310         }
+00311 
+00312         // Return the name of the item
+00313         nlassert( index < names.size() );
+00314         ALuint itemname = names[index];
+00315         index++;
+00316         return itemname;
+00317 }
+
+

+ + + + +
+ + + + + + + + + +
IListener * NLSOUND::CSoundDriverAL::createListener  )  [virtual]
+
+ + + + + +
+   + + +

+Create the listener instance. +

+ +

+Implements NLSOUND::ISoundDriver. +

+Definition at line 389 of file sound_driver_al.cpp. +

+References nlassert. +

+

00390 {
+00391         NL_ALLOC_CONTEXT(NLSOUND_CSoundDriverAL);
+00392         nlassert( CListenerAL::instance() == NULL );
+00393         return new CListenerAL();
+00394 }
+
+

+ + + + +
+ + + + + + + + + +
ISource * NLSOUND::CSoundDriverAL::createSource  )  [virtual]
+
+ + + + + +
+   + + +

+Create a source. +

+ +

+Implements NLSOUND::ISoundDriver. +

+Definition at line 274 of file sound_driver_al.cpp. +

+References _NbExpSources, _RolloffFactor, createItem(), ROLLOFF_FACTOR_DEFAULT, SOURCE_ALLOC_RATE, and NLSOUND::CSourceAL::sourceName(). +

+

00275 {
+00276         NL_ALLOC_CONTEXT(NLSOUND_CSoundDriverAL);
+00277         CSourceAL *sourceal = new CSourceAL( createItem( alGenSources, alIsSource, _Sources, _NbExpSources, SOURCE_ALLOC_RATE ) );
+00278         if ( _RolloffFactor != ROLLOFF_FACTOR_DEFAULT )
+00279         {
+00280                 alSourcef( sourceal->sourceName(), AL_ROLLOFF_FACTOR, _RolloffFactor );
+00281         }
+00282         return sourceal;
+00283 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + +
bool NLSOUND::CSoundDriverAL::deleteItem ALuint  name,
TGenFunctionAL  aldeletefunc,
std::vector< ALuint > &  names
[protected]
+
+ + + + + +
+   + + +

+Delete a buffer or a source. +

+ +

+Definition at line 372 of file sound_driver_al.cpp. +

+References TestALError, and NLSOUND::TGenFunctionAL. +

+Referenced by removeBuffer(), and removeSource(). +

+

00373 {
+00374         vector<ALuint>::iterator ibn = find( names.begin(), names.end(), name );
+00375         if ( ibn == names.end() )
+00376         {
+00377                 return false;
+00378         }
+00379         aldeletefunc( 1, &*ibn );
+00380         *ibn = AL_NONE;
+00381         TestALError();
+00382         return true;
+00383 }
+
+

+ + + + +
+ + + + + + + + + + +
virtual void NLSOUND::CSoundDriverAL::displayBench NLMISC::CLog log  )  [inline, virtual]
+
+ + + + + +
+   + + +

+ +

+Implements NLSOUND::ISoundDriver. +

+Definition at line 122 of file sound_driver_al.h. +

+

00122 { /* TODO */ }
+
+

+ + + + +
+ + + + + + + + + +
virtual void NLSOUND::CSoundDriverAL::endBench  )  [inline, virtual]
+
+ + + + + +
+   + + +

+ +

+Implements NLSOUND::ISoundDriver. +

+Definition at line 121 of file sound_driver_al.h. +

+

00121 { /* todo */ }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
void NLSOUND::CSoundDriverAL::generateItems TGenFunctionAL  algenfunc,
TTestFunctionAL  altestfunc,
uint  nb,
ALuint *  array
[protected]
+
+ + + + + +
+   + + +

+Generate nb buffers. +

+ +

+Definition at line 240 of file sound_driver_al.cpp. +

+References NLSOUND::TGenFunctionAL, NLSOUND::ThrowGenException(), NLSOUND::TTestFunctionAL, and uint. +

+Referenced by allocateNewItems(), and createItem(). +

+

00241 {
+00242         algenfunc( nb, array );
+00243 
+00244         // Error handling
+00245         if ( alGetError() != AL_NO_ERROR )
+00246         {
+00247                 ThrowGenException( algenfunc );
+00248         }
+00249 
+00250         // Check buffers
+00251         uint i;
+00252         for ( i=0; i!=nb; i++ )
+00253         {
+00254                 if ( ! altestfunc( array[i] ) )
+00255                 {
+00256                         ThrowGenException( algenfunc );
+00257                 }
+00258         }
+00259 }
+
+

+ + + + +
+ + + + + + + + + +
bool NLSOUND::CSoundDriverAL::init  )  [virtual]
+
+ + + + + +
+   + + +

+Initialization. +

+ +

+Definition at line 162 of file sound_driver_al.cpp. +

+References _Buffers, _NbExpBuffers, _NbExpSources, allocateNewItems(), INITIAL_BUFFERS, INITIAL_SOURCES, nlinfo, and TestALError. +

+

00163 {
+00164         // OpenAL initialization
+00165         alutInit( NULL, NULL );
+00166 
+00167         // Display version information
+00168         const ALubyte *alversion, *alrenderer, *alvendor, *alext;
+00169         alversion = alGetString( AL_VERSION );
+00170         alrenderer = alGetString( AL_RENDERER );
+00171         alvendor = alGetString( AL_VENDOR );
+00172         alext = alGetString( AL_EXTENSIONS );
+00173         TestALError();
+00174         nlinfo( "Loading OpenAL lib: %s, %s, %s", alversion, alrenderer, alvendor );
+00175         nlinfo( "Listing extensions: %s", alext );
+00176 
+00177 #if EAX_AVAILABLE == 1
+00178     // Set EAX environment if EAX is available
+00179         if ( alIsExtensionPresent((ALubyte *)"EAX") == AL_TRUE ) // or EAX2.0
+00180         {
+00181                 nlinfo( "Initializing EAX" );
+00182             EAXSetProp = (EAXSet)alGetProcAddress((ALubyte*)"EAXSet");
+00183                 EAXGetProp = (EAXGet)alGetProcAddress((ALubyte*)"EAXGet");
+00184                 if ( EAXSetProp != NULL )
+00185                 {
+00186                         unsigned long ulEAXVal;
+00187                         long lGlobalReverb;
+00188                     lGlobalReverb = 0;
+00189                         EAXSetProp( &DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_ROOM, 0, &lGlobalReverb, sizeof(unsigned long) );
+00190                         ulEAXVal = EAX_ENVIRONMENT_GENERIC;
+00191                         EAXSetProp( &DSPROPSETID_EAX_ListenerProperties, DSPROPERTY_EAXLISTENER_ENVIRONMENT, 0, &ulEAXVal, sizeof(unsigned long) );
+00192                 }
+00193         }
+00194         else
+00195 #endif
+00196         {
+00197                 nlinfo( "EAX not available" );
+00198         }
+00199 
+00200         // Choose the I3DL2 model (same as DirectSound3D)
+00201         alDistanceModel( AL_INVERSE_DISTANCE_CLAMPED );
+00202         TestALError();
+00203 
+00204         // Initial buffers and sources allocation
+00205         allocateNewItems( alGenBuffers, alIsBuffer, _Buffers, _NbExpBuffers, INITIAL_BUFFERS );
+00206         allocateNewItems( alGenSources, alIsSource, _Sources, _NbExpSources, INITIAL_SOURCES );
+00207 
+00208         return true;
+00209 }
+
+

+ + + + +
+ + + + + + + + + +
CSoundDriverAL* NLSOUND::CSoundDriverAL::instance  )  [inline, static]
+
+ + + + + +
+   + + +

+Return the instance of the singleton. +

+ +

+Definition at line 99 of file sound_driver_al.h. +

+

00099 { return _Instance; }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + +
bool NLSOUND::CSoundDriverAL::loadWavFile IBuffer destbuffer,
const char *  filename
[virtual]
+
+ + + + + +
+   + + +

+Temp. +

+ +

+Definition at line 431 of file sound_driver_al.cpp. +

+References NLSOUND::ALtoNLSoundFormat(), data, NLSOUND::IBuffer::fillBuffer(), format, NLSOUND::IBuffer::setFormat(), and size. +

+

00432 {
+00433 // Currently, the OpenAL UT headers are different between Windows and Linux versions
+00434 #ifdef NL_OS_WINDOWS
+00435         ALsizei size,freq;
+00436         ALenum format;
+00437         ALvoid *data;
+00438         ALboolean loop;
+00439         alutLoadWAVFile( const_cast<char*>(filename), &format, &data, &size, &freq, &loop ); // last arg in some al.h
+00440 #else
+00441         ALsizei bits;
+00442         ALsizei size,freq;
+00443         ALsizei format;
+00444         ALvoid *data;
+00445         alutLoadWAV( const_cast<char*>(filename), &data, &format, &size, &bits, &freq ); 
+00446 #endif
+00447         if ( data == NULL )
+00448         {
+00449                 return false;
+00450         }
+00451         destbuffer->setFormat( ALtoNLSoundFormat(format), freq );
+00452         destbuffer->fillBuffer( data, size );
+00453 
+00454         string ext = CFile::getFilenameWithoutExtension(filename);
+00455 // TODO static_cast<CBufferAL*>(destbuffer)->setName(ext);
+00456 
+00457 #ifdef NL_OS_WINDOWS
+00458         alutUnloadWAV(format,data,size,freq); // Where is it on Linux ?!?
+00459 #endif
+00460         return true;
+00461 }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
virtual bool NLSOUND::CSoundDriverAL::readRawBuffer IBuffer destbuffer,
const std::string &  name,
uint8 rawData,
uint  dataSize,
TSampleFormat  format,
uint32  frequency
[inline, virtual]
+
+ + + + + +
+   + + +

+ +

+Implements NLSOUND::ISoundDriver. +

+Definition at line 118 of file sound_driver_al.h. +

+References format, uint, uint32, and uint8. +

+

00118 { /* todo */ return false; }
+
+

+ + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
virtual bool NLSOUND::CSoundDriverAL::readWavBuffer IBuffer destbuffer,
const std::string &  name,
uint8 wavData,
uint  dataSize
[inline, virtual]
+
+ + + + + +
+   + + +

+Temp. +

+ +

+Implements NLSOUND::ISoundDriver. +

+Definition at line 116 of file sound_driver_al.h. +

+References uint, and uint8. +

+

00116 { /* todo*/ return false; }
+
+

+ + + + +
+ + + + + + + + + + +
void NLSOUND::CSoundDriverAL::removeBuffer IBuffer buffer  )  [protected, virtual]
+
+ + + + + +
+   + + +

+Remove a buffer. +

+ +

+Implements NLSOUND::ISoundDriver. +

+Definition at line 344 of file sound_driver_al.cpp. +

+References _Buffers, buffer, NLSOUND::CBufferAL::bufferName(), deleteItem(), nlassert, and nlwarning. +

+Referenced by NLSOUND::CBufferAL::~CBufferAL(). +

+

00345 {
+00346         nlassert( buffer != NULL );
+00347         CBufferAL *bufferAL = dynamic_cast<CBufferAL*>(buffer);
+00348         if ( ! deleteItem( bufferAL->bufferName(), alDeleteBuffers, _Buffers ) )
+00349         {
+00350                 nlwarning( "Deleting buffer: name not found" );
+00351         }
+00352 }
+
+

+ + + + +
+ + + + + + + + + + +
void NLSOUND::CSoundDriverAL::removeSource ISource source  )  [protected, virtual]
+
+ + + + + +
+   + + +

+Remove a source. +

+ +

+Implements NLSOUND::ISoundDriver. +

+Definition at line 358 of file sound_driver_al.cpp. +

+References deleteItem(), nlassert, nlwarning, and NLSOUND::CSourceAL::sourceName(). +

+Referenced by NLSOUND::CSourceAL::~CSourceAL(). +

+

00359 {
+00360         nlassert( source != NULL );
+00361         CSourceAL *sourceAL = dynamic_cast<CSourceAL*>(source);
+00362         if ( ! deleteItem( sourceAL->sourceName(), alDeleteSources, _Sources ) )
+00363         {
+00364                 nlwarning( "Deleting source: name not found" );
+00365         }
+00366 }
+
+

+ + + + +
+ + + + + + + + + +
virtual void NLSOUND::CSoundDriverAL::startBench  )  [inline, virtual]
+
+ + + + + +
+   + + +

+ +

+Implements NLSOUND::ISoundDriver. +

+Definition at line 120 of file sound_driver_al.h. +

+

00120 { /* todo */ }
+
+

+ + + + +
+ + + + + + + + + + +
virtual void NLSOUND::CSoundDriverAL::writeProfile std::ostream &  out  )  [inline, virtual]
+
+ + + + + +
+   + + +

+Write information about the driver to the output stream. +

+ +

+Implements NLSOUND::ISoundDriver. +

+Definition at line 135 of file sound_driver_al.h. +

+

00135 {}
+
+


Field Documentation

+

+ + + + +
+ + +
std::vector<ALuint> NLSOUND::CSoundDriverAL::_Buffers [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 180 of file sound_driver_al.h. +

+Referenced by createBuffer(), init(), removeBuffer(), and ~CSoundDriverAL().

+

+ + + + +
+ + +
CSoundDriverAL * NLSOUND::CSoundDriverAL::_Instance = NULL [static, private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 123 of file sound_driver_al.cpp.

+

+ + + + +
+ + +
uint NLSOUND::CSoundDriverAL::_NbExpBuffers [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 186 of file sound_driver_al.h. +

+Referenced by createBuffer(), and init().

+

+ + + + +
+ + +
uint NLSOUND::CSoundDriverAL::_NbExpSources [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 189 of file sound_driver_al.h. +

+Referenced by createSource(), and init().

+

+ + + + +
+ + +
float NLSOUND::CSoundDriverAL::_RolloffFactor [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 192 of file sound_driver_al.h. +

+Referenced by applyRolloffFactor(), and createSource().

+

+ + + + +
+ + +
std::vector<ALuint> NLSOUND::CSoundDriverAL::_Sources [private] +
+
+ + + + + +
+   + + +

+ +

+Definition at line 183 of file sound_driver_al.h.

+

+ + + + +
+ + +
const uint32 NLSOUND::ISoundDriver::InterfaceVersion = 0x08 [static, inherited] +
+
+ + + + + +
+   + + +

+Version of the driver interface. To increment when the interface change. +

+ +

+Definition at line 48 of file sound_driver.cpp.

+


The documentation for this class was generated from the following files: +
Generated on Tue Mar 16 14:43:56 2004 for NeL by + +doxygen +1.3.6
+ + -- cgit v1.2.1