Isle
Loading...
Searching...
No Matches
Lego3DSound Class Reference

[AI] Implements 3D positional sound logic for LEGO Island using DirectSound 3D buffers. More...

#include <lego3dsound.h>

Public Member Functions

 Lego3DSound ()
 [AI] Constructs a new Lego3DSound instance and initializes all members to safe default values. [AI] More...
 
virtual ~Lego3DSound ()
 [AI] Destroys the Lego3DSound object and releases associated DirectSound buffers and object references. [AI] More...
 
void Init ()
 [AI] Initializes internal fields to their defaults. Used by constructor and destroy logic. [AI] More...
 
MxResult Create (LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char *p_name, MxS32 p_volume)
 [AI] Initializes 3D sound for a given DirectSound buffer and associates it with a named game object. More...
 
void Destroy ()
 [AI] Cleans up and releases all resources (DirectSound 3D buffer, associated object references). More...
 
MxU32 UpdatePosition (LPDIRECTSOUNDBUFFER p_directSoundBuffer)
 [AI] Recalculates and updates the sound position on the underlying DirectSound 3D buffer or the volume on a fallback 2D buffer based on the associated object's (ROI's) current world position. More...
 
void FUN_10011a60 (LPDIRECTSOUNDBUFFER p_directSoundBuffer, const char *p_name)
 [AI] Associates a new in-world object to this sound, updating its 3D position tracking and (if applicable) enabling 3D positional mode, or disables 3D mode if p_name is NULL. More...
 
void Reset ()
 [AI] Releases any in-world/actor/ROI associations and resets member pointers. More...
 
MxS32 SetDistance (MxS32 p_min, MxS32 p_max)
 [AI] Sets the minimum and maximum 3D sound effective distances if 3D sound is enabled. More...
 

Detailed Description

[AI] Implements 3D positional sound logic for LEGO Island using DirectSound 3D buffers.

Responsible for associating 3D sound buffer positions with game object positions (mainly LegoROI / LegoActor), managing sound properties (volume, frequency), and ensuring realtime in-world relevant audio updates. [AI]

[AI] Each instance can be associated with a named object in the world. It keeps track of whether that object is an actor (for special frequency handling) or a generic ROI, updates positional audio in the scene, and handles the lifecycle of associated DirectSound resources and the linkage to game objects.

Definition at line 19 of file lego3dsound.h.

Constructor & Destructor Documentation

◆ Lego3DSound()

Lego3DSound::Lego3DSound ( )

[AI] Constructs a new Lego3DSound instance and initializes all members to safe default values. [AI]

Definition at line 15 of file lego3dsound.cpp.

◆ ~Lego3DSound()

Lego3DSound::~Lego3DSound ( )
virtual

[AI] Destroys the Lego3DSound object and releases associated DirectSound buffers and object references. [AI]

Definition at line 21 of file lego3dsound.cpp.

Member Function Documentation

◆ Create()

MxResult Lego3DSound::Create ( LPDIRECTSOUNDBUFFER  p_directSoundBuffer,
const char *  p_name,
MxS32  p_volume 
)

[AI] Initializes 3D sound for a given DirectSound buffer and associates it with a named game object.

Sets up position linkage and sound parameters. [AI]

Parameters
p_directSoundBuffer[AI] Pointer to the DirectSoundBuffer (2D) to initialize as a 3D buffer if available.
p_name[AI] Name of the target in-world object (typically a character or other interactive object).
p_volume[AI] Initial base volume to use for this sound.
Returns
[AI] Returns SUCCESS on complete setup, FAILURE if the 3D buffer could not be acquired.

Definition at line 40 of file lego3dsound.cpp.

◆ Destroy()

void Lego3DSound::Destroy ( )

[AI] Cleans up and releases all resources (DirectSound 3D buffer, associated object references).

Definition at line 111 of file lego3dsound.cpp.

◆ FUN_10011a60()

void Lego3DSound::FUN_10011a60 ( LPDIRECTSOUNDBUFFER  p_directSoundBuffer,
const char *  p_name 
)

[AI] Associates a new in-world object to this sound, updating its 3D position tracking and (if applicable) enabling 3D positional mode, or disables 3D mode if p_name is NULL.

Parameters
p_directSoundBuffer[AI] The buffer managed by this sound instance.
p_name[AI] Name of the new object to track, or NULL to disable 3D mode for this buffer.

Definition at line 188 of file lego3dsound.cpp.

◆ Init()

void Lego3DSound::Init ( )

[AI] Initializes internal fields to their defaults. Used by constructor and destroy logic. [AI]

Definition at line 27 of file lego3dsound.cpp.

◆ Reset()

void Lego3DSound::Reset ( )

[AI] Releases any in-world/actor/ROI associations and resets member pointers.

Definition at line 282 of file lego3dsound.cpp.

◆ SetDistance()

MxS32 Lego3DSound::SetDistance ( MxS32  p_min,
MxS32  p_max 
)

[AI] Sets the minimum and maximum 3D sound effective distances if 3D sound is enabled.

Parameters
p_min[AI] Minimum 3D attenuation distance.
p_max[AI] Maximum 3D attenuation distance.
Returns
[AI] 0 on success, -1 if buffer is not available, 1 if not using 3D sound.

Definition at line 300 of file lego3dsound.cpp.

◆ UpdatePosition()

MxU32 Lego3DSound::UpdatePosition ( LPDIRECTSOUNDBUFFER  p_directSoundBuffer)

[AI] Recalculates and updates the sound position on the underlying DirectSound 3D buffer or the volume on a fallback 2D buffer based on the associated object's (ROI's) current world position.

Parameters
p_directSoundBuffer[AI] Pointer to the 2D buffer for fallback positional volume attenuation.
Returns
[AI] TRUE if any positional or frequency update was applied, FALSE otherwise.

Definition at line 132 of file lego3dsound.cpp.


The documentation for this class was generated from the following files: