#include <sound_driver.h>
Inheritance diagram for NLSOUND::ISoundDriver:
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.
Nevrax France
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 IBuffer * | createBuffer ()=0 |
Create a sound buffer. | |
virtual IListener * | createListener ()=0 |
Create the listener instance. | |
virtual ISource * | createSource ()=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 | |
ISoundDriver * | createDriver (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). |
|
Destructor.
Definition at line 180 of file sound_driver.h.
00180 {} |
|
Constructor.
Definition at line 185 of file sound_driver.h.
00185 {} |
|
Commit all the changes made to 3D settings of listener and sources.
Implemented in NLSOUND::CSoundDriverDSound, and NLSOUND::CSoundDriverAL. Referenced by NLSOUND::CAudioMixerUser::update(). |
|
Return the maximum number of sources that can created.
Implemented in NLSOUND::CSoundDriverDSound, and NLSOUND::CSoundDriverAL. |
|
Create a sound buffer.
Implemented in NLSOUND::CSoundDriverDSound, and NLSOUND::CSoundDriverAL. Referenced by NLSOUND::CAudioMixerUser::buildSampleBankList(), and NLSOUND::CSampleBank::load(). |
|
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 } |
|
Create the listener instance.
Implemented in NLSOUND::CSoundDriverDSound, and NLSOUND::CSoundDriverAL. Referenced by NLSOUND::CListenerUser::init(). |
|
Create a source.
Implemented in NLSOUND::CSoundDriverDSound, and NLSOUND::CSoundDriverAL. Referenced by NLSOUND::CTrack::init(). |
|
Implemented in NLSOUND::CSoundDriverDSound, and NLSOUND::CSoundDriverAL. Referenced by NLSOUND::CAudioMixerUser::displayDriverBench(). |
|
Implemented in NLSOUND::CSoundDriverDSound, and NLSOUND::CSoundDriverAL. Referenced by NLSOUND::CAudioMixerUser::endDriverBench(). |
|
Implemented in NLSOUND::CSoundDriverDSound, and NLSOUND::CSoundDriverAL. Referenced by NLSOUND::CSampleBank::load(). |
|
Temp.
Implemented in NLSOUND::CSoundDriverDSound, and NLSOUND::CSoundDriverAL. Referenced by NLSOUND::CAudioMixerUser::buildSampleBankList(), and NLSOUND::CAsyncFileManagerSound::CLoadWavFile::run(). |
|
Remove a buffer (should be called by the friend destructor of the buffer class).
Implemented in NLSOUND::CSoundDriverDSound, and NLSOUND::CSoundDriverAL. |
|
Remove a source (should be called by the friend destructor of the source class).
Implemented in NLSOUND::CSoundDriverDSound, and NLSOUND::CSoundDriverAL. |
|
Implemented in NLSOUND::CSoundDriverDSound, and NLSOUND::CSoundDriverAL. Referenced by NLSOUND::CAudioMixerUser::startDriverBench(). |
|
Write information about the driver to the output stream.
Implemented in NLSOUND::CSoundDriverDSound, and NLSOUND::CSoundDriverAL. Referenced by NLSOUND::CAudioMixerUser::writeProfile(). |
|
Version of the driver interface. To increment when the interface change.
Definition at line 48 of file sound_driver.cpp. |