NLSOUND::UAudioMixer Class Reference

#include <u_audio_mixer.h>

Inheritance diagram for NLSOUND::UAudioMixer:

NLSOUND::CAudioMixerUser

Detailed Description

Game interface for audio

The logical sources represent all entities in the world, from the client's point of view. Their number can be higher than the number of simultaneous playable sound on the soundcard.

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.

Author:
Olivier Cado

Nevrax France

Date:
2001

Definition at line 82 of file u_audio_mixer.h.

Move the primitive.

virtual void init (uint maxTrack=32, bool useEax=true, bool useADPCM=true, NLMISC::IProgressCallback *progressCallBack=NULL, bool autoLoadSample=false)=0
virtual void initClusteredSound (NL3D::CScene *scene, float minGain, float maxDistance, float portalInterpolate=20.0f)=0
virtual void initClusteredSound (NL3D::UScene *uscene, float minGain, float maxDistance, float portalInterpolate=20.0f)=0
virtual void setLowWaterMark (uint value)=0
virtual void setPackedSheetOption (const std::string &path, bool update)=0
virtual void setPriorityReserve (TSoundPriority priorityChannel, uint reserve)=0
virtual void setSamplePath (const std::string &path)=0
UAudioMixercreateAudioMixer ()
 Create the audio mixer singleton and return a pointer to its instance.


Public Member Functions

virtual USourcecreateSource (TSoundId id, bool spawn=false, TSpawnEndCallback cb=NULL, void *callbackUserParam=NULL, NL3D::CCluster *cluster=0, CSoundContext *context=0)=0
 Add a logical sound source (by sound id). To remove a source, just delete it. See createSource(const char*).

virtual USourcecreateSource (const NLMISC::TStringId &name, bool spawn=false, TSpawnEndCallback cb=NULL, void *callbackUserParam=NULL, NL3D::CCluster *cluster=0, CSoundContext *context=0)=0
virtual void enable (bool b)=0
 Disables or reenables the sound.

virtual UListenergetListener ()=0
 Return the listener interface.

virtual TSoundId getSoundId (const NLMISC::TStringId &name)=0
 Get a TSoundId from a name (returns NULL if not found).

virtual void reset ()=0
 Resets the audio system (deletes all the sources, include envsounds).

virtual void selectEnvEffects (const std::string &tag)=0
virtual void setListenerPos (const NLMISC::CVector &pos)=0
virtual void update ()=0
 Update audio mixer (call evenly).

virtual ~UAudioMixer ()
 Destructor.

virtual void displayDriverBench (NLMISC::CLog *log)=0
virtual void endDriverBench ()=0
virtual void startDriverBench ()=0
virtual uint getAvailableTracksCount () const=0
 Return the number of available tracks.

virtual uint getMutedPlayingSourcesCount () const=0
 Return the number muted playing source.

virtual void getPlayingSoundsPos (bool virtualPos, std::vector< std::pair< bool, NLMISC::CVector > > &pos)=0
 Return the number of available tracks.

virtual uint getPlayingSourcesCount () const=0
 Return the number of playing sources.

virtual uint getPolyphony () const=0
 Return the number of mixing tracks (voices).

virtual void getSoundNames (std::vector< NLMISC::TStringId > &names) const=0
 Fill a vector with the names of all loaded sounds.

virtual uint getSourcesInstanceCount () const=0
 Return the number of sources.

virtual std::string getSourcesStats () const=0
 Return a string showing the playing sources.

virtual uint getUsedTracksCount () const=0
 Return the number of used tracks.

virtual void writeProfile (std::ostream &out)=0
virtual const TBackgroundFilterFadesgetBackgroundFilterFades ()=0
virtual const std::string & getBackgroundFlagName (uint flagIndex)=0
virtual const TBackgroundFlagsgetBackgroundFlags ()=0
virtual const std::string & getBackgroundFlagShortName (uint flagIndex)=0
virtual void loadBackgroundAudioFromPrimitives (const NLLIGO::IPrimitive &audioRoot)=0
virtual void loadBackgroundEffectsFromRegion (const NLLIGO::CPrimRegion &region)=0
 Deprecated.

virtual void loadBackgroundSamplesFromRegion (const NLLIGO::CPrimRegion &region)=0
 Deprecated.

virtual void loadBackgroundSound (const std::string &continent, NLLIGO::CLigoConfig &config)=0
virtual void loadBackgroundSoundFromRegion (const NLLIGO::CPrimRegion &region)=0
 Deprecated.

virtual void playBackgroundSound ()=0
virtual void setBackgroundFilterFades (const TBackgroundFilterFades &backgroundFilterFades)=0
virtual void setBackgroundFlagName (uint flagIndex, const std::string &flagName)=0
virtual void setBackgroundFlags (const TBackgroundFlags &backgroundFlags)=0
virtual void setBackgroundFlagShortName (uint flagIndex, const std::string &flagShortName)=0
virtual void stopBackgroundSound ()=0
virtual void getLoadedSampleBankInfo (std::vector< std::pair< std::string, uint > > &result)=0
virtual uint32 getLoadedSampleSize ()=0
virtual uint32 loadSampleBank (bool async, const std::string &filename, std::vector< std::string > *notfoundfiles=NULL)=0
virtual void reloadSampleBanks (bool async)=0
virtual bool unloadSampleBank (const std::string &filename)=0
virtual float getUserVar (NLMISC::TStringId varName)=0
 Return the current value of a user var.

virtual void setUserVar (NLMISC::TStringId varName, float value)=0


Constructor & Destructor Documentation

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

Destructor.

Definition at line 328 of file u_audio_mixer.h.

00328 {}


Member Function Documentation

UAudioMixer * NLSOUND::UAudioMixer::createAudioMixer  )  [static]
 

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 }

virtual USource* NLSOUND::UAudioMixer::createSource TSoundId  id,
bool  spawn = false,
TSpawnEndCallback  cb = NULL,
void *  callbackUserParam = NULL,
NL3D::CCluster cluster = 0,
CSoundContext context = 0
[pure virtual]
 

Add a logical sound source (by sound id). To remove a source, just delete it. See createSource(const char*).

Implemented in NLSOUND::CAudioMixerUser.

virtual USource* NLSOUND::UAudioMixer::createSource const NLMISC::TStringId name,
bool  spawn = false,
TSpawnEndCallback  cb = NULL,
void *  callbackUserParam = NULL,
NL3D::CCluster cluster = 0,
CSoundContext context = 0
[pure virtual]
 

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.

Implemented in NLSOUND::CAudioMixerUser.

Referenced by NL3D::CPSSoundServImpl::createSound(), and NLSOUND::CSoundAnimMarker::play().

virtual void NLSOUND::UAudioMixer::displayDriverBench NLMISC::CLog log  )  [pure virtual]
 

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::enable bool  b  )  [pure virtual]
 

Disables or reenables the sound.

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::endDriverBench  )  [pure virtual]
 

Implemented in NLSOUND::CAudioMixerUser.

virtual uint NLSOUND::UAudioMixer::getAvailableTracksCount  )  const [pure virtual]
 

Return the number of available tracks.

Implemented in NLSOUND::CAudioMixerUser.

virtual const TBackgroundFilterFades& NLSOUND::UAudioMixer::getBackgroundFilterFades  )  [pure virtual]
 

Implemented in NLSOUND::CAudioMixerUser.

virtual const std::string& NLSOUND::UAudioMixer::getBackgroundFlagName uint  flagIndex  )  [pure virtual]
 

Implemented in NLSOUND::CAudioMixerUser.

virtual const TBackgroundFlags& NLSOUND::UAudioMixer::getBackgroundFlags  )  [pure virtual]
 

Implemented in NLSOUND::CAudioMixerUser.

virtual const std::string& NLSOUND::UAudioMixer::getBackgroundFlagShortName uint  flagIndex  )  [pure virtual]
 

Implemented in NLSOUND::CAudioMixerUser.

virtual UListener* NLSOUND::UAudioMixer::getListener  )  [pure virtual]
 

Return the listener interface.

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::getLoadedSampleBankInfo std::vector< std::pair< std::string, uint > > &  result  )  [pure virtual]
 

Return a list of loaded sample bank with theire size.

Implemented in NLSOUND::CAudioMixerUser.

virtual uint32 NLSOUND::UAudioMixer::getLoadedSampleSize  )  [pure virtual]
 

Return the total size in byte of loaded samples.

Implemented in NLSOUND::CAudioMixerUser.

virtual uint NLSOUND::UAudioMixer::getMutedPlayingSourcesCount  )  const [pure virtual]
 

Return the number muted playing source.

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::getPlayingSoundsPos bool  virtualPos,
std::vector< std::pair< bool, NLMISC::CVector > > &  pos
[pure virtual]
 

Return the number of available tracks.

Implemented in NLSOUND::CAudioMixerUser.

virtual uint NLSOUND::UAudioMixer::getPlayingSourcesCount  )  const [pure virtual]
 

Return the number of playing sources.

Implemented in NLSOUND::CAudioMixerUser.

virtual uint NLSOUND::UAudioMixer::getPolyphony  )  const [pure virtual]
 

Return the number of mixing tracks (voices).

Implemented in NLSOUND::CAudioMixerUser.

virtual TSoundId NLSOUND::UAudioMixer::getSoundId const NLMISC::TStringId name  )  [pure virtual]
 

Get a TSoundId from a name (returns NULL if not found).

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::getSoundNames std::vector< NLMISC::TStringId > &  names  )  const [pure virtual]
 

Fill a vector with the names of all loaded sounds.

Implemented in NLSOUND::CAudioMixerUser.

virtual uint NLSOUND::UAudioMixer::getSourcesInstanceCount  )  const [pure virtual]
 

Return the number of sources.

Implemented in NLSOUND::CAudioMixerUser.

virtual std::string NLSOUND::UAudioMixer::getSourcesStats  )  const [pure virtual]
 

Return a string showing the playing sources.

Implemented in NLSOUND::CAudioMixerUser.

virtual uint NLSOUND::UAudioMixer::getUsedTracksCount  )  const [pure virtual]
 

Return the number of used tracks.

Implemented in NLSOUND::CAudioMixerUser.

virtual float NLSOUND::UAudioMixer::getUserVar NLMISC::TStringId  varName  )  [pure virtual]
 

Return the current value of a user var.

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::init uint  maxTrack = 32,
bool  useEax = true,
bool  useADPCM = true,
NLMISC::IProgressCallback progressCallBack = NULL,
bool  autoLoadSample = false
[pure virtual]
 

Initialization

In case of failure, can throw one of these ESoundDriver (Exception) objects: ESoundDriverNotFound, ESoundDriverCorrupted, ESoundDriverOldVersion, ESoundDriverUnknownVersion.

You can ask for EAX support. If EAX support is requested, then the mixer will try to allocate hardware accelerated audio tracks. If the total of available harware track is less than 10, then EAX is automaticaly deactivated. autoLoadSample is used for tools like george or object viewer where you don't bother to specifie each sample bank to load, you just want to ear the sound.

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::initClusteredSound NL3D::CScene scene,
float  minGain,
float  maxDistance,
float  portalInterpolate = 20.0f
[pure virtual]
 

Initialisation of the clustered sound system. CNELU version

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::initClusteredSound NL3D::UScene uscene,
float  minGain,
float  maxDistance,
float  portalInterpolate = 20.0f
[pure virtual]
 

Initialisation of the clustered sound system.

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::loadBackgroundAudioFromPrimitives const NLLIGO::IPrimitive audioRoot  )  [pure virtual]
 

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::loadBackgroundEffectsFromRegion const NLLIGO::CPrimRegion region  )  [pure virtual]
 

Deprecated.

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::loadBackgroundSamplesFromRegion const NLLIGO::CPrimRegion region  )  [pure virtual]
 

Deprecated.

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::loadBackgroundSound const std::string &  continent,
NLLIGO::CLigoConfig config
[pure virtual]
 

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::loadBackgroundSoundFromRegion const NLLIGO::CPrimRegion region  )  [pure virtual]
 

Deprecated.

Implemented in NLSOUND::CAudioMixerUser.

virtual uint32 NLSOUND::UAudioMixer::loadSampleBank bool  async,
const std::string &  filename,
std::vector< std::string > *  notfoundfiles = NULL
[pure virtual]
 

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.

Parameters:
async If true, the sample are loaded in a background thread.
filename Name of the directory that contains the samples to load.
notfoundfiles An optionnal pointer to a vector that will be filled with the list of not found files.

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::playBackgroundSound  )  [pure virtual]
 

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::reloadSampleBanks bool  async  )  [pure virtual]
 

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.

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::reset  )  [pure virtual]
 

Resets the audio system (deletes all the sources, include envsounds).

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::selectEnvEffects const std::string &  tag  )  [pure virtual]
 

Choose the environmental effect(s) corresponding to tag

Deprecated:

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::setBackgroundFilterFades const TBackgroundFilterFades backgroundFilterFades  )  [pure virtual]
 

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::setBackgroundFlagName uint  flagIndex,
const std::string &  flagName
[pure virtual]
 

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::setBackgroundFlags const TBackgroundFlags backgroundFlags  )  [pure virtual]
 

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::setBackgroundFlagShortName uint  flagIndex,
const std::string &  flagShortName
[pure virtual]
 

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::setListenerPos const NLMISC::CVector pos  )  [pure virtual]
 

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.

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::setLowWaterMark uint  value  )  [pure virtual]
 

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.

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::setPackedSheetOption const std::string &  path,
bool  update
[pure virtual]
 

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.

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::setPriorityReserve TSoundPriority  priorityChannel,
uint  reserve
[pure virtual]
 

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.

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::setSamplePath const std::string &  path  )  [pure virtual]
 

Set the global path to the sample banks If you have specified some sample bank to load in the mixer comfig file, you MUST set the sample path BEFORE calling init.

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::setUserVar NLMISC::TStringId  varName,
float  value
[pure virtual]
 

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.

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::startDriverBench  )  [pure virtual]
 

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::stopBackgroundSound  )  [pure virtual]
 

Implemented in NLSOUND::CAudioMixerUser.

virtual bool NLSOUND::UAudioMixer::unloadSampleBank const std::string &  filename  )  [pure virtual]
 

Unload buffers. Return false if the bank can't be unloaded because an async loading is running.

Implemented in NLSOUND::CAudioMixerUser.

virtual void NLSOUND::UAudioMixer::update  )  [pure virtual]
 

Update audio mixer (call evenly).

Implemented in NLSOUND::CAudioMixerUser.

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

Write profiling information about the mixer to the output stream.

Parameters:
out The output stream to which to write the information

Implemented in NLSOUND::CAudioMixerUser.


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