NLSOUND::ISoundDriver Class Reference

#include <sound_driver.h>

Inheritance diagram for NLSOUND::ISoundDriver:

NLSOUND::CSoundDriverAL NLSOUND::CSoundDriverDSound

Detailed Description

Abstract sound driver (implemented in sound driver dynamic library)

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.

The driver is a singleton. To access, only the pointer returned by createDriver() is provided.

Author:
Olivier Cado

Nevrax France

Date:
2001

Definition at line 115 of file sound_driver.h.

Public Member Functions

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

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

virtual IBuffercreateBuffer ()=0
 Create a sound buffer.

virtual IListenercreateListener ()=0
 Create the listener instance.

virtual ISourcecreateSource ()=0
 Create a source.

virtual void displayBench (NLMISC::CLog *log)=0
virtual void endBench ()=0
virtual bool readRawBuffer (IBuffer *destbuffer, const std::string &name, uint8 *rawData, uint dataSize, TSampleFormat format, uint32 frequency)=0
virtual bool readWavBuffer (IBuffer *destbuffer, const std::string &name, uint8 *wavData, uint dataSize)=0
 Temp.

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

virtual ~ISoundDriver ()
 Destructor.


Static Public Member Functions

ISoundDrivercreateDriver (bool useEax, IStringMapperProvider *stringMapper)

Static Public Attributes

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


Protected Member Functions

 ISoundDriver ()
 Constructor.

virtual void removeBuffer (IBuffer *buffer)=0
 Remove a buffer (should be called by the friend destructor of the buffer class).

virtual void removeSource (ISource *source)=0
 Remove a source (should be called by the friend destructor of the source class).


Constructor & Destructor Documentation

virtual NLSOUND::ISoundDriver::~ISoundDriver  )  [inline, virtual]
 

Destructor.

Definition at line 180 of file sound_driver.h.

00180 {}

NLSOUND::ISoundDriver::ISoundDriver  )  [inline, protected]
 

Constructor.

Definition at line 185 of file sound_driver.h.

00185 {}


Member Function Documentation

virtual void NLSOUND::ISoundDriver::commit3DChanges  )  [pure virtual]
 

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

Implemented in NLSOUND::CSoundDriverDSound, and NLSOUND::CSoundDriverAL.

Referenced by NLSOUND::CAudioMixerUser::update().

virtual uint NLSOUND::ISoundDriver::countMaxSources  )  [pure virtual]
 

Return the maximum number of sources that can created.

Implemented in NLSOUND::CSoundDriverDSound, and NLSOUND::CSoundDriverAL.

virtual IBuffer* NLSOUND::ISoundDriver::createBuffer  )  [pure virtual]
 

Create a sound buffer.

Implemented in NLSOUND::CSoundDriverDSound, and NLSOUND::CSoundDriverAL.

Referenced by NLSOUND::CAudioMixerUser::buildSampleBankList(), and NLSOUND::CSampleBank::load().

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

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 }

virtual IListener* NLSOUND::ISoundDriver::createListener  )  [pure virtual]
 

Create the listener instance.

Implemented in NLSOUND::CSoundDriverDSound, and NLSOUND::CSoundDriverAL.

Referenced by NLSOUND::CListenerUser::init().

virtual ISource* NLSOUND::ISoundDriver::createSource  )  [pure virtual]
 

Create a source.

Implemented in NLSOUND::CSoundDriverDSound, and NLSOUND::CSoundDriverAL.

Referenced by NLSOUND::CTrack::init().

virtual void NLSOUND::ISoundDriver::displayBench NLMISC::CLog log  )  [pure virtual]
 

Implemented in NLSOUND::CSoundDriverDSound, and NLSOUND::CSoundDriverAL.

Referenced by NLSOUND::CAudioMixerUser::displayDriverBench().

virtual void NLSOUND::ISoundDriver::endBench  )  [pure virtual]
 

Implemented in NLSOUND::CSoundDriverDSound, and NLSOUND::CSoundDriverAL.

Referenced by NLSOUND::CAudioMixerUser::endDriverBench().

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

Implemented in NLSOUND::CSoundDriverDSound, and NLSOUND::CSoundDriverAL.

Referenced by NLSOUND::CSampleBank::load().

virtual bool NLSOUND::ISoundDriver::readWavBuffer IBuffer destbuffer,
const std::string &  name,
uint8 wavData,
uint  dataSize
[pure virtual]
 

Temp.

Implemented in NLSOUND::CSoundDriverDSound, and NLSOUND::CSoundDriverAL.

Referenced by NLSOUND::CAudioMixerUser::buildSampleBankList(), and NLSOUND::CAsyncFileManagerSound::CLoadWavFile::run().

virtual void NLSOUND::ISoundDriver::removeBuffer IBuffer buffer  )  [protected, pure virtual]
 

Remove a buffer (should be called by the friend destructor of the buffer class).

Implemented in NLSOUND::CSoundDriverDSound, and NLSOUND::CSoundDriverAL.

virtual void NLSOUND::ISoundDriver::removeSource ISource source  )  [protected, pure virtual]
 

Remove a source (should be called by the friend destructor of the source class).

Implemented in NLSOUND::CSoundDriverDSound, and NLSOUND::CSoundDriverAL.

virtual void NLSOUND::ISoundDriver::startBench  )  [pure virtual]
 

Implemented in NLSOUND::CSoundDriverDSound, and NLSOUND::CSoundDriverAL.

Referenced by NLSOUND::CAudioMixerUser::startDriverBench().

virtual void NLSOUND::ISoundDriver::writeProfile std::ostream &  out  )  [pure virtual]
 

Write information about the driver to the output stream.

Implemented in NLSOUND::CSoundDriverDSound, and NLSOUND::CSoundDriverAL.

Referenced by NLSOUND::CAudioMixerUser::writeProfile().


Field Documentation

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

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:51:45 2004 for NeL by doxygen 1.3.6