tp/libs/JSystem/JAudio2/JASAudioReseter.cpp

120 lines
3.4 KiB
C++

//
// Generated By: dol2asm
// Translation Unit: JASAudioReseter
//
#include "JSystem/JAudio2/JASAudioReseter.h"
#include "dol2asm.h"
#include "dolphin/os/OS.h"
#include "dolphin/types.h"
#include "JSystem/JAudio2/JAISoundHandles.h"
#include "JSystem/JAudio2/JASGadget.h"
#include "JSystem/JAudio2/JASAudioThread.h"
//
// Types:
//
struct JASDSPChannel {
/* 8029D340 */ void drop();
/* 8029D948 */ static JASDSPChannel* getHandle(u32);
inline u32 getStatus() {return mStatus;}
u32 mStatus;
};
//
// Forward References:
//
extern "C" void __ct__15JASAudioReseterFv();
extern "C" void __dt__15JASAudioReseterFv();
extern "C" void start__15JASAudioReseterFUlb();
extern "C" void resume__15JASAudioReseterFv();
extern "C" void checkDone__15JASAudioReseterCFv();
extern "C" void calc__15JASAudioReseterFv();
extern "C" void callback__15JASAudioReseterFPv();
//
// External References:
//
extern "C" void stop__14JASAudioThreadFv();
extern "C" void drop__13JASDSPChannelFv();
extern "C" void getHandle__13JASDSPChannelFUl();
extern "C" void setDSPLevel__9JASDriverFf();
extern "C" void getDSPLevel__9JASDriverFv();
extern "C" void registerDspSyncCallback__9JASDriverFPFPv_lPv();
extern "C" void __dl__FPv();
extern "C" extern JASAudioThread* data_80450B8C;
//
// Declarations:
//
/* 8029D0B4-8029D0FC 2979F4 0048+00 0/0 1/1 0/0 .text __ct__15JASAudioReseterFv */
JASAudioReseter::JASAudioReseter() {
field_0x0 = 0;
mIsDone = true;
field_0xc = false;
mDSPLevel = JASDriver::getDSPLevel();
}
/* 8029D0FC-8029D138 297A3C 003C+00 0/0 1/1 0/0 .text __dt__15JASAudioReseterFv */
JASAudioReseter::~JASAudioReseter() {}
/* 8029D138-8029D1D4 297A78 009C+00 0/0 1/1 0/0 .text start__15JASAudioReseterFUlb */
bool JASAudioReseter::start(u32 param_0, bool param_1) {
if (mIsDone == false) {
return false;
}
field_0xc = param_1;
JASCriticalSection critical;
if (!JASDriver::registerDspSyncCallback(callback, this)) {
return false;
} else {
mDSPLevel = JASDriver::getDSPLevel();
field_0x0 = param_0;
mIsDone = false;
return true;
}
}
/* 8029D1D4-8029D1F8 297B14 0024+00 0/0 1/1 0/0 .text resume__15JASAudioReseterFv */
void JASAudioReseter::resume() {
JASDriver::setDSPLevel(mDSPLevel);
}
/* 8029D1F8-8029D200 297B38 0008+00 0/0 2/2 0/0 .text checkDone__15JASAudioReseterCFv */
s32 JASAudioReseter::checkDone() const {
return mIsDone;
}
/* 8029D200-8029D2D4 297B40 00D4+00 1/1 0/0 0/0 .text calc__15JASAudioReseterFv */
s32 JASAudioReseter::calc() {
if(field_0x0==0) {
for(size_t i = 0; i<64; i++) {
JASDSPChannel* handle = JASDSPChannel::getHandle(i);
if ((handle->getStatus()&0xFF)==0) {
handle->drop();
}
}
if(field_0xc!=false) {
JASGlobalInstance<JASAudioThread>::getInstance()->stop();//JASGlobalInstance<JASAudioThread>::sInstance->stop();
}
mIsDone = 1;
return -1;
}
field_0x0--;
u32 unk = field_0x0;
float dspLevel = JASDriver::getDSPLevel();
JASDriver::setDSPLevel(((float)unk*dspLevel)/(float)(unk+1));
return 0;
}
/* 8029D2D4-8029D2F4 297C14 0020+00 1/1 0/0 0/0 .text callback__15JASAudioReseterFPv */
s32 JASAudioReseter::callback(void* param_0) {
return ((JASAudioReseter*)param_0)->calc();
}