Isle
Loading...
Searching...
No Matches
mxmusicmanager.h
Go to the documentation of this file.
1#ifndef MXMUSICMANAGER_H
2#define MXMUSICMANAGER_H
3
4#include "decomp.h"
5#include "mxaudiomanager.h"
6
7#include <windows.h>
8
9// VTABLE: LEGO1 0x100dc930
10// SIZE 0x58
11
17public:
22
26 ~MxMusicManager() override;
27
33 void Destroy() override; // vtable+18
34
39 void SetVolume(MxS32 p_volume) override; // vtable+2c
40
48 virtual MxResult Create(MxU32 p_frequencyMS, MxBool p_createThread); // vtable+30
49
54 MxBool GetMIDIInitialized() { return m_midiInitialized; }
55
61 void GetMIDIVolume(DWORD& p_volume)
62 {
63 if (midiOutGetVolume((HMIDIOUT) m_midiStreamH, &p_volume)) {
64 p_volume = CalculateVolume(100);
65 }
66 }
67
73
77 void ResetBuffer();
78
85 MxResult InitializeMIDI(MxU8* p_data, MxS32 p_loopCount);
86
91 void DeinitializeMIDI();
92
98 void SetMultiplier(MxS32 p_multiplier);
99
100private:
105 void Destroy(MxBool p_fromDestructor);
106
112 MxS32 CalculateVolume(MxS32 p_volume);
113
117 void SetMIDIVolume();
118
128 static void CALLBACK MidiCallbackProc(HDRVR p_hdrvr, UINT p_uMsg, DWORD p_dwUser, DWORD p_dw1, DWORD p_dw2);
129
130 HMIDISTRM m_midiStreamH;
131 MxBool m_midiInitialized;
132 MxU32 m_bufferSize;
133 MxU32 m_bufferCurrentSize;
134 MxU8* m_bufferOffset;
135 MxU8* m_bufferCurrentOffset;
136 MxU32 m_loopCount;
137 MIDIHDR* m_midiHdrP;
138 MxS32 m_multiplier;
139 DWORD m_midiVolume;
140
141protected:
145 void Init();
146
151 void InitData();
152};
153
154#endif // MXMUSICMANAGER_H
[AI] Audio subsystem manager for the LEGO Island engine, responsible for managing audio playback and ...
MxResult Create() override
[AI] Initializes audio subsystem resources and registers an instance for global audio management.
Manages MIDI music playback with Win32 MIDI streaming for the LEGO Island engine.
void InitData()
Initializes and zeros all associated MIDI-related member data.
MxMusicManager()
Constructs an instance and initializes member data.
void Destroy() override
Releases all resources and stops streaming.
void DeinitializeMIDI()
Stops playback and releases all MIDI streaming resources.
void SetMultiplier(MxS32 p_multiplier)
Sets the volume multiplier for scaling volume output.
MxResult ResetStream()
Schedules and streams the next chunk of MIDI data; handles buffer looping and completion.
void Init()
Initializes multipliers and buffer with default values; called from constructor/Destroy.
MxResult InitializeMIDI(MxU8 *p_data, MxS32 p_loopCount)
Initializes streaming for a MIDI data buffer and begins playback.
MxBool GetMIDIInitialized()
Checks if the MIDI system is currently initialized and ready.
void GetMIDIVolume(DWORD &p_volume)
Retrieves the current hardware MIDI out volume.
void SetVolume(MxS32 p_volume) override
Sets the music playback volume, taking into account multiplier for overall gain adjustment.
void ResetBuffer()
Resets the MIDI buffer to the starting offset and sets the buffer size to the full stream.
~MxMusicManager() override
Destructor, ensures proper cleanup of resources and MIDI deinitialization.
typedef DWORD(FAR PASCAL *LPCLIPPERCALLBACK)(LPDIRECTDRAWCLIPPER lpDDClipper
MxU8 MxBool
[AI]
Definition: mxtypes.h:124
MxLong MxResult
[AI]
Definition: mxtypes.h:106
unsigned char MxU8
[AI]
Definition: mxtypes.h:8
signed int MxS32
[AI]
Definition: mxtypes.h:38
unsigned int MxU32
[AI]
Definition: mxtypes.h:32