mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-24 00:31:16 +00:00
Implement/match MxLoopingMIDIPresenter
This commit is contained in:
parent
7db2b2e6b7
commit
9514235526
@ -1,5 +1,53 @@
|
||||
#include "mxloopingmidipresenter.h"
|
||||
|
||||
#include "decomp.h"
|
||||
#include "mxdssound.h"
|
||||
#include "mxmusicmanager.h"
|
||||
#include "mxomni.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(MxLoopingMIDIPresenter, 0x58);
|
||||
|
||||
// OFFSET: LEGO1 0x100b19c0 TEMPLATE
|
||||
// MxLoopingMIDIPresenter::`scalar deleting destructor'
|
||||
|
||||
// OFFSET: LEGO1 0x100c2a80
|
||||
void MxLoopingMIDIPresenter::StreamingTickle()
|
||||
{
|
||||
if (m_action->GetLoopCount()) {
|
||||
MxMIDIPresenter::StreamingTickle();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_chunk) {
|
||||
m_chunk = NextChunk();
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_chunk->GetTime() + m_action->GetDuration() <= m_action->GetElapsedTime()) {
|
||||
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
|
||||
m_currentTickleState = TickleState_Done;
|
||||
}
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c2ae0
|
||||
void MxLoopingMIDIPresenter::DoneTickle()
|
||||
{
|
||||
if (m_action->GetLoopCount())
|
||||
MxMIDIPresenter::DoneTickle();
|
||||
else
|
||||
EndAction();
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c2b00
|
||||
undefined4 MxLoopingMIDIPresenter::PutData()
|
||||
{
|
||||
m_criticalSection.Enter();
|
||||
|
||||
if (m_currentTickleState == TickleState_Streaming && m_chunk && !MusicManager()->GetMIDIInitialized()) {
|
||||
SetVolume(((MxDSSound*) m_action)->GetVolume());
|
||||
MusicManager()->FUN_100c09c0(m_chunk->GetData(), !m_action->GetLoopCount() ? -1 : m_action->GetLoopCount());
|
||||
}
|
||||
|
||||
m_criticalSection.Leave();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -19,6 +19,10 @@ class MxLoopingMIDIPresenter : public MxMIDIPresenter {
|
||||
{
|
||||
return !strcmp(name, MxLoopingMIDIPresenter::ClassName()) || MxMIDIPresenter::IsA(name);
|
||||
}
|
||||
|
||||
virtual void StreamingTickle() override; // vtable+0x20
|
||||
virtual void DoneTickle() override; // vtable+0x2c
|
||||
virtual undefined4 PutData() override; // vtable+0x4c
|
||||
};
|
||||
|
||||
#endif // MXLOOPINGMIDIPRESENTER_H
|
||||
|
||||
@ -37,6 +37,7 @@ class MxMIDIPresenter : public MxMusicPresenter {
|
||||
void Init();
|
||||
void Destroy(MxBool p_fromDestructor);
|
||||
|
||||
protected:
|
||||
MxStreamChunk* m_chunk;
|
||||
};
|
||||
|
||||
|
||||
@ -137,7 +137,7 @@ MxS32 MxMusicManager::CalculateVolume(MxS32 p_volume)
|
||||
}
|
||||
|
||||
// OFFSET: LEGO1 0x100c09c0 STUB
|
||||
undefined4 MxMusicManager::FUN_100c09c0(MxU8* p_data, undefined4)
|
||||
undefined4 MxMusicManager::FUN_100c09c0(MxU8* p_data, MxS32 p_loopCount)
|
||||
{
|
||||
// TODO
|
||||
return 0;
|
||||
|
||||
@ -18,7 +18,7 @@ class MxMusicManager : public MxAudioManager {
|
||||
inline MxBool GetMIDIInitialized() { return m_MIDIInitialized; }
|
||||
|
||||
void DeinitializeMIDI();
|
||||
undefined4 FUN_100c09c0(MxU8* p_data, undefined4);
|
||||
undefined4 FUN_100c09c0(MxU8* p_data, MxS32 p_loopCount);
|
||||
void SetMultiplier(MxS32 p_multiplier);
|
||||
|
||||
private:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user