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

Sound cache object managing DirectSound buffers and 3D positioning for preloaded sound data. More...

#include <legocachsound.h>

Inheritance diagram for LegoCacheSound:
Collaboration diagram for LegoCacheSound:

Public Member Functions

 LegoCacheSound ()
 Constructs a new LegoCacheSound and initializes its members to default/empty state. More...
 
 ~LegoCacheSound () override
 Destructor; releases owned sound resources and buffer, unmutes if needed. More...
 
const char * ClassName () const override
 Returns class name (for run-time type checks); always "LegoCacheSound". More...
 
MxBool IsA (const char *p_name) const override
 Checks if this object has a class name equal to p_name, traversing parents. More...
 
virtual MxResult Create (LPPCMWAVEFORMAT p_pwfx, MxString p_mediaSrcPath, MxS32 p_volume, MxU8 *p_data, MxU32 p_dataSize)
 Creates the sound object with given audio format, source path, volume, and initializes DirectSound buffer with provided PCM data. More...
 
virtual void Destroy ()
 Releases allocated DirectSound buffer and internal data, resetting all fields. More...
 
virtual void FUN_10006cd0 (undefined4 param1, undefined4 param2)
 Unknown legacy/function stub. More...
 
const MxStringGetUnknown0x48 () const
 Getter for an unknown string field, likely the sound's base filename. More...
 
const MxBool GetUnknown0x58 () const
 Returns whether this sound is currently playing or is flagged as 'active'. More...
 
LegoCacheSoundClone ()
 Creates an identical copy of this LegoCacheSound, including memory buffers, properties, and audio state. More...
 
MxResult Play (const char *p_name, MxBool p_looping)
 Starts playback of the cached sound in this buffer. More...
 
void Stop ()
 Immediately stops playback and resets buffer, clearing event tag and position cues. More...
 
void FUN_10006be0 ()
 Handles sound updates per tick; manages stopping, buffer state, and 3D-position refreshes if sound is looping/non-looping. More...
 
void SetDistance (MxS32 p_min, MxS32 p_max)
 Sets minimum and maximum audible distances for 3D sound attenuation. More...
 
void MuteSilence (MxBool p_muted)
 Mutes/unmutes by scaling volume to minimum (muted) or restoring original volume. More...
 
void MuteStop (MxBool p_mute)
 Mutes/unmutes by stopping (mute) or resuming playback. More...
 
- Public Member Functions inherited from MxCore
 MxCore ()
 [AI] Constructs a new MxCore object and assigns it a unique id. More...
 
virtual ~MxCore ()
 [AI] Virtual destructor. Required for correct polymorphic cleanup in derived classes. More...
 
virtual MxLong Notify (MxParam &p_param)
 [AI] Virtual callback notification mechanism. More...
 
virtual MxResult Tickle ()
 [AI] Called by tickle managers to allow the object to update itself. More...
 
virtual const char * ClassName () const
 [AI] Returns the runtime class name of this object. More...
 
virtual MxBool IsA (const char *p_name) const
 [AI] Checks whether this object's class type or parents match the given name. More...
 
MxU32 GetId ()
 [AI] Gets the unique (per-process) id assigned to this object instance. More...
 

Detailed Description

Sound cache object managing DirectSound buffers and 3D positioning for preloaded sound data.

[AI]

Used to pre-load sound data into a DirectSound buffer, allowing efficient playback with 3D spatialization via Lego3DSound. Handles both sound data management (copy, free) and buffer control (volume, positional updates, muting, looping, stop/play). [AI]

Definition at line 17 of file legocachsound.h.

Constructor & Destructor Documentation

◆ LegoCacheSound()

LegoCacheSound::LegoCacheSound ( )

Constructs a new LegoCacheSound and initializes its members to default/empty state.

[AI]

Definition at line 13 of file legocachsound.cpp.

◆ ~LegoCacheSound()

LegoCacheSound::~LegoCacheSound ( )
override

Destructor; releases owned sound resources and buffer, unmutes if needed.

[AI]

Definition at line 20 of file legocachsound.cpp.

Member Function Documentation

◆ ClassName()

const char * LegoCacheSound::ClassName ( ) const
inlineoverridevirtual

Returns class name (for run-time type checks); always "LegoCacheSound".

[AI]

Returns
The string "LegoCacheSound". [AI]

Reimplemented from MxCore.

Definition at line 32 of file legocachsound.h.

◆ Clone()

LegoCacheSound * LegoCacheSound::Clone ( )

Creates an identical copy of this LegoCacheSound, including memory buffers, properties, and audio state.

[AI]

Used when multiple independent instances of the same preloaded audio asset are desired, e.g. in overlapping sound effect playback. [AI]

Returns
Pointer to the new clone or nullptr if copy fails. [AI]

Definition at line 130 of file legocachsound.cpp.

◆ Create()

MxResult LegoCacheSound::Create ( LPPCMWAVEFORMAT  p_pwfx,
MxString  p_mediaSrcPath,
MxS32  p_volume,
MxU8 p_data,
MxU32  p_dataSize 
)
virtual

Creates the sound object with given audio format, source path, volume, and initializes DirectSound buffer with provided PCM data.

[AI]

Parameters
p_pwfxPointer to PCM audio format. [AI]
p_mediaSrcPathSource path, used for identifying/basename only. [AI]
p_volumeInitial playback volume (0..100 range expected). [AI]
p_dataPCM audio data (copied internally, may be nullptr). [AI]
p_dataSizeSize of audio data buffer (must match buffer allocation if p_data provided). [AI]
Returns
SUCCESS if buffer creation and setup succeeded, FAILURE otherwise. [AI]

Definition at line 42 of file legocachsound.cpp.

◆ Destroy()

void LegoCacheSound::Destroy ( )
virtual

Releases allocated DirectSound buffer and internal data, resetting all fields.

[AI]

Definition at line 116 of file legocachsound.cpp.

◆ FUN_10006be0()

void LegoCacheSound::FUN_10006be0 ( )

Handles sound updates per tick; manages stopping, buffer state, and 3D-position refreshes if sound is looping/non-looping.

[AI]

Called every tick to check playback status for looping sound, update position for 3D audio, mute, or stop when finished. [AI]

Definition at line 230 of file legocachsound.cpp.

◆ FUN_10006cd0()

void LegoCacheSound::FUN_10006cd0 ( undefined4  param1,
undefined4  param2 
)
virtual

Unknown legacy/function stub.

Does nothing. [AI]

Parameters
param1Unknown (possibly reserved/legacy). [AI]
param2Unknown (possibly reserved/legacy). [AI]

Definition at line 283 of file legocachsound.cpp.

◆ GetUnknown0x48()

const MxString & LegoCacheSound::GetUnknown0x48 ( ) const
inline

Getter for an unknown string field, likely the sound's base filename.

[AI]

Returns
Base filename or unique identifier for this sound, derived from mediaSrcPath. [AI]

Definition at line 81 of file legocachsound.h.

◆ GetUnknown0x58()

const MxBool LegoCacheSound::GetUnknown0x58 ( ) const
inline

Returns whether this sound is currently playing or is flagged as 'active'.

[AI]

Returns
TRUE if sound is playing, should be updated, or is otherwise 'active'. [AI]

Definition at line 87 of file legocachsound.h.

◆ IsA()

MxBool LegoCacheSound::IsA ( const char *  p_name) const
inlineoverridevirtual

Checks if this object has a class name equal to p_name, traversing parents.

[AI]

Parameters
p_nameName to check against this class or its base classes. [AI]
Returns
TRUE if p_name matches or parent returns TRUE [AI]

Reimplemented from MxCore.

Definition at line 44 of file legocachsound.h.

◆ MuteSilence()

void LegoCacheSound::MuteSilence ( MxBool  p_muted)

Mutes/unmutes by scaling volume to minimum (muted) or restoring original volume.

[AI]

Parameters
p_mutedIf TRUE, mute by reducing volume; if FALSE, restore volume. [AI]

Definition at line 288 of file legocachsound.cpp.

◆ MuteStop()

void LegoCacheSound::MuteStop ( MxBool  p_mute)

Mutes/unmutes by stopping (mute) or resuming playback.

[AI]

Parameters
p_muteIf TRUE, mute by stopping playback; if FALSE, resume. [AI]

Definition at line 306 of file legocachsound.cpp.

◆ Play()

MxResult LegoCacheSound::Play ( const char *  p_name,
MxBool  p_looping 
)

Starts playback of the cached sound in this buffer.

Sets loop mode, resets buffer, writes audio and starts play. [AI]

Parameters
p_nameOptional: Tag/name representing playback event or context. [AI]
p_loopingIf TRUE, playback will loop; if FALSE, plays once. [AI]
Returns
SUCCESS if playback starts, FAILURE for missing/invalid buffer/data. [AI]

Definition at line 147 of file legocachsound.cpp.

◆ SetDistance()

void LegoCacheSound::SetDistance ( MxS32  p_min,
MxS32  p_max 
)

Sets minimum and maximum audible distances for 3D sound attenuation.

[AI]

Parameters
p_minMinimum distance for unattenuated playback. [AI]
p_maxMaximum distance at which sound will be silent. [AI]

Definition at line 276 of file legocachsound.cpp.

◆ Stop()

void LegoCacheSound::Stop ( )

Immediately stops playback and resets buffer, clearing event tag and position cues.

[AI]

Definition at line 210 of file legocachsound.cpp.


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