|
Isle
|
Manages MIDI music playback with Win32 MIDI streaming for the LEGO Island engine. More...
#include <mxmusicmanager.h>


Public Member Functions | |
| MxMusicManager () | |
| Constructs an instance and initializes member data. More... | |
| ~MxMusicManager () override | |
| Destructor, ensures proper cleanup of resources and MIDI deinitialization. More... | |
| void | Destroy () override |
| Releases all resources and stops streaming. More... | |
| void | SetVolume (MxS32 p_volume) override |
| Sets the music playback volume, taking into account multiplier for overall gain adjustment. More... | |
| virtual MxResult | Create (MxU32 p_frequencyMS, MxBool p_createThread) |
| Initializes and starts MIDI playback. More... | |
| MxBool | GetMIDIInitialized () |
| Checks if the MIDI system is currently initialized and ready. More... | |
| void | GetMIDIVolume (DWORD &p_volume) |
| Retrieves the current hardware MIDI out volume. More... | |
| MxResult | ResetStream () |
| Schedules and streams the next chunk of MIDI data; handles buffer looping and completion. More... | |
| void | ResetBuffer () |
| Resets the MIDI buffer to the starting offset and sets the buffer size to the full stream. More... | |
| MxResult | InitializeMIDI (MxU8 *p_data, MxS32 p_loopCount) |
| Initializes streaming for a MIDI data buffer and begins playback. More... | |
| void | DeinitializeMIDI () |
| Stops playback and releases all MIDI streaming resources. More... | |
| void | SetMultiplier (MxS32 p_multiplier) |
| Sets the volume multiplier for scaling volume output. More... | |
Public Member Functions inherited from MxAudioManager | |
| MxAudioManager () | |
| [AI] Constructs the audio manager and initializes default volume. More... | |
| ~MxAudioManager () override | |
| [AI] Destructs the audio manager and handles cleanup of resources. More... | |
| MxResult | Create () override |
| [AI] Initializes audio subsystem resources and registers an instance for global audio management. More... | |
| void | Destroy () override |
| [AI] Tears down the audio subsystem instance and unregisters it from global management. More... | |
| virtual MxS32 | GetVolume () |
| [AI] Gets the current global audio volume. More... | |
| virtual void | SetVolume (MxS32 p_volume) |
| [AI] Sets the current global audio volume. More... | |
Public Member Functions inherited from MxMediaManager | |
| MxMediaManager () | |
| [AI] Constructor. More... | |
| ~MxMediaManager () override | |
| [AI] Destructor. More... | |
| MxResult | Tickle () override |
| [AI] Called by the tickle manager to step through and update all presenters, and process their output data. More... | |
| virtual MxResult | Create () |
| [AI] Allocates and initializes the internal presenter list for this manager, ensuring thread safety. More... | |
| virtual void | Destroy () |
| [AI] Destroys all registered presenters and resets the internal state, ensuring safe resource disposal. More... | |
| virtual void | RegisterPresenter (MxPresenter &p_presenter) |
| [AI] Register a new presenter for tickle management and playback coordination. More... | |
| virtual void | UnregisterPresenter (MxPresenter &p_presenter) |
| [AI] Remove a presenter from tickle and managed output lists. More... | |
| virtual void | StopPresenters () |
| [AI] Stops/ends the action on all registered presenters, typically halting all playback and output. More... | |
| MxResult | Init () |
| [AI] Initializes all internal members to their default values. 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... | |
Protected Member Functions | |
| void | Init () |
| Initializes multipliers and buffer with default values; called from constructor/Destroy. More... | |
| void | InitData () |
| Initializes and zeros all associated MIDI-related member data. More... | |
Protected Member Functions inherited from MxAudioManager | |
| void | Init () |
| [AI] Initializes audio manager state, setting default volume and other relevant fields. More... | |
Additional Inherited Members | |
Protected Attributes inherited from MxAudioManager | |
| MxS32 | m_volume |
| [AI] Holds the current global audio volume for the game. More... | |
Protected Attributes inherited from MxMediaManager | |
| MxPresenterList * | m_presenters |
| [AI] Pointer to list of currently registered (active) presenters. More... | |
| MxThread * | m_thread |
| [AI] Optional pointer to a worker thread used for media dispatch/IO (if multi-threaded operation is used, otherwise NULL). More... | |
| MxCriticalSection | m_criticalSection |
| [AI] Critical section object used for guarding access to the presenter list and internal members for thread safety. More... | |
Manages MIDI music playback with Win32 MIDI streaming for the LEGO Island engine.
[AI] Forward declaration for the music manager controlling soundtrack playback and music resources.
[AI]
MxMusicManager inherits from MxAudioManager and extends it with MIDI handling, including streaming, looping, MIDI hardware initialization, and volume/multiplier mixing controls. Designed for music playback, including looping, dynamic volume control, and integration with audio tickling threads for timing. [AI]
Definition at line 16 of file mxmusicmanager.h.
| MxMusicManager::MxMusicManager | ( | ) |
Constructs an instance and initializes member data.
[AI]
Definition at line 12 of file mxmusicmanager.cpp.
|
override |
Destructor, ensures proper cleanup of resources and MIDI deinitialization.
[AI]
Definition at line 18 of file mxmusicmanager.cpp.
Initializes and starts MIDI playback.
[AI]
Optionally creates a tickle thread for timing, or registers this as a tickle client with the given tick interval (in ms). [AI]
| p_frequencyMS | Interval in ms between tickle updates. [AI] |
| p_createThread | If TRUE, creates a separate MxTickleThread for streaming. If FALSE, uses global TickleManager. [AI] |
Definition at line 142 of file mxmusicmanager.cpp.
| void MxMusicManager::DeinitializeMIDI | ( | ) |
Stops playback and releases all MIDI streaming resources.
[AI]
Restores hardware volume to original, stops stream, unprepares header, and deletes buffer data. [AI]
Definition at line 279 of file mxmusicmanager.cpp.
|
overridevirtual |
Releases all resources and stops streaming.
[AI]
Disables music playback and unregisters the tickle client. Called automatically from the destructor with p_fromDestructor=TRUE, or manually with p_fromDestructor=FALSE. [AI]
| p_fromDestructor | TRUE if called from destructor (does not call base class Destroy if true). [AI] |
Reimplemented from MxAudioManager.
Definition at line 177 of file mxmusicmanager.cpp.
|
inline |
Checks if the MIDI system is currently initialized and ready.
[AI]
Definition at line 54 of file mxmusicmanager.h.
|
inline |
Retrieves the current hardware MIDI out volume.
[AI]
If unable to get volume, sets to calculated value corresponding to 100%. [AI]
| p_volume | Variable to receive current MIDI volume (hardware format, two-channel 0x0000HHHH | 0x0000LLLL). [AI] |
Definition at line 61 of file mxmusicmanager.h.
|
protected |
Initializes multipliers and buffer with default values; called from constructor/Destroy.
[AI]
Definition at line 24 of file mxmusicmanager.cpp.
|
protected |
Initializes and zeros all associated MIDI-related member data.
[AI]
Used to reinitialize this object after deallocation or streaming end. [AI]
Definition at line 31 of file mxmusicmanager.cpp.
Initializes streaming for a MIDI data buffer and begins playback.
[AI]
| p_data | Pointer to MIDI data buffer, expected to be prepared for streaming. [AI] |
| p_loopCount | Number of times to loop playback, or -1 for infinite. [AI] |
Definition at line 208 of file mxmusicmanager.cpp.
| void MxMusicManager::ResetBuffer | ( | ) |
Resets the MIDI buffer to the starting offset and sets the buffer size to the full stream.
[AI]
Definition at line 115 of file mxmusicmanager.cpp.
| MxResult MxMusicManager::ResetStream | ( | ) |
Schedules and streams the next chunk of MIDI data; handles buffer looping and completion.
[AI]
Returns FAILURE on buffer underrun/error, or if looping/completion disables playback. [AI]
Definition at line 67 of file mxmusicmanager.cpp.
| void MxMusicManager::SetMultiplier | ( | MxS32 | p_multiplier | ) |
Sets the volume multiplier for scaling volume output.
[AI]
Used for fade in/out or global gain controls on top of per-track volume. [AI]
| p_multiplier | Multiplier value (percentage, where 100 = normal, 0 = muted). [AI] |
Definition at line 192 of file mxmusicmanager.cpp.
|
overridevirtual |
Sets the music playback volume, taking into account multiplier for overall gain adjustment.
[AI]
| p_volume | Percentage of the total volume (0-100). [AI] |
Reimplemented from MxAudioManager.
Definition at line 183 of file mxmusicmanager.cpp.