#include <audio_mixer_user.h>
Inheritance diagram for NLSOUND::CAudioMixerUser:
The logical sources (_Sources) are the sources representing all entities in the world, from the client's point of view. The tracks (_Tracks) are the physical sources played by the sound driver. Their number is small.
When there are more sources than tracks, the process of choosing which sources go into the tracks is called "balancing". The source are auto-balanced according to the argument passed to init(). The sources are also balanced when
Important: The user is responsible for deleting the sources that have been allocated by createSource(), before deleting the audio mixer object.
Nevrax France
Definition at line 108 of file audio_mixer_user.h.
Public Member Functions | |
void | addEvent (IMixerEvent *pmixerEvent, const NLMISC::TTime &date) |
Add an event in the future. | |
void | addSource (CSourceCommon *source) |
Add a source which was created by an EnvSound. | |
void | addSourceWaitingForPlay (CSimpleSource *source) |
Add a source for play as possible (for non discadable sound). | |
void | addUserControledSource (CSourceCommon *source, NLMISC::TStringId varName) |
void | applyListenerMove (const NLMISC::CVector &listenerpos) |
Take a listener's move into account. | |
void | bufferUnloaded (IBuffer *buffer) |
void | buildSampleBankList () |
Load environmental effects. | |
CAudioMixerUser () | |
Constructor. | |
virtual USource * | createSource (TSoundId id, bool spawn=false, TSpawnEndCallback cb=NULL, void *cbUserParam=NULL, NL3D::CCluster *cluster=0, CSoundContext *context=0) |
Add a logical sound source (by sound id). To remove a source, just delete it. See createSource(const char*). | |
virtual USource * | createSource (const NLMISC::TStringId &name, bool spawn=false, TSpawnEndCallback cb=NULL, void *cbUserParam=NULL, NL3D::CCluster *cluster=0, CSoundContext *context=0) |
uint32 | curTime () |
void | decPlayingSource () |
void | decPlayingSourceMuted () |
virtual void | displayDriverBench (NLMISC::CLog *log) |
virtual void | enable (bool b) |
Disables or reenables the sound. | |
virtual void | endDriverBench () |
void | freeTrack (CTrack *track) |
virtual uint | getAvailableTracksCount () const |
Return the number of available tracks. | |
const TBackgroundFilterFades & | getBackgroundFilterFades () |
virtual const std::string & | getBackgroundFlagName (uint flagIndex) |
const TBackgroundFlags & | getBackgroundFlags () |
virtual const std::string & | getBackgroundFlagShortName (uint flagIndex) |
CBackgroundSoundManager * | getBackgroundSoundManager () |
CClusteredSound * | getClusteredSound () |
CTrack * | getFreeTrack (CSimpleSource *source) |
virtual UListener * | getListener () |
Return the listener interface. | |
const NLMISC::CVector & | getListenPosVector () const |
Return the listen pos vector. | |
virtual void | getLoadedSampleBankInfo (std::vector< std::pair< std::string, uint > > &result) |
virtual uint32 | getLoadedSampleSize () |
virtual uint | getMutedPlayingSourcesCount () const |
Return the number muted playing source. | |
std::string & | getPackedSheetPath () |
bool | getPackedSheetUpdate () |
virtual uint | getPlayingSourcesCount () const |
Return the number of playing sources (slow). | |
virtual uint | getPolyphony () const |
Return the number of mixing tracks (voices). | |
ISoundDriver * | getSoundDriver () |
Return the sound driver. | |
virtual TSoundId | getSoundId (const NLMISC::TStringId &name) |
Get a TSoundId from a name (returns NULL if not found). | |
virtual void | getSoundNames (std::vector< NLMISC::TStringId > &names) const |
Return the names of the sounds (call this method after loadSounds()). | |
virtual uint | getSourcesInstanceCount () const |
Return the number of sources instance. | |
virtual std::string | getSourcesStats () const |
Return a string showing the playing sources (slow). | |
virtual uint | getUsedTracksCount () const |
Return the number of used tracks. | |
float | getUserVar (NLMISC::TStringId varName) |
Return the current value of a user var. | |
void | incPlayingSource () |
void | incPlayingSourceMuted () |
virtual void | init (uint maxTrack, bool useEax, bool useADPCM, NLMISC::IProgressCallback *progressCallBack, bool autoLoadSample=false) |
virtual void | initClusteredSound (NL3D::CScene *scene, float minGain, float maxDistance, float portalInterpolate) |
virtual void | initClusteredSound (NL3D::UScene *uscene, float minGain, float maxDistance, float portalInterpolate) |
void | initUserVar () |
Read all user controled var sheets. | |
virtual void | loadBackgroundAudioFromPrimitives (const NLLIGO::IPrimitive &audioRoot) |
virtual void | loadBackgroundEffectsFromRegion (const NLLIGO::CPrimRegion ®ion) |
Deprecated. | |
virtual void | loadBackgroundSamplesFromRegion (const NLLIGO::CPrimRegion ®ion) |
Deprecated. | |
virtual void | loadBackgroundSound (const std::string &continent, NLLIGO::CLigoConfig &config) |
virtual void | loadBackgroundSoundFromRegion (const NLLIGO::CPrimRegion ®ion) |
Deprecated. | |
virtual uint32 | loadSampleBank (bool async, const std::string &name, std::vector< std::string > *notfoundfiles=NULL) |
virtual void | playBackgroundSound () |
void | registerBufferAssoc (CSound *sound, IBuffer *buffer) |
void | registerUpdate (IMixerUpdate *pmixerUpdate) |
Register an object in the update list. | |
virtual void | reloadSampleBanks (bool async) |
void | removeEvents (IMixerEvent *pmixerEvent) |
Remove any event programmed for this object. | |
virtual void | removeSource (CSourceCommon *source) |
void | removeUserControledSource (CSourceCommon *source, NLMISC::TStringId varName) |
virtual void | reset () |
Resets the audio system (deletes all the sources, include envsounds). | |
virtual void | selectEnvEffects (const std::string &tag) |
Choose the environmental effect(s) corresponding to tag. | |
void | setBackgroundFilterFades (const TBackgroundFilterFades &backgroundFilterFades) |
virtual void | setBackgroundFlagName (uint flagIndex, const std::string &flagName) |
void | setBackgroundFlags (const TBackgroundFlags &backgroundFlags) |
virtual void | setBackgroundFlagShortName (uint flagIndex, const std::string &flagShortName) |
virtual void | setListenerPos (const NLMISC::CVector &pos) |
Release track. | |
virtual void | setLowWaterMark (uint value) |
virtual void | setPackedSheetOption (const std::string &path, bool update) |
virtual void | setPriorityReserve (TSoundPriority priorityChannel, uint reserve) |
virtual void | setSamplePath (const std::string &path) |
Set the global path to the sample banks. | |
void | setUserVar (NLMISC::TStringId varName, float value) |
virtual void | startDriverBench () |
virtual void | stopBackgroundSound () |
virtual bool | unloadSampleBank (const std::string &name) |
void | unregisterBufferAssoc (CSound *sound, IBuffer *buffer) |
void | unregisterUpdate (IMixerUpdate *pmixerUpdate) |
Unregister an object from the update list. | |
virtual void | update () |
Update audio mixer (call evenly). | |
bool | useAPDCM () |
virtual void | writeProfile (std::ostream &out) |
Write profiling information about the mixer to the output stream. | |
virtual | ~CAudioMixerUser () |
Destructor. | |
IStringMapperProvider implementation | |
map a string | |
const NLMISC::TStringId | map (const std::string &str) |
map a string | |
const std::string & | unmap (const NLMISC::TStringId &stringId) |
unmap a string | |
Static Public Member Functions | |
CAudioMixerUser * | instance () |
Return the audio mixer object. | |
Move the primitive. | |
UAudioMixer * | createAudioMixer () |
Create the audio mixer singleton and return a pointer to its instance. | |
Data Fields | |
uint32 | _CreateCount |
double | _CreateTime |
bool | _Leaving |
Flag set in destructor. | |
uint | _MaxNbTracks |
Max _NbTracks. | |
uint | _NbTracks |
Size of the physical sources array (must be <= MAX_TRACKS). | |
uint32 | _PlayingSources |
Number of source currently playing. | |
uint32 | _PlayingSourcesMuted |
Number of source doing muted play. | |
TSourceContainer | _Sources |
All Logical sources. | |
NLMISC::TTicks | _StartTime |
CTrack * | _Tracks [MAX_TRACKS] |
Physical sources array. | |
uint32 | _UpdateCount |
double | _UpdateTime |
Protected Types | |
typedef std::hash_map< NLMISC::TStringId, CControledSources > | TUserVarControlsContainer |
Protected Member Functions | |
void | getFreeTracks (uint nb, CTrack **tracks) |
Returns nb available tracks (or NULL). | |
virtual void | getPlayingSoundsPos (bool virtualPos, std::vector< std::pair< bool, NLMISC::CVector > > &pos) |
Fill a vector of position and mute flag for all playing sound source. | |
Protected Attributes | |
TTimedEventContainer | _EventList |
List of event ordered by time. | |
std::vector< std::pair< NLMISC::TTime, IMixerEvent * > > | _EventListUpdate |
List of update for the event list. | |
TEventContainer | _Events |
List of event ordered by event ptr with there respective multimap iterator. | |
std::vector< std::pair< IMixerUpdate *, bool > > | _UpdateEventList |
List of update to add or remove (bool param of the pair). | |
TMixerUpdateContainer | _UpdateList |
List of object to update. | |
TUserVarControlsContainer | _UserVarControls |
Container for all user controler and currently controled playing source. | |
Private Types | |
typedef std::hash_map< IBuffer *, std::vector< class CSound * >, THashPtr< IBuffer * > > | TBufferToSourceContainer |
enum | TControledParamId { gain_control, pitch_control, nb_control, bad_control } |
Identify the parameter controled by user var. More... | |
typedef std::multimap< IMixerEvent *, TTimedEventContainer::iterator > | TEventContainer |
typedef std::hash_set< IMixerUpdate *, THashPtr< IMixerUpdate * > > | TMixerUpdateContainer |
typedef std::hash_set< CSourceCommon *, THashPtr< CSourceCommon * > > | TSourceContainer |
typedef std::multimap< NLMISC::TTime, NLMISC::CDbgPtr< IMixerEvent > > | TTimedEventContainer |
Private Member Functions | |
bool | CAudioMixerUser::tryToLoadSoundBank (const std::string &sampleName) |
Private Attributes | |
bool | _AutoLoadSample |
flag for automatic sample bank loading. | |
std::string | _BackgroundFilterNames [TBackgroundFlags::NB_BACKGROUND_FLAGS] |
Array of filter name. | |
std::string | _BackgroundFilterShortNames [TBackgroundFlags::NB_BACKGROUND_FLAGS] |
Array of filter short names. | |
CBackgroundSoundManager * | _BackgroundSoundManager |
Intance of the background sound manager. | |
TBufferToSourceContainer | _BufferToSources |
Assoc between buffer and source. Used when buffers are unloaded. | |
CClusteredSound * | _ClusteredSound |
Instance of the clustered sound system. | |
std::vector< CTrack * > | _FreeTracks |
The vector of curently free tracks. | |
CListenerUser | _Listener |
The listener instance. | |
NLMISC::CVector | _ListenPosition |
Listener position vector. | |
uint32 | _LowWaterMark |
Low water mark. After this number of free voice is reach, reserve can't be overloaded. | |
std::string | _PackedSheetPath |
The path to the packed sheet files. | |
uint32 | _PriorityReserve [NbSoundPriorities] |
Table of track reserve for each priority. | |
uint32 | _ReserveUsage [NbSoundPriorities] |
Table of current playing source for each priority. | |
std::string | _SamplePath |
The path to the sample banks. This should be specified in the config file. | |
ISoundDriver * | _SoundDriver |
The sound driver instance. | |
std::list< CSimpleSource * > | _SourceWaitingForPlay |
The list of non discardable sound to play as soon as possible in order of arrival. | |
bool | _UpdatePackedSheet |
A flag to update or not the packed sheet. | |
bool | _UseADPCM |
flag for usage of ADPCM mixing | |
bool | _UseEax |
flag for usage of eax | |
Static Private Attributes | |
CAudioMixerUser * | _Instance = NULL |
The audio mixer singleton instance. | |
Friends | |
struct | CControledSources |
class | CUserVarSerializer |
struct | displaySoundInfoClass |
|
Definition at line 384 of file audio_mixer_user.h. |
|
Definition at line 387 of file audio_mixer_user.h. |
|
Definition at line 383 of file audio_mixer_user.h. |
|
Definition at line 382 of file audio_mixer_user.h. |
|
Definition at line 386 of file audio_mixer_user.h. |
|
Definition at line 433 of file audio_mixer_user.h. |
|
Identify the parameter controled by user var.
Definition at line 390 of file audio_mixer_user.h.
00391 { 00392 gain_control, 00393 pitch_control, 00394 nb_control, 00395 bad_control 00396 }; |
|
Constructor.
Definition at line 112 of file audio_mixer_user.cpp. References _BackgroundFilterNames, _BackgroundFilterShortNames, _CreateCount, _CreateTime, _UpdateCount, _UpdateTime, nlerror, and uint.
00112 : _SoundDriver(NULL), 00113 _ListenPosition(CVector::Null), 00114 _NbTracks(0), 00115 _MaxNbTracks(0), 00116 _Leaving(false), 00117 _BackgroundSoundManager(0), 00118 _PlayingSources(0), 00119 _PlayingSourcesMuted(0), 00120 _ClusteredSound(0), 00121 _PackedSheetPath(""), 00122 _UseADPCM(true), 00123 _AutoLoadSample(false) 00124 { 00125 if ( _Instance == NULL ) 00126 { 00127 _Instance = this; 00128 00129 #if NL_PROFILE_MIXER 00130 _UpdateTime = 0.0; 00131 _CreateTime = 0.0; 00132 _UpdateCount = 0; 00133 _CreateCount = 0; 00134 #endif 00135 00136 } 00137 else 00138 { 00139 nlerror( "Audio mixer singleton instanciated twice" ); 00140 } 00141 00142 00143 // init the filter names and short names 00144 for (uint i=0; i<TBackgroundFlags::NB_BACKGROUND_FLAGS; ++i) 00145 { 00146 char tmp[1024]; 00147 sprintf(tmp, "Filter%2u", i); 00148 _BackgroundFilterNames[i] = tmp; 00149 sprintf(tmp, "%u", i); 00150 _BackgroundFilterShortNames[i] = tmp; 00151 } 00152 } |
|
Destructor.
Definition at line 157 of file audio_mixer_user.cpp. References _BackgroundSoundManager, _ClusteredSound, _Leaving, _NbTracks, _SoundDriver, nldebug, reset(), and uint.
00158 { 00159 nldebug( "AM: Releasing..." ); 00160 00161 if (_ClusteredSound != 0) 00162 delete _ClusteredSound; 00163 00164 if (_BackgroundSoundManager != 0) 00165 delete _BackgroundSoundManager; 00166 // CBackgroundSoundManager::release(); 00167 00168 reset(); 00169 00170 _Leaving = true; 00171 00172 // Release the sound bank 00173 CSoundBank::release(); 00174 // Release all the SampleBanks 00175 CSampleBank::releaseAll(); 00176 00177 // Tracks 00178 uint i; 00179 for ( i=0; i!=_NbTracks; i++ ) 00180 { 00181 if ( _Tracks[i] ) 00182 delete _Tracks[i]; 00183 } 00184 00185 // Sound driver 00186 if ( _SoundDriver != NULL ) 00187 delete _SoundDriver; 00188 00189 _Instance = NULL; 00190 00191 nldebug( "AM: Released" ); 00192 } |
|
Add an event in the future.
Definition at line 2068 of file audio_mixer_user.cpp. References _EventListUpdate, nlassert, and NLMISC::TTime. Referenced by NLSOUND::CComplexSource::onEvent(), NLSOUND::CComplexSource::onUpdate(), NLSOUND::CSimpleSource::play(), and NLSOUND::CComplexSource::playStuf().
02069 { 02070 nlassert(pmixerEvent != 0); 02071 // nldebug("Adding event %p", pmixerEvent); 02072 _EventListUpdate.push_back(make_pair(date, pmixerEvent)); 02073 } |
|
Add a source which was created by an EnvSound.
Definition at line 1517 of file audio_mixer_user.cpp. References _Sources, and nlassert.
01518 { 01519 nlassert(_Sources.find(source) == _Sources.end()); 01520 _Sources.insert( source ); 01521 01522 // _profile(( "AM: ADDSOURCE, SOUND: %d, TRACK: %p, NAME=%s", source->getSound(), source->getTrack(), 01523 // source->getSound() && (source->getSound()->getName()!="") ? source->getSound()->getName().c_str() : "" )); 01524 01525 } |
|
Add a source for play as possible (for non discadable sound).
Definition at line 280 of file audio_mixer_user.cpp. References _SourceWaitingForPlay. Referenced by NLSOUND::CSimpleSource::play().
00281 { 00282 _SourceWaitingForPlay.push_back(source); 00283 } |
|
Definition at line 1017 of file audio_mixer_user.cpp. References _UserVarControls, gain_control, NLSOUND::CSound::getGain(), NLSOUND::CSourceCommon::getRelativeGain(), NLSOUND::USource::getSound(), NLSOUND::CSourceCommon::setGain(), NLSOUND::CSourceCommon::setPitch(), and NLSOUND::CSourceCommon::setRelativeGain().
01018 { 01019 TUserVarControlsContainer::iterator it(_UserVarControls.find(varName)); 01020 if (it != _UserVarControls.end()) 01021 { 01022 // ok, the var exist, insert this source 01023 it->second.Sources.insert(source); 01024 // update the controled parameter 01025 if (it->second.ParamId == gain_control) 01026 { 01027 float relGain = source->getRelativeGain(); 01028 float gain = source->getSound()->getGain(); 01029 source->setGain(gain * it->second.Value); 01030 source->setRelativeGain(relGain); 01031 } 01032 else 01033 { 01034 source->setPitch(it->second.Value); 01035 } 01036 } 01037 } |
|
Take a listener's move into account.
Definition at line 1122 of file audio_mixer_user.cpp. References _BackgroundSoundManager, _ListenPosition, and NLSOUND::CBackgroundSoundManager::updateBackgroundStatus().
01123 { 01124 // Store position 01125 _ListenPosition = listenerpos; 01126 01127 _BackgroundSoundManager->updateBackgroundStatus(); 01128 01129 // Environmental effect 01130 // computeEnvEffect( listenerpos ); 01131 01132 /* // Environment sounds 01133 if ( _EnvSounds != NULL ) 01134 { 01135 _EnvSounds->recompute(); 01136 } 01137 */ 01138 } |
|
Definition at line 1052 of file audio_mixer_user.cpp. References _NbTracks, buffer, NLSOUND::CSimpleSource::getBuffer(), NLSOUND::CTrack::getSource(), NLSOUND::CSimpleSource::stop(), and uint.
01053 { 01054 // check all track to find a track playing this buffer. 01055 uint i; 01056 for ( i=0; i!=_NbTracks; ++i ) 01057 { 01058 CTrack *track = _Tracks[i]; 01059 if ( track && track->getSource()) 01060 { 01061 if (track->getSource()->getBuffer() == buffer) 01062 { 01063 track->getSource()->stop(); 01064 } 01065 } 01066 } 01067 01068 } |
|
Load environmental effects.
Definition at line 560 of file audio_mixer_user.cpp. References _SamplePath, _SoundDriver, NLSOUND::CAudioMixerUser::TSampleBankHeader::addSample(), buffer, NLSOUND::ISoundDriver::createBuffer(), data, NLMISC::CIFile::getFileSize(), NLSOUND::CAudioMixerUser::TSampleBankHeader::Name, nlassert, nldebug, nlinfo, NLSOUND::ISoundDriver::readWavBuffer(), NLMISC::IStream::serial(), NLMISC::COFile::serialBuffer(), NLMISC::CIFile::serialBuffer(), size, NLSOUND::TSampleFormat, uint, uint32, and uint8. Referenced by init(), and reloadSampleBanks().
00561 { 00562 NL_ALLOC_CONTEXT(NLSOUND_UAudioMixer); 00563 uint i; 00564 // regenerate the sample banks list 00565 const std::string &sp = _SamplePath; 00566 00567 // build the list of available sample bank directory 00568 vector<string> bankDir; 00569 CPath::getPathContent(sp, false, true, false, bankDir); 00570 sort(bankDir.begin(), bankDir.end()); 00571 for (i=0; i<bankDir.size(); ++i) 00572 { 00573 if (bankDir[i].empty()) 00574 { 00575 bankDir.erase(bankDir.begin()+i); 00576 --i; 00577 } 00578 } 00579 for (i=0; i<bankDir.size(); ++i) 00580 { 00581 nldebug("Found sample bank dir [%s]", bankDir[i].c_str()); 00582 } 00583 00584 // build the list of available sample bank file 00585 vector<string> bankFile; 00586 CPath::getPathContent(sp, false, false, true, bankFile); 00587 // filter ou any non sample bank file 00588 for (i=0; i<bankFile.size(); ++i) 00589 { 00590 if (bankFile[i].find(".sample_bank") != bankFile[i].size() - 12) 00591 { 00592 bankFile.erase(bankFile.begin()+i); 00593 --i; 00594 } 00595 } 00596 sort(bankFile.begin(), bankFile.end()); 00597 for (i=0; i<bankFile.size(); ++i) 00598 { 00599 nldebug("Found sample bank file [%s]", bankFile[i].c_str()); 00600 } 00601 00602 // now, do a one to one comparison on bank file and sample file date 00603 for (i=0; i<bankDir.size(); ++i) 00604 { 00605 string bankname = bankDir[i]; 00606 if (bankname[bankname.size()-1] == '/') 00607 bankname = bankname.substr(0, bankname.size()-1); 00608 00609 bankname = bankname.substr(bankname.rfind('/')+1); 00610 00611 if (i >= bankFile.size() || CFile::getFilenameWithoutExtension(bankFile[i]) > bankname) 00612 { 00613 nlinfo("Compiling sample bank [%s]", bankname.c_str()); 00614 // need to create a new bank file ! 00615 TSampleBankHeader hdr; 00616 00617 vector<string> sampleList; 00618 CPath::getPathContent(bankDir[i], false, false, true, sampleList); 00619 // remove any non wav file 00620 uint j; 00621 for (j=0; j<sampleList.size(); ++j) 00622 { 00623 if (sampleList[j].find(".wav") != sampleList[j].size()-4) 00624 { 00625 sampleList.erase(sampleList.begin()+j); 00626 --j; 00627 } 00628 } 00629 sort(sampleList.begin(), sampleList.end()); 00630 00631 vector<vector<uint8> > adpcmBuffers(sampleList.size()); 00632 vector<vector<sint16> > mono16Buffers(sampleList.size()); 00633 00634 for (j=0; j<sampleList.size(); ++j) 00635 { 00636 nldebug(" Adding sample [%s] into bank", CFile::getFilename(sampleList[j]).c_str()); 00637 CIFile sample (sampleList[j]); 00638 uint8 *data = new uint8[sample.getFileSize()]; 00639 sample.serialBuffer(data, sample.getFileSize()); 00640 IBuffer *buffer = _SoundDriver->createBuffer(); 00641 buffer->presetName(CStringMapper::map(CFile::getFilenameWithoutExtension(sampleList[j]))); 00642 _SoundDriver->readWavBuffer(buffer, CFile::getFilenameWithoutExtension(sampleList[j]), data, sample.getFileSize()); 00643 vector<uint8> adpcmData; 00644 uint32 nbSample = buffer->getBufferADPCMEncoded(adpcmData); 00645 vector<sint16> mono16Data; 00646 buffer->getBufferMono16(mono16Data); 00647 // Sample number MUST be even 00648 nlassert(nbSample == (nbSample & 0xfffffffe)); 00649 nlassert(adpcmData.size() == nbSample/2); 00650 adpcmBuffers[j].swap(adpcmData); 00651 mono16Buffers[j].swap(mono16Data); 00652 00653 TSampleFormat sf; 00654 uint freq; 00655 buffer->getFormat(sf, freq); 00656 00657 // hdrAdpcm.addSample(CFile::getFilename(sampleList[j]), freq, nbSample, ); 00658 hdr.addSample(CFile::getFilename(sampleList[j]), freq, nbSample, mono16Buffers[j].size()*2, adpcmBuffers[j].size()); 00659 delete [] data; 00660 } 00661 00662 // write the sample bank (if any sample available) 00663 if (!hdr.Name.empty()) 00664 { 00665 string filename = sp+bankname+".sample_bank"; 00666 COFile sbf(filename); 00667 sbf.serial(hdr); 00668 // nldebug("Header seeking = %i", sbf.getPos()); 00669 nlassert(mono16Buffers.size() == adpcmBuffers.size()); 00670 for (j=0; j<mono16Buffers.size(); ++j) 00671 { 00672 sbf.serialBuffer((uint8*)(&mono16Buffers[j][0]), mono16Buffers[j].size()*2); 00673 sbf.serialBuffer((uint8*)(&adpcmBuffers[j][0]), adpcmBuffers[j].size()); 00674 // sbf.serialCont(mono16Buffers[j]); 00675 // sbf.serialCont(adpcmBuffers[j]); 00676 } 00677 // NB : the next commented line replaced by the next two line. 00678 // The first generate an access violation at the 64th insert ! 00679 // bankFile.insert(bankFile.begin()+i, filename); 00680 bankFile.insert(bankFile.begin()+i); 00681 bankFile[i] = filename; 00682 } 00683 } 00684 else if (bankname < CFile::getFilenameWithoutExtension(bankDir[i])) 00685 { 00686 nlinfo("Removing sample bank file [%s]", bankname.c_str()); 00687 // remove an out of date bank file 00688 CFile::deleteFile(bankFile[i]); 00689 bankFile.erase(bankFile.begin()+i); 00690 // recheck on this index 00691 --i; 00692 } 00693 else 00694 { 00695 bool upToDate = true; 00696 // check file list and date 00697 nlassert(bankname == CFile::getFilenameWithoutExtension(bankFile[i])); 00698 00699 // read the sample bank file header. 00700 try 00701 { 00702 CIFile sbf(bankFile[i]); 00703 TSampleBankHeader hdr; 00704 sbf.serial(hdr); 00705 00706 vector<string> sampleList; 00707 CPath::getPathContent(bankDir[i], false, false, true, sampleList); 00708 sort(sampleList.begin(), sampleList.end()); 00709 if (sampleList.size() == hdr.Name.size()) 00710 { 00711 for (uint j=0; j<sampleList.size(); ++j) 00712 { 00713 // check same filename 00714 if (CFile::getFilename(sampleList[j]) != hdr.Name[j]) 00715 { 00716 upToDate = false; 00717 break; 00718 } 00719 // check modification date 00720 if (CFile::getFileModificationDate(sampleList[j]) >= CFile::getFileModificationDate(bankFile[i])) 00721 { 00722 upToDate = false; 00723 break; 00724 } 00725 } 00726 } 00727 } 00728 catch(Exception e) 00729 { 00730 upToDate = false; 00731 } 00732 00733 if (!upToDate) 00734 { 00735 nlinfo("Need to update bank file [%s]", bankname.c_str()); 00736 CFile::deleteFile(bankFile[i]); 00737 bankFile.erase(bankFile.begin()+i); 00738 // recheck on this index 00739 --i; 00740 } 00741 } 00742 } 00743 // clear any out of date bank file 00744 for (; i<bankFile.size(); ++i) 00745 { 00746 CFile::deleteFile(bankFile[i]); 00747 } 00748 00749 00750 /* 00751 // clear the exisiting list file 00752 { 00753 vector<string> fileList; 00754 CPath::getPathContent(sp, false, false, true, fileList); 00755 00756 for (uint i=0; i<fileList.size(); ++i) 00757 { 00758 if (fileList[i].find(".sample_bank_list") == fileList[i].size() - 17) 00759 { 00760 CFile::deleteFile(fileList[i]); 00761 } 00762 } 00763 } 00764 00765 std::vector <std::string> dirList; 00766 if(!sp.empty()) 00767 CPath::getPathContent(sp, false, true, false, dirList); 00768 00769 while (!dirList.empty()) 00770 { 00771 nldebug("Generating sample bank list for %s", dirList.back().c_str()); 00772 std::vector<std::string> sampleList; 00773 CPath::getPathContent(dirList.back(), true, false, true, sampleList); 00774 00775 for (uint i=0; i< sampleList.size(); ++i) 00776 { 00777 sampleList[i] = CFile::getFilename(sampleList[i]); 00778 nldebug("+- Adding sample %s to bank", sampleList[i].c_str()); 00779 } 00780 00781 std::vector<std::string> temp; 00782 NLMISC::explode(dirList.back(), "/", temp, true); 00783 nlassert(!temp.empty()); 00784 std::string listName(temp.back()); 00785 00786 COFile file(_SamplePath+listName+SampleBankListExt); 00787 file.serialCont(sampleList); 00788 dirList.pop_back(); 00789 } 00790 */ 00791 // update the searh path content 00792 bool compressed = CPath::isMemoryCompressed(); 00793 if (!compressed) 00794 CPath::addSearchPath(_SamplePath); 00795 } |
|
|
|
Create the audio mixer singleton and return a pointer to its instance.
Definition at line 103 of file audio_mixer_user.cpp.
00104 { 00105 NL_ALLOC_CONTEXT(NLSOUND_UAudioMixer); 00106 return new CAudioMixerUser(); 00107 } |
|
Add a logical sound source (by sound id). To remove a source, just delete it. See createSource(const char*).
Implements NLSOUND::UAudioMixer. Definition at line 1576 of file audio_mixer_user.cpp. References _AutoLoadSample, _CreateCount, _CreateTime, _ListenPosition, _profile, NLSOUND::checkSound(), count, createSource(), curTime(), NLSOUND::CSimpleSource::getBuffer(), NLSOUND::CSimpleSound::getBuffer(), NLSOUND::CSimpleSound::getBuffername(), NLSOUND::CContextSound::getContextSound(), NLSOUND::CSound::getGain(), NLSOUND::USource::getGain(), NLSOUND::CSound::getPitch(), NLSOUND::USource::getPitch(), id, NLSOUND::IBuffer::isStereo(), nlassert, nlwarning, NLSOUND::CSourceCommon::set3DPositionVector(), NLSOUND::USource::setGain(), NLSOUND::USource::setPitch(), NLSOUND::TSoundId, NLSOUND::TSpawnEndCallback, uint, and uint32.
01577 { 01578 NL_ALLOC_CONTEXT(NLSOUND_UAudioMixer); 01579 #if NL_PROFILE_MIXER 01580 TTicks start = CTime::getPerformanceTime(); 01581 #endif 01582 01583 _profile(( "AM: [%u]---------------------------------------------------------------", curTime() )); 01584 _profile(( "AM: CREATESOURCE: SOUND=%p, NAME=%s, TIME=%d", id, id->getName().c_str(), curTime() )); 01585 _profile(( "AM: SOURCES: %d, PLAYING: %d, TRACKS: %d", getSourcesNumber(), getPlayingSourcesNumber(), getNumberAvailableTracks() )); 01586 01587 if ( id == NULL ) 01588 { 01589 _profile(("AM: FAILED CREATESOURCE")); 01590 // nldebug( "AM: Sound not created: invalid sound id" ); 01591 return NULL; 01592 } 01593 01594 USource *ret = NULL; 01595 01596 if (_AutoLoadSample) 01597 { 01598 if (id->getSoundType() == CSound::SOUND_SIMPLE) 01599 { 01600 CSimpleSound *ss = (CSimpleSound*)id; 01601 if (ss->getBuffer() == NULL) 01602 { 01603 const string sampleName = CStringMapper::unmap(ss->getBuffername()) + ".wav"; 01604 01605 tryToLoadSoundBank(sampleName); 01606 } 01607 } 01608 else 01609 { 01610 uint32 count = 0; 01611 retrySound: 01612 ++count; 01613 vector<pair<string, CSound*> > subsounds; 01614 id->getSubSoundList(subsounds); 01615 vector<string> missingFiles; 01616 // check the sound before anythink else 01617 bool invalid = !checkSound(id, subsounds, missingFiles); 01618 01619 if (invalid) 01620 { 01621 nlwarning("The sound %s contain an infinite recursion !", CStringMapper::unmap(id->getName()).c_str()); 01622 return NULL; 01623 } 01624 01625 if (!missingFiles.empty()/* && count <= missingFiles.size()*/) 01626 { 01627 // try to load missing sample bank 01628 for (uint i=0; i<missingFiles.size(); ++i) 01629 { 01630 if (missingFiles[i].find(" (sample)") != string::npos) 01631 { 01632 // try to find the sample bank 01633 string sample = missingFiles[i].substr(0, missingFiles[i].find(" (sample)")) + ".wav"; 01634 01635 if (tryToLoadSoundBank(sample)) 01636 goto retrySound; 01637 } 01638 } 01639 } 01640 } 01641 } 01642 01643 if (id->getSoundType() == CSound::SOUND_SIMPLE) 01644 { 01645 CSimpleSound *simpleSound = static_cast<CSimpleSound *>(id); 01646 // This is a simple sound 01647 if (simpleSound->getBuffer() == NULL) 01648 { 01649 static std::set<std::string> warned; 01650 01651 const std::string &name = CStringMapper::unmap(simpleSound->getBuffername()); 01652 if (warned.find(name) == warned.end()) 01653 { 01654 nlwarning ("Can't create the sound '%s'", name.c_str()); 01655 warned.insert(name); 01656 } 01657 return NULL; 01658 } 01659 01660 // Create source 01661 CSimpleSource *source = new CSimpleSource( simpleSound, spawn, cb, userParam, cluster); 01662 01663 // nldebug("Mixer : source %p created", source); 01664 01665 if (source->getBuffer() != 0) 01666 { 01667 // Link the position to the listener position if it'a stereo source 01668 if ( source->getBuffer()->isStereo() ) 01669 { 01670 source->set3DPositionVector( &_ListenPosition ); 01671 } 01672 } 01673 else 01674 { 01675 nlassert(false); // FIXME 01676 } 01677 ret = source; 01678 } 01679 else if (id->getSoundType() == CSound::SOUND_COMPLEX) 01680 { 01681 CComplexSound *complexSound = static_cast<CComplexSound*>(id); 01682 // This is a pattern sound. 01683 ret = new CComplexSource(complexSound, spawn, cb, userParam, cluster); 01684 } 01685 else if (id->getSoundType() == CSound::SOUND_BACKGROUND) 01686 { 01687 // This is a background sound. 01688 CBackgroundSound *bgSound = static_cast<CBackgroundSound *>(id); 01689 ret = new CBackgroundSource(bgSound, spawn, cb, userParam, cluster); 01690 } 01691 else if (id->getSoundType() == CSound::SOUND_CONTEXT) 01692 { 01693 static CSoundContext defaultContext; 01694 // This is a context sound. 01695 if (context == 0) 01696 context = &defaultContext; 01697 01698 CContextSound *ctxSound = static_cast<CContextSound *>(id); 01699 CSound *sound = ctxSound->getContextSound(*context); 01700 if (sound != 0) 01701 { 01702 ret = createSource(sound, spawn, cb, userParam, cluster); 01703 // Set the volume of the source according to the context volume 01704 if (ret != 0) 01705 { 01706 ret->setGain(ret->getGain() * ctxSound->getGain()); 01707 float pitch = ret->getPitch() * ctxSound->getPitch(); 01708 ret->setPitch(pitch); 01709 } 01710 } 01711 else 01712 ret = 0; 01713 } 01714 else 01715 { 01716 // nlassertex(false, ("Unknown sound class !")); 01717 nlwarning("Unknow sound class : %u", id->getSoundType()); 01718 } 01719 01720 #if NL_PROFILE_MIXER 01721 _CreateTime = CTime::ticksToSecond(CTime::getPerformanceTime() - start); 01722 _CreateCount++; 01723 #endif 01724 01725 //nldebug( "AM: Source created" ); 01726 return ret; 01727 } |
|
Add a logical sound source (returns NULL if name not found). If spawn is true, the source will auto-delete after playing. If so, the return USource* pointer is valid only before the time when calling play() plus the duration of the sound. You can pass a callback function that will be called (if not NULL) just before deleting the spawned source. Implements NLSOUND::UAudioMixer. Definition at line 1732 of file audio_mixer_user.cpp. References getSoundId(), and NLSOUND::TSpawnEndCallback. Referenced by createSource(), NLSOUND::CComplexSource::onEvent(), NLSOUND::CComplexSource::onUpdate(), NLSOUND::CBackgroundSource::play(), NLSOUND::CComplexSource::playStuf(), and NLSOUND::CBackgroundSoundManager::updateBackgroundStatus().
01733 { 01734 return createSource( getSoundId( name ), spawn, cb, userParam, cluster, context); 01735 } |
|
Definition at line 565 of file audio_mixer_user.h. References NLMISC::CTime::getLocalTime(), and uint32. Referenced by createSource(), and writeProfile().
00565 { return (uint32) (NLMISC::CTime::getLocalTime() - _StartTime); } |
|
Definition at line 320 of file audio_mixer_user.h. References _PlayingSources.
00320 { --_PlayingSources; }; |
|
Definition at line 322 of file audio_mixer_user.h. References _PlayingSourcesMuted.
00322 { --_PlayingSourcesMuted; }; |
|
Implements NLSOUND::UAudioMixer. Definition at line 2148 of file audio_mixer_user.cpp. References _SoundDriver, and NLSOUND::ISoundDriver::displayBench().
02149 { 02150 if (_SoundDriver) 02151 _SoundDriver->displayBench(log); 02152 } |
|
Disables or reenables the sound.
Implements NLSOUND::UAudioMixer. Definition at line 1073 of file audio_mixer_user.cpp. References nlassert.
01074 { 01075 // TODO : rewrite this method 01076 01077 nlassert(false); 01078 /* if ( b ) 01079 { 01080 // Reenable 01081 _NbTracks = _MaxNbTracks; 01082 } 01083 else 01084 { 01085 // Disable 01086 uint i; 01087 for ( i=0; i!=_NbTracks; i++ ) 01088 { 01089 if ( _Tracks[i] && ! _Tracks[i]->isAvailable() ) 01090 { 01091 _Tracks[i]->getSource()->leaveTrack(); 01092 // nlassert(_PlayingSources.find(_Tracks[i]->getSource()) != _PlayingSources.end()); 01093 // _PlayingSources.erase(_Tracks[i]->getSource()); 01094 } 01095 } 01096 _NbTracks = 0; 01097 } 01098 */ 01099 } |
|
Implements NLSOUND::UAudioMixer. Definition at line 2142 of file audio_mixer_user.cpp. References _SoundDriver, and NLSOUND::ISoundDriver::endBench().
02143 { 02144 if (_SoundDriver) 02145 _SoundDriver->endBench(); 02146 } |
|
Definition at line 1217 of file audio_mixer_user.cpp. References _FreeTracks, _ReserveUsage, NLSOUND::CSourceCommon::getPriority(), NLSOUND::CTrack::getSource(), nlassert, and NLSOUND::CTrack::setSource().
01218 { 01219 nlassert(track != 0); 01220 nlassert(track->getSource() != 0); 01221 01222 // nldebug("Track %p free by source %p", track, track->getSource()); 01223 01224 _ReserveUsage[track->getSource()->getPriority()]--; 01225 track->setSource(0); 01226 _FreeTracks.push_back(track); 01227 } |
|
Return the number of available tracks.
Implements NLSOUND::UAudioMixer. Definition at line 1873 of file audio_mixer_user.cpp. References _FreeTracks, and uint. Referenced by writeProfile().
01874 { 01875 return _FreeTracks.size(); 01876 } |
|
Implements NLSOUND::UAudioMixer. Definition at line 829 of file audio_mixer_user.cpp. References _BackgroundSoundManager, and NLSOUND::CBackgroundSoundManager::getBackgroundFilterFades().
00830 { 00831 return _BackgroundSoundManager->getBackgroundFilterFades(); 00832 } |
|
Implements NLSOUND::UAudioMixer. Definition at line 808 of file audio_mixer_user.cpp. References _BackgroundFilterNames, and uint.
00809 { 00810 static std::string bad(""); 00811 if (flagIndex < TBackgroundFlags::NB_BACKGROUND_FLAGS) 00812 return _BackgroundFilterNames[flagIndex]; 00813 else 00814 return bad; 00815 } |
|
Implements NLSOUND::UAudioMixer. Definition at line 825 of file audio_mixer_user.cpp. References _BackgroundSoundManager, and NLSOUND::CBackgroundSoundManager::getBackgroundFlags(). Referenced by NLSOUND::CSampleBank::load().
00826 { 00827 return _BackgroundSoundManager->getBackgroundFlags(); 00828 } |
|
Implements NLSOUND::UAudioMixer. Definition at line 816 of file audio_mixer_user.cpp. References _BackgroundFilterShortNames, and uint.
00817 { 00818 static std::string bad(""); 00819 if (flagIndex < TBackgroundFlags::NB_BACKGROUND_FLAGS) 00820 return _BackgroundFilterShortNames[flagIndex]; 00821 else 00822 return bad; 00823 } |
|
Definition at line 279 of file audio_mixer_user.h. References _BackgroundSoundManager. Referenced by NLSOUND::CBackgroundSource::play().
00279 { return _BackgroundSoundManager; } |
|
Definition at line 295 of file audio_mixer_user.h. References _ClusteredSound. Referenced by NLSOUND::CBackgroundSoundManager::updateBackgroundStatus().
00295 { return _ClusteredSound; } |
|
Definition at line 1152 of file audio_mixer_user.cpp. References _FreeTracks, _ListenPosition, _LowWaterMark, _NbTracks, _PriorityReserve, _ReserveUsage, _SourceWaitingForPlay, NLSOUND::CSound::getMaxDistance(), NLSOUND::CSimpleSound::getMinDistance(), NLSOUND::CSourceCommon::getPos(), NLSOUND::CSourceCommon::getPriority(), NLSOUND::CSimpleSource::getSimpleSound(), NLSOUND::CTrack::getSource(), NLSOUND::HighestPri, nldebug, nlwarning, NLSOUND::CTrack::setSource(), NLSOUND::CSimpleSource::stop(), and uint. Referenced by NLSOUND::CSimpleSource::play().
01153 { 01154 // nldebug("There are %d free tracks", _FreeTracks.size() ); 01155 // at least some track free ? 01156 if (!_FreeTracks.empty()) 01157 { 01158 // under the low water mark or under the reserve 01159 if (_FreeTracks.size() > _LowWaterMark 01160 || _ReserveUsage[source->getPriority()] < _PriorityReserve[source->getPriority()] ) 01161 { 01162 // non discardable track or not too many waiting source 01163 if (source->getPriority() == HighestPri 01164 || _FreeTracks.size() > _SourceWaitingForPlay.size()) 01165 { 01166 CTrack *ret = _FreeTracks.back(); 01167 _FreeTracks.pop_back(); 01168 ret->setSource(source); 01169 _ReserveUsage[source->getPriority()]++; 01170 // nldebug("Track %p assign to source %p", ret, ret->getSource()); 01171 return ret; 01172 } 01173 } 01174 } 01175 // try to find a track with a source cuttable 01176 { 01177 float d1, d2, t1, t2; 01178 d1 = (source->getPos() - _ListenPosition).norm(); 01179 t1 = max(0.0f, 1-((d1-source->getSimpleSound()->getMinDistance()) / (source->getSimpleSound()->getMaxDistance() - source->getSimpleSound()->getMinDistance()))); 01180 01181 for (uint i=0; i<_NbTracks; ++i) 01182 { 01183 CSimpleSource *src2 = _Tracks[i]->getSource(); 01184 if (src2 != 0) 01185 { 01186 d2 = (src2->getPos() - _ListenPosition).norm(); 01187 t2 = max(0.0f, 1-((d2-src2->getSimpleSound()->getMinDistance()) / (src2->getSimpleSound()->getMaxDistance() - src2->getSimpleSound()->getMinDistance()))); 01188 01189 const float tfactor = 1.3f; 01190 if (t1 > t2 * tfactor) 01191 // if (d1 < d2) 01192 { 01193 nldebug("Cutting source %p with source %p (%f > %f*%f)", src2, source, t1, tfactor, t2); 01194 // on peut cuter cette voie ! 01195 src2->stop(); 01196 if (_FreeTracks.empty()) 01197 { 01198 nlwarning("No free track after cutting a playing sound source !"); 01199 } 01200 else 01201 { 01202 CTrack *ret = _FreeTracks.back(); 01203 _FreeTracks.pop_back(); 01204 ret->setSource(source); 01205 _ReserveUsage[source->getPriority()]++; 01206 nldebug("Track %p assign to source %p", ret, ret->getSource()); 01207 return ret; 01208 } 01209 } 01210 } 01211 } 01212 } 01213 01214 return 0; 01215 } |
|
Returns nb available tracks (or NULL).
Definition at line 1110 of file audio_mixer_user.cpp. References _FreeTracks, and uint.
01111 { 01112 std::vector<CTrack*>::iterator first(_FreeTracks.begin()), last(_FreeTracks.end()); 01113 for (nb =0; first != last; ++first, ++nb) 01114 { 01115 tracks[nb] = *first; 01116 } 01117 } |
|
Return the listener interface.
Implements NLSOUND::UAudioMixer. Definition at line 229 of file audio_mixer_user.h. References _Listener. Referenced by NLSOUND::CClusteredSound::update(), and NLSOUND::CBackgroundSoundManager::updateBackgroundStatus().
00229 { return &_Listener; } |
|
Return the listen pos vector.
Definition at line 262 of file audio_mixer_user.h. References _ListenPosition. Referenced by NLSOUND::CSimpleSource::play().
00262 { return _ListenPosition; } |
|
Return a list of loaded sample bank with theire size. Implements NLSOUND::UAudioMixer. Definition at line 1976 of file audio_mixer_user.cpp.
01977 { 01978 CSampleBank::getLoadedSampleBankInfo(result); 01979 } |
|
Return the total size in byte of loaded samples. Implements NLSOUND::UAudioMixer. Definition at line 1971 of file audio_mixer_user.cpp. References uint32.
01972 {
01973 return CSampleBank::getTotalByteSize();
01974 }
|
|
Return the number muted playing source.
Implements NLSOUND::UAudioMixer. Definition at line 251 of file audio_mixer_user.h. References _PlayingSourcesMuted, and uint.
00251 { return _PlayingSourcesMuted; } |
|
Definition at line 275 of file audio_mixer_user.h. References _PackedSheetPath. Referenced by NLSOUND::CBackgroundSoundManager::load().
00275 {return _PackedSheetPath; } |
|
Definition at line 276 of file audio_mixer_user.h. References _UpdatePackedSheet. Referenced by NLSOUND::CSampleBank::load(), and NLSOUND::CBackgroundSoundManager::load().
00276 {return _UpdatePackedSheet; } |
|
Fill a vector of position and mute flag for all playing sound source.
Implements NLSOUND::UAudioMixer. Definition at line 1230 of file audio_mixer_user.cpp. References _Sources, NLSOUND::CSourceCommon::getPos(), NLSOUND::CSimpleSource::getTrack(), NLSOUND::CSourceCommon::getType(), NLSOUND::CSimpleSource::getVirtualPos(), and NLSOUND::CSimpleSource::isPlaying().
01231 { 01232 int nbplay = 0; 01233 int nbmute = 0; 01234 int nbsrc = 0; 01235 01236 TSourceContainer::iterator first(_Sources.begin()), last(_Sources.end()); 01237 for (; first != last; ++first) 01238 { 01239 CSourceCommon *ps = *first; 01240 if (ps->getType() == CSourceCommon::SOURCE_SIMPLE) 01241 { 01242 CSimpleSource *source = static_cast<CSimpleSource*>(*first); 01243 nbsrc++; 01244 01245 if (source->isPlaying()) 01246 { 01247 if (virtualPos) 01248 pos.push_back(make_pair(source->getTrack() == 0, source->getVirtualPos())); 01249 else 01250 pos.push_back(make_pair(source->getTrack() == 0, source->getPos())); 01251 01252 if (source->getTrack() == 0) 01253 nbmute++; 01254 else 01255 { 01256 // nldebug ("Source %p playing on track %p", source, source->getTrack()); 01257 nbplay ++; 01258 } 01259 } 01260 } 01261 } 01262 01263 // nldebug("Total source : %d, playing : %d, muted : %d", nbsrc, nbplay, nbmute); 01264 } |
|
Return the number of playing sources (slow).
Implements NLSOUND::UAudioMixer. Definition at line 1866 of file audio_mixer_user.cpp. References _PlayingSources, and uint. Referenced by writeProfile().
01867 { 01868 return _PlayingSources; 01869 } |
|
Return the number of mixing tracks (voices).
Implements NLSOUND::UAudioMixer. Definition at line 241 of file audio_mixer_user.h. References _NbTracks, and uint.
00241 { return _NbTracks; } |
|
Return the sound driver.
Definition at line 1103 of file audio_mixer_user.cpp. References _SoundDriver. Referenced by NLSOUND::CAsyncFileManagerSound::CLoadWavFile::run().
01104 { 01105 return _SoundDriver; 01106 } |
|
Get a TSoundId from a name (returns NULL if not found).
Implements NLSOUND::UAudioMixer. Definition at line 1510 of file audio_mixer_user.cpp. References NLSOUND::TSoundId. Referenced by NLSOUND::CBackgroundSoundManager::addSound(), createSource(), NLSOUND::CComplexSound::getDuration(), NLSOUND::CBackgroundSound::getDuration(), NLSOUND::CComplexSound::getMaxDistance(), NLSOUND::CBackgroundSound::getMaxDistance(), NLSOUND::CComplexSound::getSubSoundList(), NLSOUND::CBackgroundSound::getSubSoundList(), initUserVar(), NLSOUND::CComplexSource::onEvent(), NLSOUND::CComplexSource::onUpdate(), NLSOUND::CComplexSource::playStuf(), and NLSOUND::CBackgroundSoundManager::TSoundData::serial().
01511 {
01512 return CSoundBank::instance()->getSound(name);
01513 }
|
|
Return the names of the sounds (call this method after loadSounds()).
Implements NLSOUND::UAudioMixer. Definition at line 1858 of file audio_mixer_user.cpp.
01859 { 01860 CSoundBank::instance()->getNames(names); 01861 } |
|
Return the number of sources instance.
Implements NLSOUND::UAudioMixer. Definition at line 243 of file audio_mixer_user.h. References _Sources, and uint.
00243 { return _Sources.size(); } |
|
Return a string showing the playing sources (slow).
Implements NLSOUND::UAudioMixer. Definition at line 1887 of file audio_mixer_user.cpp.
01888 { 01889 // TODO : rewrite log output 01890 01891 string s; 01892 TSourceContainer::iterator ips; 01893 for ( ips=_Sources.begin(); ips!=_Sources.end(); ++ips ) 01894 { 01895 if ( (*ips)->isPlaying() ) 01896 { 01897 // char line [80]; 01898 01899 /* nlassert( (*ips)->getSound() && (*ips)->getSimpleSound()->getBuffer() ); 01900 smprintf( line, 80, "%s: %u%% %s %s", 01901 (*ips)->getSound()->getName().c_str(), 01902 (uint32)((*ips)->getGain()*100.0f), 01903 (*ips)->getBuffer()->isStereo()?"ST":"MO", 01904 PriToCStr[(*ips)->getPriority()] ); 01905 s += string(line) + "\n"; 01906 */ } 01907 } 01908 return s; 01909 01910 } |
|
Return the number of used tracks.
Implements NLSOUND::UAudioMixer. Definition at line 1878 of file audio_mixer_user.cpp. References _FreeTracks, _NbTracks, and uint. Referenced by writeProfile().
01879 { 01880 return _NbTracks - _FreeTracks.size(); 01881 } |
|
Return the current value of a user var.
Implements NLSOUND::UAudioMixer. Definition at line 1006 of file audio_mixer_user.cpp. References _UserVarControls.
01007 { 01008 TUserVarControlsContainer::iterator it(_UserVarControls.find(varName)); 01009 if (it != _UserVarControls.end()) 01010 { 01011 return it->second.Value; 01012 } 01013 // return a default value. 01014 return 1.0f; 01015 } |
|
Definition at line 319 of file audio_mixer_user.h. References _PlayingSources.
00319 { ++_PlayingSources; }; |
|
Definition at line 321 of file audio_mixer_user.h. References _PlayingSourcesMuted. Referenced by NLSOUND::CSimpleSource::play().
00321 { ++_PlayingSourcesMuted; }; |
|
Initialization In case of failure, can throw one of these ESoundDriver (Exception) objects: ESoundDriverNotFound, ESoundDriverCorrupted, ESoundDriverOldVersion, ESoundDriverUnknownVersion. The sources will be auto-balanced every "balance_period" calls to update() (set 0 for "never auto-balance") Implements NLSOUND::UAudioMixer. Definition at line 358 of file audio_mixer_user.cpp. References _AutoLoadSample, _BackgroundFilterNames, _BackgroundFilterShortNames, _BackgroundSoundManager, _FreeTracks, _Listener, _LowWaterMark, _MaxNbTracks, _NbTracks, _PriorityReserve, _profile, _ReserveUsage, _SoundDriver, _UpdatePackedSheet, _UseADPCM, _UseEax, buildSampleBankList(), NLGEORGES::UFormLoader::createLoader(), NLGEORGES::UFormElm::getArrayNode(), NLGEORGES::UFormElm::getArraySize(), NLGEORGES::UFormElm::getArrayValue(), NLGEORGES::UFormElm::getNodeByName(), NLGEORGES::UFormElm::getValueByName(), NLSOUND::HighestPri, NLSOUND::HighPri, NLSOUND::CTrack::init(), NLSOUND::CListenerUser::init(), initUserVar(), NLGEORGES::UFormLoader::loadForm(), loadSampleBank(), NLMISC::CPath::lookup(), NLSOUND::LowPri, NLSOUND::MAX_TRACKS, NLSOUND::MidPri, min, NLSOUND::NbSoundPriorities, nldebug, nlinfo, NLMISC::IProgressCallback::progress(), NLGEORGES::UFormLoader::releaseLoader(), setBackgroundFilterFades(), setBackgroundFlags(), setLowWaterMark(), setPriorityReserve(), size, uint, and uint32.
00359 { 00360 NL_ALLOC_CONTEXT(NLSOUND_UAudioMixer); 00361 nldebug( "AM: Init..." ); 00362 00363 _profile(( "AM: ---------------------------------------------------------------" )); 00364 _profile(( "AM: DRIVER: %s", NLSOUND_DLL_NAME )); 00365 00366 _UseEax = useEax; 00367 _UseADPCM = useADPCM; 00368 _AutoLoadSample = autoLoadSample; 00369 00370 // Init sound driver 00371 try 00372 { 00373 _SoundDriver = ISoundDriver::createDriver(useEax, this); 00374 } 00375 catch(...) 00376 { 00377 // TODO : is this logic to auto destruct this object in case of failing to create the driver ? 00378 delete this; 00379 _Instance = NULL; 00380 throw; 00381 } 00382 00383 uint i; 00384 00385 maxTrack = min(maxTrack, MAX_TRACKS); 00386 00387 // Init registrable classes 00388 static bool initialized = false; 00389 if (!initialized) 00390 { 00391 initialized = true; 00392 } 00393 00394 // Init listener 00395 _Listener.init( _SoundDriver ); 00396 00397 // Init tracks (physical sources) 00398 _NbTracks = maxTrack; // could be chosen by the user, or according to the capabilities of the sound card 00399 for ( i=0; i<maxTrack; i++ ) 00400 { 00401 _Tracks[i] = NULL; 00402 } 00403 try 00404 { 00405 for ( i=0; i!=_NbTracks; i++ ) 00406 { 00407 _Tracks[i] = new CTrack(); 00408 _Tracks[i]->init( _SoundDriver ); 00409 // insert in front because the last inserted wan be sofware buffer... 00410 _FreeTracks.insert(_FreeTracks.begin(), _Tracks[i]); 00411 } 00412 } 00413 catch ( ESoundDriver & ) 00414 { 00415 delete _Tracks[i]; 00416 _Tracks[i] = 0; 00417 // If the source generation failed, keep only the generated number of sources 00418 _NbTracks = i; 00419 } 00420 00421 _MaxNbTracks = _NbTracks; 00422 00423 // Init the reserve stuff. 00424 _LowWaterMark = 0; 00425 for (i=0; i<NbSoundPriorities; ++i) 00426 { 00427 _PriorityReserve[i] = _NbTracks; 00428 _ReserveUsage[i] = 0; 00429 } 00430 00431 _StartTime = CTime::getLocalTime(); 00432 00433 // if needed (update == true), build the sample bank list 00434 if (_UpdatePackedSheet) 00435 { 00436 buildSampleBankList(); 00437 } 00438 00439 00440 00441 // Create the background sound manager. 00442 _BackgroundSoundManager = new CBackgroundSoundManager(); 00443 00444 // Load the sound bank singleton 00445 CSoundBank::instance()->load(); 00446 nlinfo( "Initialized audio mixer with %u voices, %s and %s.", 00447 _NbTracks, 00448 useEax ? "with EAX support" : "WITHOUT EAX", 00449 useADPCM ? "with ADPCM sample source" : "with 16 bits PCM sample source"); 00450 00451 // try to load default configuration from george sheet 00452 00453 NLGEORGES::UFormLoader *formLoader = NULL; 00454 00455 try 00456 { 00457 std::string mixerConfigFile = NLMISC::CPath::lookup("default.mixer_config", false); 00458 if (!mixerConfigFile.empty()) 00459 { 00460 formLoader = NLGEORGES::UFormLoader::createLoader(); 00461 00462 NLMISC::CSmartPtr<NLGEORGES::UForm> form; 00463 form = formLoader->loadForm(mixerConfigFile.c_str()); 00464 00465 NLGEORGES::UFormElm &root = form->getRootNode(); 00466 00467 00468 // read track reserve 00469 uint32 highestRes, highRes, midRes, lowRes; 00470 root.getValueByName(highestRes, ".HighestPriorityReserve"); 00471 root.getValueByName(highRes, ".HighPriorityReserve"); 00472 root.getValueByName(midRes, ".MidPriorityReserve"); 00473 root.getValueByName(lowRes, ".LowPriorityReserve"); 00474 00475 setPriorityReserve(HighestPri, highestRes); 00476 setPriorityReserve(HighPri, highRes); 00477 setPriorityReserve(MidPri, midRes); 00478 setPriorityReserve(LowPri, lowRes); 00479 00480 uint32 lowWater; 00481 root.getValueByName(lowWater, ".LowWaterMark"); 00482 setLowWaterMark(lowWater); 00483 00484 // preload sample bank 00485 NLGEORGES::UFormElm *sampleBanks; 00486 root.getNodeByName(&sampleBanks, ".SampleBanks"); 00487 00488 if (sampleBanks != NULL) 00489 { 00490 uint size; 00491 sampleBanks->getArraySize(size); 00492 for (uint i=0; i<size; ++i) 00493 { 00494 std::string name; 00495 sampleBanks->getArrayValue(name, i); 00496 00497 if (!name.empty()) 00498 loadSampleBank(false, name); 00499 00500 if (progressCallBack != 0) 00501 progressCallBack->progress(float(i) / size); 00502 } 00503 } 00504 00505 // configure background flags names, fades and state 00506 NLGEORGES::UFormElm *bgFlags; 00507 root.getNodeByName(&bgFlags, ".BackgroundFlags"); 00508 if (bgFlags != NULL) 00509 { 00510 TBackgroundFlags flags; 00511 TBackgroundFilterFades fades; 00512 00513 uint size; 00514 bgFlags->getArraySize(size); 00515 uint i; 00516 for (i=0; i<min(size, uint(TBackgroundFlags::NB_BACKGROUND_FLAGS)); ++i) 00517 { 00518 NLGEORGES::UFormElm *flag; 00519 bgFlags->getArrayNode(&flag, i); 00520 00521 flag->getValueByName(flags.Flags[i], ".InitialState"); 00522 00523 uint32 fadeIn, fadeOut; 00524 flag->getValueByName(fadeIn, ".FadeIn"); 00525 flag->getValueByName(fadeOut, ".FadeOut"); 00526 00527 fades.FadeIns[i] = fadeIn; 00528 fades.FadeOuts[i] = fadeOut; 00529 00530 flag->getValueByName(_BackgroundFilterNames[i], ".Name"); 00531 flag->getValueByName(_BackgroundFilterShortNames[i], ".ShortName"); 00532 } 00533 for (; i< TBackgroundFlags::NB_BACKGROUND_FLAGS; ++i) 00534 { 00535 uint32 fadeIn, fadeOut; 00536 NLGEORGES::UFormElm::TWhereIsValue where = NLGEORGES::UFormElm::ValueDefaultDfn; 00537 root.getValueByName(fadeIn, ".BackgroundFlags[0].FadeIn", NLGEORGES::UFormElm::Eval, &where); 00538 root.getValueByName(fadeOut, ".BackgroundFlags[0].FadeOut", NLGEORGES::UFormElm::Eval, &where); 00539 root.getValueByName(flags.Flags[i], ".BackgroundFlags[0].InitialState", NLGEORGES::UFormElm::Eval, &where); 00540 00541 fades.FadeIns[i] = fadeIn; 00542 fades.FadeOuts[i] = fadeOut; 00543 } 00544 setBackgroundFilterFades(fades); 00545 setBackgroundFlags(flags); 00546 } 00547 00548 NLGEORGES::UFormLoader::releaseLoader(formLoader); 00549 } 00550 } 00551 catch(...) 00552 { 00553 NLGEORGES::UFormLoader::releaseLoader(formLoader); 00554 } 00555 00556 // init the user var bindings 00557 initUserVar(); 00558 } |
|
Initialisation of the clustered sound system. CNELU version Implements NLSOUND::UAudioMixer. Definition at line 204 of file audio_mixer_user.cpp. References _ClusteredSound, and NLSOUND::CClusteredSound::init().
00205 { 00206 NL_ALLOC_CONTEXT(NLSOUND_UAudioMixer); 00207 if (_ClusteredSound == 0) 00208 _ClusteredSound = new CClusteredSound; 00209 00210 _ClusteredSound->init(scene, portalInterpolate, maxDistance, minGain); 00211 } |
|
Initialisation of the clustered sound system. Implements NLSOUND::UAudioMixer. Definition at line 195 of file audio_mixer_user.cpp.
00196 { 00197 NL3D::CScene *scene = 0; 00198 if (uscene != 0) 00199 scene = &(static_cast<NL3D::CSceneUser*>(uscene)->getScene()); 00200 00201 initClusteredSound(scene, minGain, maxDistance, portalInterpolate); 00202 } |
|
Read all user controled var sheets. Temporary container. Definition at line 895 of file audio_mixer_user.cpp. References _PackedSheetPath, _UpdatePackedSheet, NLSOUND::CSound::_UserVarControler, _UserVarControls, NLSOUND::Container, getSoundId(), and uint. Referenced by init().
00896 { 00897 _UserVarControls.clear(); 00899 std::map<std::string, CUserVarSerializer> Container; 00900 00901 // read all *.user_var_binding sheet in data/sound/user_var folder 00902 00903 // load the sound_group sheets 00904 ::loadForm("user_var_binding", _PackedSheetPath+"user_var_binding.packed_sheets", Container, _UpdatePackedSheet, false); 00905 // fill the real container. 00906 std::map<std::string, CUserVarSerializer>::iterator first(Container.begin()), last(Container.end()); 00907 for (; first != last; ++first) 00908 { 00909 for (uint i=0; i<first->second.Controlers.size(); ++i) 00910 { 00911 _UserVarControls.insert(make_pair(first->second.Controlers[i].Name, first->second.Controlers[i])); 00912 } 00913 } 00914 00915 // update all the sounds to refer to the controler. 00916 { 00917 TUserVarControlsContainer::iterator first(_UserVarControls.begin()), last(_UserVarControls.end()); 00918 for(; first != last; ++first) 00919 { 00920 std::vector<NLMISC::TStringId>::iterator first2(first->second.SoundNames.begin()), last2(first->second.SoundNames.end()); 00921 for (; first2 != last2; ++first2) 00922 { 00923 CSound *sound = getSoundId(*first2); 00924 if (sound != 0) 00925 { 00926 // ok, the sound exist ! 00927 sound->_UserVarControler = first->second.Name; 00928 } 00929 } 00930 } 00931 } 00932 00933 } |
|
Return the audio mixer object.
Definition at line 115 of file audio_mixer_user.h.
00115 { return _Instance; } |
|
Implements NLSOUND::UAudioMixer. Definition at line 2116 of file audio_mixer_user.cpp. References _BackgroundSoundManager, and NLSOUND::CBackgroundSoundManager::loadAudioFromPrimitives().
02117 { 02118 _BackgroundSoundManager->loadAudioFromPrimitives(audioRoot); 02119 } |
|
Deprecated.
Implements NLSOUND::UAudioMixer. Definition at line 2107 of file audio_mixer_user.cpp. References _BackgroundSoundManager, and NLSOUND::CBackgroundSoundManager::loadEffecsFromRegion().
02108 { 02109 _BackgroundSoundManager->loadEffecsFromRegion(region); 02110 } |
|
Deprecated.
Implements NLSOUND::UAudioMixer. Definition at line 2111 of file audio_mixer_user.cpp. References _BackgroundSoundManager, and NLSOUND::CBackgroundSoundManager::loadSamplesFromRegion().
02112 { 02113 _BackgroundSoundManager->loadSamplesFromRegion(region); 02114 } |
|
Implements NLSOUND::UAudioMixer. Definition at line 2131 of file audio_mixer_user.cpp. References _BackgroundSoundManager, and NLSOUND::CBackgroundSoundManager::load().
02132 { 02133 _BackgroundSoundManager->load (continent, config); 02134 } |
|
Deprecated.
Implements NLSOUND::UAudioMixer. Definition at line 2102 of file audio_mixer_user.cpp. References _BackgroundSoundManager, and NLSOUND::CBackgroundSoundManager::loadSoundsFromRegion().
02103 { 02104 _BackgroundSoundManager->loadSoundsFromRegion(region); 02105 } |
|
Load buffers. Returns the number of buffers successfully loaded. If you specify a non null notfoundfiles vector, it is filled with the names of missing files if any. You can call this method several times, to load several sound banks. Implements NLSOUND::UAudioMixer. Definition at line 1803 of file audio_mixer_user.cpp. References _SoundDriver, NLSOUND::CSampleBank::countSamples(), NLSOUND::CSampleBank::load(), nldebug, nlwarning, and uint32. Referenced by init(), and NLSOUND::CBackgroundSoundManager::updateBackgroundStatus().
01804 { 01805 NL_ALLOC_CONTEXT(NLSOUND_UAudioMixer); 01806 // nlassert( filename != NULL ); 01807 01808 // string path = _SamplePath; 01809 // path.append("/").append(filename); 01810 01811 nldebug( "Loading samples bank %s...", name.c_str() ); 01812 01813 CSampleBank* bank = CSampleBank::findSampleBank(CStringMapper::map(name)); 01814 if (bank == NULL) 01815 { 01816 // create a new sample bank 01817 bank = new CSampleBank(name, _SoundDriver); 01818 } 01819 01820 try 01821 { 01822 bank->load(async); 01823 } 01824 catch (Exception& e) 01825 { 01826 if (notfoundfiles) 01827 { 01828 notfoundfiles->push_back(name); 01829 } 01830 string reason = e.what(); 01831 nlwarning( "AM: Failed to load the samples: %s", reason.c_str() ); 01832 } 01833 01834 01835 return bank->countSamples(); 01836 } |
|
map a string
Implements NLSOUND::ISoundDriver::IStringMapperProvider. Definition at line 122 of file audio_mixer_user.h. References NLMISC::CStringMapper::map().
00122 { return NLMISC::CStringMapper::map(str);} |
|
Implements NLSOUND::UAudioMixer. Definition at line 2121 of file audio_mixer_user.cpp. References _BackgroundSoundManager, and NLSOUND::CBackgroundSoundManager::play().
02122 { 02123 _BackgroundSoundManager->play (); 02124 } |
|
Definition at line 2028 of file audio_mixer_user.cpp. References _BufferToSources, and buffer.
02029 { 02030 _BufferToSources[buffer].push_back(sound); 02031 } |
|
Register an object in the update list.
Definition at line 2053 of file audio_mixer_user.cpp. References _UpdateEventList, and nlassert. Referenced by NLSOUND::CComplexSource::onEvent(), and NLSOUND::CComplexSource::playStuf().
02054 { 02055 // nldebug("Registering update %p", pmixerUpdate); 02056 nlassert(pmixerUpdate != 0); 02057 _UpdateEventList.push_back(make_pair(pmixerUpdate, true)); 02058 } |
|
Reload all the sample bank. Thid method use provided for use in a sound editor or sound tool to update the list of available samples. If true, the samples are loaded in a background thread. Implements NLSOUND::UAudioMixer. Definition at line 1142 of file audio_mixer_user.cpp. References _SamplePath, _UpdatePackedSheet, and buildSampleBankList().
01143 { 01144 CPath::addSearchPath(_SamplePath, true, false); 01145 if (_UpdatePackedSheet) 01146 buildSampleBankList(); 01147 CSampleBank::reload(async); 01148 } |
|
Remove any event programmed for this object.
Definition at line 2075 of file audio_mixer_user.cpp. References _EventListUpdate, _Events, nlassert, and range. Referenced by NLSOUND::CComplexSource::stop(), and NLSOUND::CComplexSource::~CComplexSource().
02076 { 02077 nlassert(pmixerEvent != 0); 02078 // nldebug("Removing event %p", pmixerEvent); 02079 // store the pointer for future removal. 02080 _EventListUpdate.push_back(make_pair(0, pmixerEvent)); 02081 // clear the pointer to avoid calling on somethink deleted 02082 pair<TEventContainer::iterator, TEventContainer::iterator> range = _Events.equal_range(pmixerEvent); 02083 TEventContainer::iterator first(range.first), last(range.second); 02084 for (; first != last; ++first) 02085 { 02086 first->second->second = 0; 02087 } 02088 _Events.erase(range.first, range.second); 02089 } |
|
Delete a logical sound source. If you don't call it, the source will be auto-deleted when deleting the audio mixer object Definition at line 1740 of file audio_mixer_user.cpp. References _Sources, and nlassert.
|
|
Definition at line 1039 of file audio_mixer_user.cpp. References _UserVarControls.
01040 { 01041 TUserVarControlsContainer::iterator it(_UserVarControls.find(varName)); 01042 if (it != _UserVarControls.end()) 01043 { 01044 // ok, the var exist, remove this source 01045 it->second.Sources.erase(source); 01046 } 01047 } |
|
Resets the audio system (deletes all the sources, include envsounds).
Implements NLSOUND::UAudioMixer. Definition at line 288 of file audio_mixer_user.cpp. References _Leaving, _NbTracks, _Sources, _SourceWaitingForPlay, NLSOUND::CTrack::getSource(), NLSOUND::CSourceCommon::isPlaying(), src, NLSOUND::CSourceCommon::stop(), and uint. Referenced by ~CAudioMixerUser().
00289 { 00290 _Leaving = true; 00291 00292 _SourceWaitingForPlay.clear(); 00293 00294 // Stop tracks 00295 uint i; 00296 for ( i=0; i!=_NbTracks; i++ ) 00297 { 00298 if ( _Tracks[i] ) 00299 { 00300 CSimpleSource* src = _Tracks[i]->getSource(); 00301 00302 if (src && src->isPlaying()) 00303 { 00304 src->stop(); 00305 } 00306 } 00307 } 00308 00309 // Do a first multipass travesal to stop all playing source 00310 // We can't do the work in 1 pass because stoping a source can lead to 00311 // destruction of sub source, invalidating the iterators ! 00312 bool again; 00313 do 00314 { 00315 again = false; 00316 TSourceContainer::iterator first(_Sources.begin()), last(_Sources.end()); 00317 for (; first != last; ++first) 00318 { 00319 if ((*first)->isPlaying()) 00320 { 00321 (*first)->stop(); 00322 again = true; 00323 break; 00324 } 00325 } 00326 00327 } while (again); 00328 00329 // Sources 00330 while (!_Sources.empty()) 00331 { 00332 //removeSource( _Sources.begin(), true ); // 3D sources, the envsounds were removed above 00333 CSourceCommon *source = *(_Sources.begin()); 00334 if (source->isPlaying()) 00335 source->stop(); 00336 else 00337 delete source; 00338 } 00339 00340 _Leaving = false; 00341 } |
|
Choose the environmental effect(s) corresponding to tag.
Implements NLSOUND::UAudioMixer. Definition at line 1751 of file audio_mixer_user.cpp. References nlassertex.
01752 { 01753 nlassertex(false, ("Not implemented yet")); 01754 /* // Select Env 01755 vector<CEnvEffect*>::iterator ipe; 01756 for ( ipe=_EnvEffects.begin(); ipe!=_EnvEffects.end(); ++ipe ) 01757 { 01758 (*ipe)->selectEnv( tag ); 01759 } 01760 01761 // Compute 01762 CVector pos; 01763 _Listener.getPos( pos ); 01764 computeEnvEffect( pos, true ); 01765 */ 01766 } |
|
Implements NLSOUND::UAudioMixer. Definition at line 2096 of file audio_mixer_user.cpp. References _BackgroundSoundManager, and NLSOUND::CBackgroundSoundManager::setBackgroundFilterFades(). Referenced by init().
02097 { 02098 _BackgroundSoundManager->setBackgroundFilterFades(backgroundFilterFades); 02099 } |
|
Implements NLSOUND::UAudioMixer. Definition at line 798 of file audio_mixer_user.cpp. References _BackgroundFilterNames, and uint.
00799 { 00800 if (flagIndex < TBackgroundFlags::NB_BACKGROUND_FLAGS) 00801 _BackgroundFilterNames[flagIndex] = flagName; 00802 } |
|
Implements NLSOUND::UAudioMixer. Definition at line 2091 of file audio_mixer_user.cpp. References _BackgroundSoundManager, and NLSOUND::CBackgroundSoundManager::setBackgroundFlags(). Referenced by init().
02092 { 02093 _BackgroundSoundManager->setBackgroundFlags(backgroundFlags); 02094 } |
|
Implements NLSOUND::UAudioMixer. Definition at line 803 of file audio_mixer_user.cpp. References _BackgroundFilterShortNames, and uint.
00804 { 00805 if (flagIndex < TBackgroundFlags::NB_BACKGROUND_FLAGS) 00806 _BackgroundFilterShortNames[flagIndex] = flagShortName; 00807 } |
|
Release track. Use this method to set the listener position instead of using getListener->setPos(); It's because we have to update the background sounds in this case. Implements NLSOUND::UAudioMixer. Definition at line 1983 of file audio_mixer_user.cpp. References _BackgroundSoundManager, _Listener, NLSOUND::CBackgroundSoundManager::setListenerPosition(), and NLSOUND::CListenerUser::setPos().
01984 { 01985 _Listener.setPos(pos); 01986 _BackgroundSoundManager->setListenerPosition(pos); 01987 } |
|
Set the Low water mark. This value is use to mute sound source that try to play when there priority channel is full (see setPriorityReserve). Set a value 1 to 4 to keep some extra track available when a HighestPri source need to play. By default, the value is set to 0, witch mean no special treatment is done and the mixer will mute sound with no user control at all. Note also that the availability of a track is not guarantie if the sum of the priority reserve (see setPriorityReserve) is grater than the number od available tracks (witch is almos alwais the case). But this value will help the mixer make it's best. Implements NLSOUND::UAudioMixer. Definition at line 219 of file audio_mixer_user.cpp. References _LowWaterMark, _NbTracks, min, uint, and value. Referenced by init().
00220 { 00221 _LowWaterMark = min(_NbTracks, value); 00222 } |
|
Set the global path to the packeck sheet files. This must be set BEFORE calling init. Default is to store packed sheet in the current directory. Implements NLSOUND::UAudioMixer. Definition at line 343 of file audio_mixer_user.cpp. References _PackedSheetPath, and _UpdatePackedSheet.
00344 { 00345 _PackedSheetPath = CPath::standardizePath(path, true); 00346 _UpdatePackedSheet = update; 00347 } |
|
Set the priority channel reserve. Each priority channel can be assign a restrictive reserve value. This value is used when the number free track available for playing drop under the low water mark value (see setLowWaterMark). The mixer count the number of playing source in each priority channel. A priority channel can orverflow it's reserve value only if the low water mark is not reach. In other word, when the number of played source increase, you can control a 'smooth' cut in priority layer. The idea is to try to keep some free track for the HighestPri source. By default, reserve are set for each channel to the number of available tracks. Implements NLSOUND::UAudioMixer. Definition at line 214 of file audio_mixer_user.cpp. References _NbTracks, _PriorityReserve, min, and uint. Referenced by init().
00215 { 00216 _PriorityReserve[priorityChannel] = min(_NbTracks, reserve); 00217 } |
|
Set the global path to the sample banks. Same as removeSource() but does not delete the object (e.g. when not allocated by new, as the CAmbiantSource channels) Implements NLSOUND::UAudioMixer. Definition at line 350 of file audio_mixer_user.cpp. References _SamplePath.
00351 { 00352 _SamplePath = CPath::standardizePath(path, true); 00353 } |
|
Set the value of a user variable. User variable are variable that can be used to control the gain or tranpose of all the instance (source) of a given sound. This has been initialy design to control the gain of any source playing some atmospheric sound (like rain) according to the intensity of the effect (ie small rain or big rain). Binding from user var to sound parameter is done in one or more george sheet .user_var_binding. Implements NLSOUND::UAudioMixer. Definition at line 975 of file audio_mixer_user.cpp. References _UserVarControls, gain_control, and value.
00976 { 00977 TUserVarControlsContainer::iterator it(_UserVarControls.find(varName)); 00978 if (it != _UserVarControls.end()) 00979 { 00980 // ok we found the var ! 00981 // do some work only if the value is different (we don't trust client for 00982 // being smart ;) ) 00983 // if (it->second.Value != value) 00984 { 00985 it->second.Value = value; 00986 // update all sources 00987 std::set<CSourceCommon*>::iterator first(it->second.Sources.begin()), last(it->second.Sources.end()); 00988 for (; first != last; ++first) 00989 { 00990 if (it->second.ParamId == gain_control) 00991 { 00992 float relGain = (*first)->getRelativeGain(); 00993 float gain = (*first)->getSound()->getGain(); 00994 (*first)->setGain(gain * value); 00995 (*first)->setRelativeGain(relGain); 00996 } 00997 else 00998 { 00999 (*first)->setPitch(value); 01000 } 01001 } 01002 } 01003 } 01004 } |
|
Implements NLSOUND::UAudioMixer. Definition at line 2136 of file audio_mixer_user.cpp. References _SoundDriver, and NLSOUND::ISoundDriver::startBench().
02137 { 02138 if (_SoundDriver) 02139 _SoundDriver->startBench(); 02140 } |
|
Implements NLSOUND::UAudioMixer. Definition at line 2126 of file audio_mixer_user.cpp. References _BackgroundSoundManager, and NLSOUND::CBackgroundSoundManager::stop().
02127 { 02128 _BackgroundSoundManager->stop (); 02129 } |
|
Unload buffers. Implements NLSOUND::UAudioMixer. Definition at line 1838 of file audio_mixer_user.cpp. References nldebug, and NLSOUND::CSampleBank::unload(). Referenced by NLSOUND::CBackgroundSoundManager::updateBackgroundStatus().
01839 { 01840 // string path = _SamplePath; 01841 // path.append("/").append(filename); 01842 01843 nldebug( "Unloading samples bank %s...", name.c_str() ); 01844 CSampleBank *pbank = CSampleBank::findSampleBank(CStringMapper::map(name)); 01845 01846 if (pbank != NULL) 01847 { 01848 // ok, the bank exist. 01849 return pbank->unload(); 01850 } 01851 else 01852 return false; 01853 01854 } |
|
unmap a string
Implements NLSOUND::ISoundDriver::IStringMapperProvider. Definition at line 124 of file audio_mixer_user.h. References NLMISC::CStringMapper::unmap().
00124 { return NLMISC::CStringMapper::unmap(stringId);} |
|
Definition at line 2033 of file audio_mixer_user.cpp. References _BufferToSources, and buffer.
02034 { 02035 TBufferToSourceContainer::iterator it(_BufferToSources.find(buffer)); 02036 if (it != _BufferToSources.end()) 02037 { 02038 std::vector<CSound*>::iterator first(it->second.begin()), last(it->second.end()); 02039 02040 for (; first != last; ++first) 02041 { 02042 if (*first == sound) 02043 { 02044 it->second.erase(first); 02045 break; 02046 } 02047 } 02048 } 02049 } |
|
Unregister an object from the update list.
Definition at line 2060 of file audio_mixer_user.cpp. References _UpdateEventList, nlassert, and nldebug. Referenced by NLSOUND::CComplexSource::onUpdate(), NLSOUND::CComplexSource::stop(), NLSOUND::CBackgroundSoundManager::stop(), NLSOUND::CBackgroundSoundManager::updateBackgroundStatus(), and NLSOUND::CComplexSource::~CComplexSource().
02061 { 02062 nldebug("Unregistering update %p", pmixerUpdate); 02063 nlassert(pmixerUpdate != 0); 02064 _UpdateEventList.push_back(make_pair(pmixerUpdate, false)); 02065 } |
|
Update audio mixer (call evenly).
Implements NLSOUND::UAudioMixer. Definition at line 1268 of file audio_mixer_user.cpp. References _BackgroundSoundManager, _ClusteredSound, _EventList, _EventListUpdate, _Events, _Listener, _ListenPosition, _NbTracks, _SoundDriver, _Sources, _SourceWaitingForPlay, _UpdateCount, _UpdateEventList, _UpdateList, _UpdateTime, _UseEax, NLSOUND::ISoundDriver::commit3DChanges(), NLSOUND::CClusteredSound::CClusterSoundStatus::Direction, NLSOUND::CClusteredSound::CClusterSoundStatus::Dist, NLSOUND::CClusteredSound::CClusterSoundStatus::Gain, NLSOUND::CSourceCommon::getCluster(), NLSOUND::CClusteredSound::getClusterSoundStatus(), NLSOUND::CSourceCommon::getGain(), NLMISC::CTime::getLocalTime(), NLSOUND::CListenerUser::getOrientation(), NLSOUND::CSourceCommon::getPos(), NLSOUND::CSourceCommon::getRelativeGain(), NLSOUND::CTrack::getSource(), H_AUTO, NLSOUND::CTrack::isPlaying(), NL_PROFILE_MIXER, nldebug, nlwarning, NLSOUND::CClusteredSound::CClusterSoundStatus::Obstruction, NLSOUND::CClusteredSound::CClusterSoundStatus::Occlusion, NLSOUND::CClusteredSound::CClusterSoundStatus::OcclusionLFFactor, NLSOUND::CClusteredSound::CClusterSoundStatus::OcclusionRoomRatio, NLSOUND::CAudioMixerUser::IMixerEvent::onEvent(), NLSOUND::CClusteredSound::CClusterSoundStatus::PosAlpha, NLSOUND::CClusteredSound::CClusterSoundStatus::Position, range, NLSOUND::CSimpleSource::setGain(), NLSOUND::CSimpleSource::setPos(), NLSOUND::CSimpleSource::stop(), uint, NLSOUND::CClusteredSound::update(), and NLSOUND::CBackgroundSoundManager::updateBackgroundStatus().
01269 { 01270 H_AUTO(NLSOUND_AudioMixerUpdate) 01271 /* static NLMISC::TTime lastUpdate = NLMISC::CTime::getLocalTime(); 01272 NLMISC::TTime now = NLMISC::CTime::getLocalTime(); 01273 01274 nldebug("Mixer update : %u ms", uint(now - lastUpdate)); 01275 lastUpdate = now; 01276 */ 01277 #if NL_PROFILE_MIXER 01278 TTicks start = CTime::getPerformanceTime(); 01279 #endif 01280 01281 // update the object. 01282 { 01283 H_AUTO(NLSOUND_AudioMixerUpdateObjet) 01284 // 1st, update the event list 01285 { 01286 std::vector<std::pair<IMixerUpdate*, bool> >::iterator first(_UpdateEventList.begin()), last(_UpdateEventList.end()); 01287 for (; first != last; ++first) 01288 { 01289 if (first->second) 01290 { 01291 // nldebug("Inserting update %p", first->first); 01292 _UpdateList.insert(first->first); 01293 } 01294 else 01295 { 01296 nldebug("Removing update %p", first->first); 01297 _UpdateList.erase(first->first); 01298 } 01299 } 01300 _UpdateEventList.clear(); 01301 } 01302 // 2nd, do the update 01303 { 01304 TMixerUpdateContainer::iterator first(_UpdateList.begin()), last(_UpdateList.end()); 01305 for (; first != last; ++first) 01306 { 01307 if( *first == 0) 01308 { 01309 nlwarning("NULL pointeur in update list !"); 01310 } 01311 else 01312 { 01313 // call the update method. 01314 const IMixerUpdate *update = *first; 01315 const_cast<IMixerUpdate*>(update)->onUpdate(); 01316 } 01317 } 01318 } 01319 } 01320 // send the event. 01321 { 01322 H_AUTO(NLSOUND_AudioMixerUpdateSendEvent) 01323 // 1st, update the event list 01324 { 01325 std::vector<std::pair<NLMISC::TTime, IMixerEvent*> >::iterator first(_EventListUpdate.begin()), last(_EventListUpdate.end()); 01326 for (; first != last; ++first) 01327 { 01328 if (first->first != 0) 01329 { 01330 // add an event 01331 // nldebug ("Add event %p", first->second); 01332 // TTimedEventContainer::iterator it(_EventList.insert(*first)); 01333 TTimedEventContainer::iterator it(_EventList.insert(make_pair(first->first, NLMISC::CDbgPtr<IMixerEvent>(first->second)))); 01334 _Events.insert(make_pair(first->second, it)); 01335 } 01336 else 01337 { 01338 // remove the events 01339 pair<TEventContainer::iterator, TEventContainer::iterator> range = _Events.equal_range(first->second); 01340 TEventContainer::iterator first2(range.first), last2(range.second); 01341 for (; first2 != last2; ++first2) 01342 { 01343 // remove the event 01344 nldebug("Remove event %p", first2->second->second.ptr()); 01345 _EventList.erase(first2->second->first); 01346 } 01347 _Events.erase(range.first, range.second); 01348 } 01349 } 01350 01351 _EventListUpdate.clear(); 01352 } 01353 // 2nd, call the events 01354 TTime now = NLMISC::CTime::getLocalTime(); 01355 while (!_EventList.empty() && _EventList.begin()->first <= now) 01356 { 01357 CAudioMixerUser::IMixerEvent *CurrentEvent = _EventList.begin()->second; 01358 if (CurrentEvent != NULL) 01359 { 01360 // nldebug("Sending Event %p", _EventList.begin()->second); 01361 CurrentEvent->onEvent(); 01362 } 01363 TEventContainer::iterator it(_Events.lower_bound(_EventList.begin()->second)); 01364 while (it->first == _EventList.begin()->second.ptr()) 01365 { 01366 if (it->second == _EventList.begin()) 01367 { 01368 _Events.erase(it); 01369 break; 01370 } 01371 it++; 01372 } 01373 _EventList.erase(_EventList.begin()); 01374 #if defined(NL_DEBUG) || defined(NL_DEBUG_FAST) 01375 CurrentEvent = 0; 01376 #endif 01377 } 01378 } 01379 01380 // update the background sound 01381 _BackgroundSoundManager->updateBackgroundStatus(); 01382 01383 uint i; 01384 // Check all playing track and stop any terminated buffer. 01385 for (i=0; i<_NbTracks; ++i) 01386 { 01387 if (!_Tracks[i]->isPlaying()) 01388 { 01389 if (_Tracks[i]->getSource() != 0) 01390 { 01391 CSimpleSource *source = _Tracks[i]->getSource(); 01392 source->stop(); 01393 } 01394 01395 // try to play any waiting source. 01396 if (!_SourceWaitingForPlay.empty()) 01397 { 01398 // check if the source still exist before trying to play it 01399 if (_Sources.find(_SourceWaitingForPlay.front()) != _Sources.end()) 01400 _SourceWaitingForPlay.front()->play(); 01401 nldebug("Before POP Sources waiting : %u", _SourceWaitingForPlay.size()); 01402 _SourceWaitingForPlay.pop_front(); 01403 nldebug("After POP Sources waiting : %u", _SourceWaitingForPlay.size()); 01404 } 01405 } 01406 } 01407 01408 if (_ClusteredSound) 01409 { 01410 H_AUTO(NLSOUND_UpdateClusteredSound) 01411 // update the clustered sound... 01412 CVector view, up; 01413 _Listener.getOrientation(view, up); 01414 _ClusteredSound->update(_ListenPosition, view, up); 01415 01416 // update all playng track according to there cluster status 01417 for (i=0; i<_NbTracks; ++i) 01418 { 01419 if (_Tracks[i]->isPlaying()) 01420 { 01421 if (_Tracks[i]->getSource() != 0) 01422 { 01423 CSimpleSource *source = _Tracks[i]->getSource(); 01424 if (source->getCluster() != 0) 01425 { 01426 // need to check the cluster status 01427 const CClusteredSound::CClusterSoundStatus *css = _ClusteredSound->getClusterSoundStatus(source->getCluster()); 01428 if (css != 0) 01429 { 01430 // there is some data here, update the virtual position of the sound. 01431 float dist = (css->Position - source->getPos()).norm(); 01432 CVector vpos(_ListenPosition + css->Direction * (css->Dist + dist)); 01433 // _Tracks[i]->DrvSource->setPos(source->getPos() * (1-css->PosAlpha) + css->Position*(css->PosAlpha)); 01434 _Tracks[i]->DrvSource->setPos(source->getPos() * (1-css->PosAlpha) + vpos*(css->PosAlpha)); 01435 // update the relative gain 01436 _Tracks[i]->DrvSource->setGain(source->getRelativeGain()*source->getGain()*css->Gain); 01437 #if EAX_AVAILABLE == 1 01438 if (_UseEax) 01439 { 01440 H_AUTO(NLSOUND_SetEaxProperties) 01441 // update the occlusion parameters 01442 _Tracks[i]->DrvSource->setEAXProperty(DSPROPERTY_EAXBUFFER_OCCLUSION, (void*)&css->Occlusion, sizeof(css->Occlusion)); 01443 _Tracks[i]->DrvSource->setEAXProperty(DSPROPERTY_EAXBUFFER_OCCLUSIONLFRATIO, (void*)&css->OcclusionLFFactor, sizeof(css->OcclusionLFFactor)); 01444 // if (lastRatio[i] != css->OcclusionRoomRatio) 01445 // { 01446 _Tracks[i]->DrvSource->setEAXProperty(DSPROPERTY_EAXBUFFER_OCCLUSIONROOMRATIO, (void*)&css->OcclusionRoomRatio, sizeof(css->OcclusionRoomRatio)); 01447 // lastRatio[i] = css->OcclusionRoomRatio; 01448 // nldebug("Setting room ration."); 01449 // } 01450 _Tracks[i]->DrvSource->setEAXProperty(DSPROPERTY_EAXBUFFER_OBSTRUCTION, (void*)&css->Obstruction, sizeof(css->Obstruction)); 01451 } 01452 #endif 01453 } 01454 } 01455 } 01456 } 01457 } 01458 } 01459 01460 01461 // Debug info 01462 /*uint32 i; 01463 nldebug( "List of the %u tracks", _NbTracks ); 01464 for ( i=0; i!=_NbTracks; i++ ) 01465 { 01466 CSimpleSource *su; 01467 if ( su = _Tracks[i]->getSource() ) 01468 { 01469 nldebug( "%u: %p %s %s %s %s, vol %u", 01470 i, &_Tracks[i]->DrvSource, _Tracks[i]->isAvailable()?"FREE":"USED", 01471 _Tracks[i]->isAvailable()?"":(su->isPlaying()?"PLAYING":"STOPPED"), 01472 _Tracks[i]->isAvailable()?"":PriToCStr[su->getPriority()], 01473 _Tracks[i]->isAvailable()?"":(su->getSound()?su->getSound()->getFilename().c_str():""), 01474 (uint)(su->getGain()*100.0f) ); 01475 } 01476 }*/ 01477 01478 _SoundDriver->commit3DChanges(); 01479 01480 #if NL_PROFILE_MIXER 01481 _UpdateTime = CTime::ticksToSecond(CTime::getPerformanceTime() - start); 01482 _UpdateCount++; 01483 #endif 01484 01485 /* // display the track using... 01486 { 01487 char tmp[2048] = ""; 01488 string str; 01489 01490 for (uint i=0; i<_NbTracks/2; ++i) 01491 { 01492 sprintf(tmp, "[%2u]%8p ", i, _Tracks[i]->getSource()); 01493 str += tmp; 01494 } 01495 nldebug((string("Status1: ")+str).c_str()); 01496 str = ""; 01497 for (i=_NbTracks/2; i<_NbTracks; ++i) 01498 { 01499 sprintf(tmp, "[%2u]%8p ", i, _Tracks[i]->getSource()); 01500 str += tmp; 01501 } 01502 // nldebug((string("Status2: ")+str).c_str()); 01503 } 01504 */ 01505 } |
|
Definition at line 177 of file audio_mixer_user.h. References _UseADPCM.
00177 { return _UseADPCM;}; |
|
Write profiling information about the mixer to the output stream.
Implements NLSOUND::UAudioMixer. Definition at line 227 of file audio_mixer_user.cpp. References _CreateCount, _CreateTime, _FreeTracks, _NbTracks, _PlayingSourcesMuted, _PriorityReserve, _ReserveUsage, _SoundDriver, _SourceWaitingForPlay, _UpdateCount, _UpdateTime, curTime(), getAvailableTracksCount(), getPlayingSourcesCount(), getUsedTracksCount(), NLSOUND::HighestPri, NLSOUND::HighPri, NLSOUND::LowPri, NLSOUND::MidPri, uint, and NLSOUND::ISoundDriver::writeProfile().
00228 { 00229 // compute number of muted source 00230 uint nb = 0; 00231 00232 /* TSourceContainer::iterator first(_Sources.begin()), last(_Sources.end()); 00233 for (; first != last; ++first) 00234 { 00235 CSimpleSource *psu = *first; 00236 if (psu->getTrack() == NULL) 00237 { 00238 ++nb; 00239 } 00240 } 00241 */ 00242 /* hash_set<CSimpleSource*>::const_iterator ips; 00243 for ( ips=_Sources.begin(); ips!=_Sources.end(); ++ips ) 00244 { 00245 CSimpleSource *psu = *ips; 00246 if (psu->getTrack() == NULL) 00247 { 00248 ++nb; 00249 } 00250 } 00251 */ 00252 out << "Mixer: \n"; 00253 out << "Playing sources: " << getPlayingSourcesCount() << " \n"; 00254 out << "Available tracks: " << getAvailableTracksCount() << " \n"; 00255 out << "Used tracks: " << getUsedTracksCount() << " \n"; 00256 // out << "Muted sources: " << nb << " \n"; 00257 // out << "Muted sources: " << max(0, sint(_PlayingSources.size())-sint(_NbTracks)) << " \n"; 00258 // out << "Muted sources: " << max(0, sint(_PlayingSources)-sint(_NbTracks)) << " \n"; 00259 out << "Muted sources: " << (int)_PlayingSourcesMuted << "\n"; 00260 out << "Sources waiting for play: " << _SourceWaitingForPlay.size() << " \n"; 00261 out << "HighestPri: " << (int)_ReserveUsage[HighestPri] << " / " << (int)_PriorityReserve[HighestPri] << " \n"; 00262 out << "HighPri: " << (int)_ReserveUsage[HighPri] << " / " << (int)_PriorityReserve[HighPri] << "\n"; 00263 out << "MidPri: " << (int)_ReserveUsage[MidPri] << " / " << (int)_PriorityReserve[MidPri] << " \n"; 00264 out << "LowPri: " << (int)_ReserveUsage[LowPri] << " / " << (int)_PriorityReserve[LowPri] << " \n"; 00265 out << "FreeTracks: " << _FreeTracks.size() << " / " << _NbTracks << " \n"; 00266 out << "Average update time: " << std::setw(10) << (1000.0 * _UpdateTime / _UpdateCount) << " msec\n"; 00267 out << "Average create time: " << std::setw(10) <<(1000.0 * _CreateTime / _CreateCount) << " msec\n"; 00268 out << "Estimated CPU: " << std::setiosflags(ios::right) << std::setprecision(6) << std::setw(10) << (100.0 * 1000.0 * (_UpdateTime + _CreateTime) / curTime()) << "%\n"; 00269 00270 if (_SoundDriver) 00271 { 00272 out << "\n"; 00273 out << "Driver: \n"; 00274 _SoundDriver->writeProfile(out); 00275 } 00276 } |
|
Definition at line 414 of file audio_mixer_user.h. |
|
Definition at line 415 of file audio_mixer_user.h. |
|
Definition at line 578 of file audio_mixer_user.h. |
|
flag for automatic sample bank loading.
Definition at line 439 of file audio_mixer_user.h. Referenced by createSource(), and init(). |
|
Array of filter name.
Definition at line 467 of file audio_mixer_user.h. Referenced by CAudioMixerUser(), getBackgroundFlagName(), init(), and setBackgroundFlagName(). |
|
Array of filter short names.
Definition at line 469 of file audio_mixer_user.h. Referenced by CAudioMixerUser(), getBackgroundFlagShortName(), init(), and setBackgroundFlagShortName(). |
|
Intance of the background sound manager.
Definition at line 465 of file audio_mixer_user.h. Referenced by applyListenerMove(), getBackgroundFilterFades(), getBackgroundFlags(), getBackgroundSoundManager(), init(), loadBackgroundAudioFromPrimitives(), loadBackgroundEffectsFromRegion(), loadBackgroundSamplesFromRegion(), loadBackgroundSound(), loadBackgroundSoundFromRegion(), playBackgroundSound(), setBackgroundFilterFades(), setBackgroundFlags(), setListenerPos(), stopBackgroundSound(), update(), and ~CAudioMixerUser(). |
|
Assoc between buffer and source. Used when buffers are unloaded.
Definition at line 488 of file audio_mixer_user.h. Referenced by registerBufferAssoc(), and unregisterBufferAssoc(). |
|
Instance of the clustered sound system.
Definition at line 472 of file audio_mixer_user.h. Referenced by getClusteredSound(), initClusteredSound(), update(), and ~CAudioMixerUser(). |
|
Definition at line 575 of file audio_mixer_user.h. Referenced by CAudioMixerUser(), createSource(), and writeProfile(). |
|
Definition at line 573 of file audio_mixer_user.h. Referenced by CAudioMixerUser(), createSource(), and writeProfile(). |
|
List of event ordered by time.
Definition at line 423 of file audio_mixer_user.h. Referenced by update(). |
|
List of update for the event list.
Definition at line 427 of file audio_mixer_user.h. Referenced by addEvent(), removeEvents(), and update(). |
|
List of event ordered by event ptr with there respective multimap iterator.
Definition at line 425 of file audio_mixer_user.h. Referenced by removeEvents(), and update(). |
|
The vector of curently free tracks.
Definition at line 446 of file audio_mixer_user.h. Referenced by freeTrack(), getAvailableTracksCount(), getFreeTrack(), getFreeTracks(), getUsedTracksCount(), init(), and writeProfile(). |
|
The audio mixer singleton instance.
Definition at line 85 of file audio_mixer_user.cpp. |
|
Flag set in destructor.
Definition at line 561 of file audio_mixer_user.h. Referenced by reset(), and ~CAudioMixerUser(). |
|
The listener instance.
Definition at line 475 of file audio_mixer_user.h. Referenced by getListener(), init(), setListenerPos(), and update(). |
|
Listener position vector.
Definition at line 478 of file audio_mixer_user.h. Referenced by applyListenerMove(), createSource(), getFreeTrack(), getListenPosVector(), and update(). |
|
Low water mark. After this number of free voice is reach, reserve can't be overloaded.
Definition at line 456 of file audio_mixer_user.h. Referenced by getFreeTrack(), init(), and setLowWaterMark(). |
|
Max _NbTracks.
Definition at line 559 of file audio_mixer_user.h. Referenced by init(). |
|
Size of the physical sources array (must be <= MAX_TRACKS).
Definition at line 557 of file audio_mixer_user.h. Referenced by bufferUnloaded(), getFreeTrack(), getPolyphony(), getUsedTracksCount(), init(), reset(), setLowWaterMark(), setPriorityReserve(), update(), writeProfile(), and ~CAudioMixerUser(). |
|
The path to the packed sheet files.
Definition at line 483 of file audio_mixer_user.h. Referenced by getPackedSheetPath(), initUserVar(), and setPackedSheetOption(). |
|
Number of source currently playing.
Definition at line 549 of file audio_mixer_user.h. Referenced by decPlayingSource(), getPlayingSourcesCount(), and incPlayingSource(). |
|
Number of source doing muted play.
Definition at line 551 of file audio_mixer_user.h. Referenced by decPlayingSourceMuted(), getMutedPlayingSourcesCount(), incPlayingSourceMuted(), and writeProfile(). |
|
Table of track reserve for each priority.
Definition at line 452 of file audio_mixer_user.h. Referenced by getFreeTrack(), init(), setPriorityReserve(), and writeProfile(). |
|
Table of current playing source for each priority.
Definition at line 454 of file audio_mixer_user.h. Referenced by freeTrack(), getFreeTrack(), init(), and writeProfile(). |
|
The path to the sample banks. This should be specified in the config file.
Definition at line 481 of file audio_mixer_user.h. Referenced by buildSampleBankList(), reloadSampleBanks(), and setSamplePath(). |
|
The sound driver instance.
Definition at line 462 of file audio_mixer_user.h. Referenced by buildSampleBankList(), displayDriverBench(), endDriverBench(), getSoundDriver(), init(), loadSampleBank(), startDriverBench(), update(), writeProfile(), and ~CAudioMixerUser(). |
|
All Logical sources.
Definition at line 546 of file audio_mixer_user.h. Referenced by addSource(), getPlayingSoundsPos(), getSourcesInstanceCount(), getSourcesStats(), removeSource(), reset(), and update(). |
|
The list of non discardable sound to play as soon as possible in order of arrival.
Definition at line 449 of file audio_mixer_user.h. Referenced by addSourceWaitingForPlay(), getFreeTrack(), reset(), update(), and writeProfile(). |
|
Definition at line 563 of file audio_mixer_user.h. |
|
Physical sources array.
Definition at line 555 of file audio_mixer_user.h. |
|
Definition at line 574 of file audio_mixer_user.h. Referenced by CAudioMixerUser(), update(), and writeProfile(). |
|
List of update to add or remove (bool param of the pair).
Definition at line 421 of file audio_mixer_user.h. Referenced by registerUpdate(), unregisterUpdate(), and update(). |
|
List of object to update.
Definition at line 419 of file audio_mixer_user.h. Referenced by update(). |
|
A flag to update or not the packed sheet.
Definition at line 485 of file audio_mixer_user.h. Referenced by getPackedSheetUpdate(), init(), initUserVar(), reloadSampleBanks(), and setPackedSheetOption(). |
|
Definition at line 572 of file audio_mixer_user.h. Referenced by CAudioMixerUser(), update(), and writeProfile(). |
|
flag for usage of ADPCM mixing
Definition at line 441 of file audio_mixer_user.h. Referenced by init(), and useAPDCM(). |
|
flag for usage of eax
Definition at line 443 of file audio_mixer_user.h. |
|
Container for all user controler and currently controled playing source.
Definition at line 435 of file audio_mixer_user.h. Referenced by addUserControledSource(), getUserVar(), initUserVar(), removeUserControledSource(), and setUserVar(). |