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

[AI] Background music manager that handles playback, volume, state transitions, and notifications for background audio tracks in the game. More...

#include <mxbackgroundaudiomanager.h>

Inheritance diagram for MxBackgroundAudioManager:
Collaboration diagram for MxBackgroundAudioManager:

Public Member Functions

 MxBackgroundAudioManager ()
 [AI] Constructs and registers the background audio manager, initializing internal state. More...
 
 ~MxBackgroundAudioManager () override
 [AI] Destructor unregisters from notification and tickle managers and stops any playing music. More...
 
MxLong Notify (MxParam &p_param) override
 [AI] Handles notification events such as start/stop actions relating to audio. More...
 
MxResult Tickle () override
 [AI] Called periodically by the tickle manager. More...
 
const char * ClassName () const override
 [AI] Returns the class name string literal. More...
 
MxBool IsA (const char *p_name) const override
 [AI] Type-checks if the instance is, or inherits from, MxBackgroundAudioManager. More...
 
MxBool GetEnabled ()
 [AI] Returns whether background audio management is currently enabled. More...
 
void StartAction (MxParam &p_param)
 [AI] Handles incoming start action notification, sets up pending audio presenter and prepares (but does not play) a new track for fading in. More...
 
void StopAction (MxParam &p_param)
 [AI] Handles incoming end action notification, resets state and clears finished presenters/actions; notifies game logic via Lego()->HandleEndAction(). More...
 
MxResult PlayMusic (MxDSAction &p_action, undefined4 p_speed, MxPresenter::TickleState p_tickleState)
 [AI] Initiates playback of a new background music action with specified speed and target tickle state if possible (e.g., old music not in process). More...
 
void FUN_1007ee70 ()
 [AI] Implements state update for e_streaming tickle state. Handles music track transition (fade out previous, apply new track to active slot). More...
 
void FUN_1007ef40 ()
 [AI] Handles music volume raising/lowering and track transitions in the e_repeating tickle state, implementing fade out for current and fade in for next track. More...
 
void FadeInOrFadeOut ()
 [AI] Performs volume fade in/fade out logic, adjusting music volume towards target; sets tickle state to idle when target volume is reached. More...
 
void Enable (MxBool p_enable)
 [AI] Enables or disables the background audio manager. More...
 
virtual MxResult Create (MxAtomId &p_script, MxU32 p_frequencyMS)
 [AI] Opens the music script (SI file) for streaming and registers this background audio manager as a tickle client; used during game/scene transitions. More...
 
void Init ()
 [AI] Reinitializes manager's active presenter and tickle state; typically called at the start of a scene or audio context. More...
 
void Stop ()
 [AI] Immediately stops all background music, clears all actions and presenters, and resets tickle state. More...
 
void LowerVolume ()
 [AI] Requests a reduction in current background music volume, queuing for fade out (increments suppression counter). Initiates fade if not already started. More...
 
void RaiseVolume ()
 [AI] Requests that the background music volume is raised (decrements suppression counter); triggers fade-in if suppression goes to zero. More...
 
undefined4 FUN_1007f610 (MxPresenter *p_unk0x138, MxS32 p_speed, MxPresenter::TickleState p_tickleState)
 [AI] Helper for queued volume changing: Sets up a coming presenter/action for activation with given speed and tickle state. 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

[AI] Background music manager that handles playback, volume, state transitions, and notifications for background audio tracks in the game.

Registers itself to the NotificationManager and TickleManager for event and periodic updates.

[AI] Responsible for handling the life cycle of background music tracks (open, play, fade, stop, destroy), performing volume fades (in/out) and transitioning between background tracks as needed. Operates through MxAudioPresenter objects related to current and pending audio actions.

See also
MxAudioPresenter, MxDSAction [AI]

Definition at line 17 of file mxbackgroundaudiomanager.h.

Constructor & Destructor Documentation

◆ MxBackgroundAudioManager()

MxBackgroundAudioManager::MxBackgroundAudioManager ( )

[AI] Constructs and registers the background audio manager, initializing internal state.

Definition at line 18 of file mxbackgroundaudiomanager.cpp.

◆ ~MxBackgroundAudioManager()

MxBackgroundAudioManager::~MxBackgroundAudioManager ( )
override

[AI] Destructor unregisters from notification and tickle managers and stops any playing music.

Definition at line 31 of file mxbackgroundaudiomanager.cpp.

Member Function Documentation

◆ ClassName()

const char * MxBackgroundAudioManager::ClassName ( ) const
inlineoverridevirtual

[AI] Returns the class name string literal.

Reimplemented from MxCore.

Definition at line 35 of file mxbackgroundaudiomanager.h.

◆ Create()

MxResult MxBackgroundAudioManager::Create ( MxAtomId p_script,
MxU32  p_frequencyMS 
)
virtual

[AI] Opens the music script (SI file) for streaming and registers this background audio manager as a tickle client; used during game/scene transitions.

Parameters
p_scriptAtomId representing the music script to load [AI]
p_frequencyMSUpdate tickle interval in milliseconds (used for registration) [AI]
Returns
SUCCESS if successfully opened/created, FAILURE otherwise [AI]

Definition at line 39 of file mxbackgroundaudiomanager.cpp.

◆ Enable()

void MxBackgroundAudioManager::Enable ( MxBool  p_enable)

[AI] Enables or disables the background audio manager.

Stops music when disabling.

Parameters
p_enableTrue to enable, False to disable [AI]

Definition at line 336 of file mxbackgroundaudiomanager.cpp.

◆ FadeInOrFadeOut()

void MxBackgroundAudioManager::FadeInOrFadeOut ( )

[AI] Performs volume fade in/fade out logic, adjusting music volume towards target; sets tickle state to idle when target volume is reached.

Definition at line 167 of file mxbackgroundaudiomanager.cpp.

◆ FUN_1007ee70()

void MxBackgroundAudioManager::FUN_1007ee70 ( )

[AI] Implements state update for e_streaming tickle state. Handles music track transition (fade out previous, apply new track to active slot).

Definition at line 99 of file mxbackgroundaudiomanager.cpp.

◆ FUN_1007ef40()

void MxBackgroundAudioManager::FUN_1007ef40 ( )

[AI] Handles music volume raising/lowering and track transitions in the e_repeating tickle state, implementing fade out for current and fade in for next track.

Definition at line 116 of file mxbackgroundaudiomanager.cpp.

◆ FUN_1007f610()

undefined4 MxBackgroundAudioManager::FUN_1007f610 ( MxPresenter p_unk0x138,
MxS32  p_speed,
MxPresenter::TickleState  p_tickleState 
)

[AI] Helper for queued volume changing: Sets up a coming presenter/action for activation with given speed and tickle state.

Parameters
p_unk0x138Presenter pending activation [AI_SUGGESTED_NAME: p_audioPresenter]
p_speedSpeed for fade in/out [AI]
p_tickleStateTickle state for the transition [AI]
Returns
Unused, always 0 [AI]

Definition at line 349 of file mxbackgroundaudiomanager.cpp.

◆ GetEnabled()

MxBool MxBackgroundAudioManager::GetEnabled ( )
inline

[AI] Returns whether background audio management is currently enabled.

Returns
True if manager is enabled; otherwise False [AI]

Definition at line 51 of file mxbackgroundaudiomanager.h.

◆ Init()

void MxBackgroundAudioManager::Init ( )

[AI] Reinitializes manager's active presenter and tickle state; typically called at the start of a scene or audio context.

Definition at line 368 of file mxbackgroundaudiomanager.cpp.

◆ IsA()

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

[AI] Type-checks if the instance is, or inherits from, MxBackgroundAudioManager.

Parameters
p_nameName of class to check [AI]
Returns
True if p_name matches or is a base class [AI]

Reimplemented from MxCore.

Definition at line 44 of file mxbackgroundaudiomanager.h.

◆ LowerVolume()

void MxBackgroundAudioManager::LowerVolume ( )

[AI] Requests a reduction in current background music volume, queuing for fade out (increments suppression counter). Initiates fade if not already started.

Definition at line 309 of file mxbackgroundaudiomanager.cpp.

◆ Notify()

MxLong MxBackgroundAudioManager::Notify ( MxParam p_param)
overridevirtual

[AI] Handles notification events such as start/stop actions relating to audio.

Parameters
p_paramNotification parameter; expected to be a MxNotificationParam [AI]
Returns
1 if notification was handled, 0 otherwise [AI]

Reimplemented from MxCore.

Definition at line 199 of file mxbackgroundaudiomanager.cpp.

◆ PlayMusic()

MxResult MxBackgroundAudioManager::PlayMusic ( MxDSAction p_action,
undefined4  p_speed,
MxPresenter::TickleState  p_tickleState 
)

[AI] Initiates playback of a new background music action with specified speed and target tickle state if possible (e.g., old music not in process).

Parameters
p_actionNew DS action (music track) to play [AI]
p_speedVolume fade-in/fade-out speed [AI]
p_tickleStateTarget tickle state after transition (e.g., e_streaming, e_repeating) [AI]
Return values
SUCCESSIf the music is started [AI]
FAILUREOtherwise [AI]

Definition at line 244 of file mxbackgroundaudiomanager.cpp.

◆ RaiseVolume()

void MxBackgroundAudioManager::RaiseVolume ( )

[AI] Requests that the background music volume is raised (decrements suppression counter); triggers fade-in if suppression goes to zero.

Definition at line 322 of file mxbackgroundaudiomanager.cpp.

◆ StartAction()

void MxBackgroundAudioManager::StartAction ( MxParam p_param)

[AI] Handles incoming start action notification, sets up pending audio presenter and prepares (but does not play) a new track for fading in.

Parameters
p_paramNotification parameter (MxNotificationParam expected) [AI]

Definition at line 215 of file mxbackgroundaudiomanager.cpp.

◆ Stop()

void MxBackgroundAudioManager::Stop ( )

[AI] Immediately stops all background music, clears all actions and presenters, and resets tickle state.

Definition at line 286 of file mxbackgroundaudiomanager.cpp.

◆ StopAction()

void MxBackgroundAudioManager::StopAction ( MxParam p_param)

[AI] Handles incoming end action notification, resets state and clears finished presenters/actions; notifies game logic via Lego()->HandleEndAction().

Parameters
p_paramNotification parameter [AI]

Definition at line 226 of file mxbackgroundaudiomanager.cpp.

◆ Tickle()

MxResult MxBackgroundAudioManager::Tickle ( )
overridevirtual

[AI] Called periodically by the tickle manager.

Updates audio manager state based on current tickle state (e.g., fade in/out, streaming/repeating logic).

Returns
Always returns SUCCESS [AI]

Reimplemented from MxCore.

Definition at line 82 of file mxbackgroundaudiomanager.cpp.


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