2023-07-02 03:00:28 -04:00
|
|
|
#include "mxloopingmidipresenter.h"
|
|
|
|
|
|
|
|
#include "decomp.h"
|
2023-11-25 13:26:44 -05:00
|
|
|
#include "mxdssound.h"
|
|
|
|
#include "mxmusicmanager.h"
|
|
|
|
#include "mxomni.h"
|
2023-07-02 03:00:28 -04:00
|
|
|
|
|
|
|
DECOMP_SIZE_ASSERT(MxLoopingMIDIPresenter, 0x58);
|
2023-11-25 13:26:44 -05:00
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100c2a80
|
2023-11-25 13:26:44 -05:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100c2ae0
|
2023-11-25 13:26:44 -05:00
|
|
|
void MxLoopingMIDIPresenter::DoneTickle()
|
|
|
|
{
|
|
|
|
if (m_action->GetLoopCount())
|
|
|
|
MxMIDIPresenter::DoneTickle();
|
|
|
|
else
|
|
|
|
EndAction();
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100c2b00
|
2023-11-26 09:03:40 -05:00
|
|
|
MxResult MxLoopingMIDIPresenter::PutData()
|
2023-11-25 13:26:44 -05:00
|
|
|
{
|
|
|
|
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();
|
2023-11-26 09:03:40 -05:00
|
|
|
return SUCCESS;
|
2023-11-25 13:26:44 -05:00
|
|
|
}
|