nw::snd::Sound3DEngine::UpdateAmbientParam Member Function

Syntax

#include <nw/snd/snd_Sound3DEngine.h>
protected:
virtual void UpdateAmbientParam(
     const Sound3DManager * sound3DManager,
     const Sound3DParam * sound3DParam,
     u32 soundId,
     u32 updateFlag,
     SoundAmbientParam * ambientParam
);

Arguments

Name Description
in sound3DManager The 3D Sound Manager.
in sound3DParam The 3D sound parameter.
in soundId Sound ID.
in updateFlag A flag that shows which parameters to update.
out ambientParam Parameter structure that stores the results of the calculation.

Return Values

None.

Description

Calculates 3D sound parameters.

This function is called when a sound is started and when it is updated in each frame.

Override this function when creating a customized 3D sound engine class and store the parameter calculation results in ambientParam. The stored values will be reflected in the sound processing at each frame.

3D sound listener and 3D sound actor information is used to calculate the parameters. 3D sound listeners can be obtained from sound3DManager. Additionally, the sound3DParam parameter structure, used during calculation, includes actor coordinates and the 3D sound settings for each sound.

updateFlag is a bit flag that shows which parameters must be calculated. The parameters in the ambientParam structure that correspond to each of the flags are updated with respect to the sound. Operations are undefined when a parameter that does not have its flag set is updated.


UPDATE_VOLUME ... ambientParam.volume
UPDATE_PAN ... ambientParam.pan
UPDATE_PRIORITY ... ambientParam.priority
UPDATE_PITCH ... ambientParam.pitch

When this function is called to calculate priorities before sound playback begins, UPDATE_START_PRIORITY is set in updateFlag. (UPDATE_PRIORITY is also set at this time.)

The results from the previous cycle of 3D sound calculations are stored in the ambientParam structure passed as an argument. When overriding the UpdateAmbientParam function, you can avoid sudden parameter changes by comparing the values passed here with the values calculated in the current cycle. This comparison allows you to suppress popping and crackling noises.

See Also

Sound3DManager Class
Sound3DParam Structure
SoundAmbientParam Class

Revision History

2010/03/12
Initial version.

CONFIDENTIAL