diff options
| author | Jcw87 <Jcw87@users.noreply.github.com> | 2025-12-27 14:23:15 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-27 15:23:15 -0700 |
| commit | 038b8fd62fde1f214cca7d129293cdd8afa1007a (patch) | |
| tree | 955b511b5676bf746a0ee930172028bd9fbe1c9f /src/JSystem/JAudio2/JASAudioReseter.cpp | |
| parent | ce41820bf0eaf00d5bc094793dc08598df6f38ae (diff) | |
JAudio2 debug (#3006)
Diffstat (limited to 'src/JSystem/JAudio2/JASAudioReseter.cpp')
| -rw-r--r-- | src/JSystem/JAudio2/JASAudioReseter.cpp | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/src/JSystem/JAudio2/JASAudioReseter.cpp b/src/JSystem/JAudio2/JASAudioReseter.cpp index 834320869a..14599d032b 100644 --- a/src/JSystem/JAudio2/JASAudioReseter.cpp +++ b/src/JSystem/JAudio2/JASAudioReseter.cpp @@ -10,41 +10,46 @@ struct JASDSPChannel { void drop(); static JASDSPChannel* getHandle(u32); - inline u32 getStatus() {return mStatus;} + inline u8 getStatus() const { return mStatus; } u32 mStatus; }; JASAudioReseter::JASAudioReseter() { field_0x0 = 0; - mIsDone = true; - field_0xc = false; + mDoneFlag = true; + mThreadStopFlag = false; mDSPLevel = JASDriver::getDSPLevel(); } -JASAudioReseter::~JASAudioReseter() {} +JASAudioReseter::~JASAudioReseter() { + JUT_ASSERT(28, mDoneFlag); +} bool JASAudioReseter::start(u32 param_0, bool param_1) { - if (mIsDone == false) { + if (mDoneFlag == false) { return false; } - field_0xc = param_1; + mThreadStopFlag = param_1; JASCriticalSection critical; if (!JASDriver::registerDspSyncCallback(callback, this)) { + JUT_WARN(40, "%s", "Failed JASAudioReseter start\n"); return false; } else { mDSPLevel = JASDriver::getDSPLevel(); field_0x0 = param_0; - mIsDone = false; + mDoneFlag = false; return true; } } void JASAudioReseter::resume() { + JUT_ASSERT(55, mDoneFlag); + JUT_ASSERT(56, ! mThreadStopFlag); JASDriver::setDSPLevel(mDSPLevel); } s32 JASAudioReseter::checkDone() const { - return mIsDone; + return mDoneFlag; } @@ -52,23 +57,24 @@ 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) { + if ((handle->getStatus())==0) { handle->drop(); } } - if(field_0xc!=false) { - JASGlobalInstance<JASAudioThread>::getInstance()->stop();//JASGlobalInstance<JASAudioThread>::sInstance->stop(); + if(mThreadStopFlag!=false) { + JASAudioThread* pAudioThread = JASGlobalInstance<JASAudioThread>::getInstance(); + JUT_ASSERT(78, pAudioThread); + pAudioThread->stop(); } - mIsDone = 1; + mDoneFlag = 1; return -1; } field_0x0--; - u32 unk = field_0x0; - float dspLevel = JASDriver::getDSPLevel(); - JASDriver::setDSPLevel(((float)unk*dspLevel)/(float)(unk+1)); + JASDriver::setDSPLevel(field_0x0 * JASDriver::getDSPLevel() / (field_0x0 + 1)); return 0; } s32 JASAudioReseter::callback(void* param_0) { - return ((JASAudioReseter*)param_0)->calc(); + JASAudioReseter* i_this = (JASAudioReseter*) param_0; + return i_this->calc(); } |
