mirror of
https://github.com/isledecomp/isle.git
synced 2024-11-22 15:48:09 -05:00
Move MxMIDIManager to MxMusicManager (#178)
This commit is contained in:
parent
50b9a6dea5
commit
775ee9f05f
4 changed files with 48 additions and 59 deletions
|
@ -140,8 +140,8 @@ add_library(lego1 SHARED
|
|||
LEGO1/mxmatrix.cpp
|
||||
LEGO1/mxmediamanager.cpp
|
||||
LEGO1/mxmediapresenter.cpp
|
||||
LEGO1/mxmidimanager.cpp
|
||||
LEGO1/mxmidipresenter.cpp
|
||||
LEGO1/mxmusicmanager.cpp
|
||||
LEGO1/mxmusicpresenter.cpp
|
||||
LEGO1/mxnotificationmanager.cpp
|
||||
LEGO1/mxobjectfactory.cpp
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
#ifndef MXMIDIMANAGER_H
|
||||
#define MXMIDIMANAGER_H
|
||||
|
||||
#include "decomp.h"
|
||||
#include "mxaudiomanager.h"
|
||||
|
||||
// VTABLE 0x100dc930
|
||||
// SIZE 0x58
|
||||
class MxMIDIManager : public MxAudioManager
|
||||
{
|
||||
public:
|
||||
MxMIDIManager();
|
||||
virtual ~MxMIDIManager() override;
|
||||
|
||||
virtual void Destroy() override; // vtable+18
|
||||
virtual void SetVolume(MxS32 p_volume) override; // vtable+2c
|
||||
virtual MxResult StartMIDIThread(MxU32 p_frequencyMS, MxU8 p_noRegister); // vtable+30
|
||||
|
||||
private:
|
||||
void LockedReinitialize(MxBool p_skipDestroy);
|
||||
void DeinitializeMIDI();
|
||||
|
||||
MxS32 CalculateVolume(MxS32 p_volume);
|
||||
void SetMIDIVolume();
|
||||
|
||||
HMIDISTRM m_MIDIStreamH; // 0x30
|
||||
MxBool m_MIDIInitialized; // 0x34
|
||||
undefined4 m_unk38; // 0x38
|
||||
undefined4 m_unk3c; // 0x3c
|
||||
undefined4 m_unk40; // 0x40
|
||||
undefined4 m_unk44; // 0x44
|
||||
undefined4 m_unk48; // 0x48
|
||||
MIDIHDR *m_MIDIHdrP; // 0x4c
|
||||
MxS32 m_multiplier; // 0x50
|
||||
DWORD m_MIDIVolume; // 0x54
|
||||
|
||||
protected:
|
||||
void Init();
|
||||
void InitData();
|
||||
};
|
||||
|
||||
#endif // MXMIDIMANAGER_H
|
|
@ -1,23 +1,23 @@
|
|||
#include "mxmidimanager.h"
|
||||
#include "mxmusicmanager.h"
|
||||
#include "mxomni.h"
|
||||
#include <windows.h>
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxMIDIManager, 0x58);
|
||||
DECOMP_SIZE_ASSERT(MxMusicManager, 0x58);
|
||||
|
||||
// OFFSET: LEGO1 0x100c05a0
|
||||
MxMIDIManager::MxMIDIManager()
|
||||
MxMusicManager::MxMusicManager()
|
||||
{
|
||||
Init();
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c0630
|
||||
MxMIDIManager::~MxMIDIManager()
|
||||
MxMusicManager::~MxMusicManager()
|
||||
{
|
||||
LockedReinitialize(TRUE);
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c0b20
|
||||
void MxMIDIManager::DeinitializeMIDI()
|
||||
void MxMusicManager::DeinitializeMIDI()
|
||||
{
|
||||
m_criticalSection.Enter();
|
||||
|
||||
|
@ -36,14 +36,14 @@ void MxMIDIManager::DeinitializeMIDI()
|
|||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c0690
|
||||
void MxMIDIManager::Init()
|
||||
void MxMusicManager::Init()
|
||||
{
|
||||
this->m_multiplier = 100;
|
||||
InitData();
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c06a0
|
||||
void MxMIDIManager::InitData()
|
||||
void MxMusicManager::InitData()
|
||||
{
|
||||
this->m_MIDIStreamH = 0;
|
||||
this->m_MIDIInitialized = FALSE;
|
||||
|
@ -56,7 +56,7 @@ void MxMIDIManager::InitData()
|
|||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c06c0
|
||||
void MxMIDIManager::LockedReinitialize(MxBool p_skipDestroy)
|
||||
void MxMusicManager::LockedReinitialize(MxBool p_skipDestroy)
|
||||
{
|
||||
if (this->m_thread)
|
||||
{
|
||||
|
@ -83,20 +83,20 @@ void MxMIDIManager::LockedReinitialize(MxBool p_skipDestroy)
|
|||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c0930
|
||||
void MxMIDIManager::Destroy()
|
||||
void MxMusicManager::Destroy()
|
||||
{
|
||||
LockedReinitialize(FALSE);
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c09a0
|
||||
MxS32 MxMIDIManager::CalculateVolume(MxS32 p_volume)
|
||||
MxS32 MxMusicManager::CalculateVolume(MxS32 p_volume)
|
||||
{
|
||||
MxS32 result = (p_volume * 0xffff) / 100;
|
||||
return (result << 0x10) | result;
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c07f0
|
||||
void MxMIDIManager::SetMIDIVolume()
|
||||
void MxMusicManager::SetMIDIVolume()
|
||||
{
|
||||
MxS32 result = (this->m_volume * this->m_multiplier) / 0x64;
|
||||
HMIDISTRM streamHandle = this->m_MIDIStreamH;
|
||||
|
@ -109,7 +109,7 @@ void MxMIDIManager::SetMIDIVolume()
|
|||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c0940
|
||||
void MxMIDIManager::SetVolume(MxS32 p_volume)
|
||||
void MxMusicManager::SetVolume(MxS32 p_volume)
|
||||
{
|
||||
MxAudioManager::SetVolume(p_volume);
|
||||
this->m_criticalSection.Enter();
|
||||
|
@ -118,7 +118,7 @@ void MxMIDIManager::SetVolume(MxS32 p_volume)
|
|||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c0840
|
||||
MxResult MxMIDIManager::StartMIDIThread(MxU32 p_frequencyMS, MxBool p_noRegister)
|
||||
MxResult MxMusicManager::StartMIDIThread(MxU32 p_frequencyMS, MxBool p_noRegister)
|
||||
{
|
||||
MxResult status = FAILURE;
|
||||
MxBool locked = FALSE;
|
|
@ -1,11 +1,42 @@
|
|||
#ifndef MXMUSICMANAGER_H
|
||||
#define MXMUSICMANAGER_H
|
||||
|
||||
#include "mxcore.h"
|
||||
#include "decomp.h"
|
||||
#include "mxaudiomanager.h"
|
||||
|
||||
// VTABLE 0x100dc930
|
||||
class MxMusicManager : public MxCore
|
||||
// SIZE 0x58
|
||||
class MxMusicManager : public MxAudioManager
|
||||
{
|
||||
public:
|
||||
MxMusicManager();
|
||||
virtual ~MxMusicManager() override;
|
||||
|
||||
virtual void Destroy() override; // vtable+18
|
||||
virtual void SetVolume(MxS32 p_volume) override; // vtable+2c
|
||||
virtual MxResult StartMIDIThread(MxU32 p_frequencyMS, MxU8 p_noRegister); // vtable+30
|
||||
|
||||
private:
|
||||
void LockedReinitialize(MxBool p_skipDestroy);
|
||||
void DeinitializeMIDI();
|
||||
|
||||
MxS32 CalculateVolume(MxS32 p_volume);
|
||||
void SetMIDIVolume();
|
||||
|
||||
HMIDISTRM m_MIDIStreamH; // 0x30
|
||||
MxBool m_MIDIInitialized; // 0x34
|
||||
undefined4 m_unk38; // 0x38
|
||||
undefined4 m_unk3c; // 0x3c
|
||||
undefined4 m_unk40; // 0x40
|
||||
undefined4 m_unk44; // 0x44
|
||||
undefined4 m_unk48; // 0x48
|
||||
MIDIHDR *m_MIDIHdrP; // 0x4c
|
||||
MxS32 m_multiplier; // 0x50
|
||||
DWORD m_MIDIVolume; // 0x54
|
||||
|
||||
protected:
|
||||
void Init();
|
||||
void InitData();
|
||||
};
|
||||
|
||||
#endif // MXMUSICMANAGER_H
|
||||
#endif // MXMUSICMANAGER_H
|
Loading…
Reference in a new issue