finish MusicManager (#453)

* finish MusicManager

* Fixes/improvements

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Nathan M Gilbert
2024-01-18 13:23:13 -05:00
committed by GitHub
parent 909c44b679
commit 30b35981d3
7 changed files with 168 additions and 23 deletions

View File

@@ -4,6 +4,8 @@
#include "decomp.h"
#include "mxaudiomanager.h"
#include <windows.h>
// VTABLE: LEGO1 0x100dc930
// SIZE 0x58
class MxMusicManager : public MxAudioManager {
@@ -16,9 +18,17 @@ public:
virtual MxResult Create(MxU32 p_frequencyMS, MxBool p_createThread); // vtable+30
inline MxBool GetMIDIInitialized() { return m_midiInitialized; }
inline void GetMIDIVolume(DWORD& p_volume)
{
if (midiOutGetVolume((HMIDIOUT) m_midiStreamH, &p_volume)) {
p_volume = CalculateVolume(100);
}
}
MxResult ResetStream();
void ResetBuffer();
undefined4 InitializeMIDI(MxU8* p_data, MxS32 p_loopCount);
void DeinitializeMIDI();
undefined4 FUN_100c09c0(MxU8* p_data, MxS32 p_loopCount);
void SetMultiplier(MxS32 p_multiplier);
private:
@@ -27,16 +37,19 @@ private:
MxS32 CalculateVolume(MxS32 p_volume);
void SetMIDIVolume();
HMIDISTRM m_midiStreamH; // 0x30
MxBool m_midiInitialized; // 0x34
undefined4 m_unk0x38; // 0x38
undefined4 m_unk0x3c; // 0x3c
undefined4 m_unk0x40; // 0x40
undefined4 m_unk0x44; // 0x44
undefined4 m_unk0x48; // 0x48
MIDIHDR* m_midiHdrP; // 0x4c
MxS32 m_multiplier; // 0x50
DWORD m_midiVolume; // 0x54
static void CALLBACK
MidiCallbackProc(HMIDIOUT p_hmo, UINT p_wMsg, DWORD_PTR p_dwInstance, DWORD_PTR p_dwParam1, DWORD_PTR p_dwParam2);
HMIDISTRM m_midiStreamH; // 0x30
MxBool m_midiInitialized; // 0x34
MxU32 m_bufferSize; // 0x38
MxU32 m_bufferCurrentSize; // 0x3c
MxU8* m_bufferOffset; // 0x40
MxU8* m_bufferCurrentOffset; // 0x44
MxU32 m_loopCount; // 0x48
MIDIHDR* m_midiHdrP; // 0x4c
MxS32 m_multiplier; // 0x50
DWORD m_midiVolume; // 0x54
// SYNTHETIC: LEGO1 0x100c0610
// MxMusicManager::`scalar deleting destructor'

View File

@@ -118,4 +118,7 @@ protected:
// TEMPLATE: LEGO1 0x100c1240
// List<MxNextActionDataStart *>::~List<MxNextActionDataStart *>
// TEMPLATE: LEGO1 0x100c1bc0
// list<MxDSAction *,allocator<MxDSAction *> >::insert
#endif // MXSTREAMCONTROLLER_H