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/JASDSPChannel.cpp | |
| parent | ce41820bf0eaf00d5bc094793dc08598df6f38ae (diff) | |
JAudio2 debug (#3006)
Diffstat (limited to 'src/JSystem/JAudio2/JASDSPChannel.cpp')
| -rw-r--r-- | src/JSystem/JAudio2/JASDSPChannel.cpp | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/src/JSystem/JAudio2/JASDSPChannel.cpp b/src/JSystem/JAudio2/JASDSPChannel.cpp index b1e4dc1296..268c80a779 100644 --- a/src/JSystem/JAudio2/JASDSPChannel.cpp +++ b/src/JSystem/JAudio2/JASDSPChannel.cpp @@ -43,6 +43,7 @@ void JASDSPChannel::drop() { void JASDSPChannel::initAll() { sDspChannels = new (JASDram, 0x20) JASDSPChannel[0x40]; + JUT_ASSERT(102, sDspChannels); for (int i = 0; i < 0x40; i++) { sDspChannels[i].mChannel = JASDsp::getDSPHandle(i); } @@ -87,7 +88,7 @@ JASDSPChannel* JASDSPChannel::getLowestChannel(int i_priority) { JASDSPChannel* channel = &sDspChannels[i]; s16 priority = channel->mPriority; if (priority < 0) { - return channel; + return &sDspChannels[i]; } if (priority <= i_priority && priority <= best_priority) { if (priority != best_priority || channel->field_0xc > best_unknown) { @@ -127,7 +128,8 @@ JASDSPChannel* JASDSPChannel::getLowestActiveChannel() { } void JASDSPChannel::updateProc() { - int ret; + int ret = 0; + bool flush; if (mChannel->isFinish()) { mFlags &= ~2; if (mStatus == STATUS_ACTIVE) { @@ -173,7 +175,7 @@ void JASDSPChannel::updateProc() { mChannel->flush(); } } else if (mStatus != STATUS_INACTIVE) { - bool flush = false; + flush = false; if (mCallback != NULL) { ret = mCallback(CB_PLAY, mChannel, mCallbackData); flush = true; @@ -225,3 +227,33 @@ int JASDSPChannel::killActiveChannel() { JASDSPChannel* JASDSPChannel::getHandle(u32 i_index) { return &sDspChannels[i_index]; } + +u32 JASDSPChannel::getNumUse() { + u32 count = 0; + for (int i = 0; i < 0x40; i++) { + if (sDspChannels[i].mStatus == 0) { + count++; + } + } + return count; +} + +u32 JASDSPChannel::getNumFree() { + u32 count = 0; + for (int i = 0; i < 0x40; i++) { + if (sDspChannels[i].mStatus == 1) { + count++; + } + } + return count; +} + +u32 JASDSPChannel::getNumBreak() { + u32 count = 0; + for (int i = 0; i < 0x40; i++) { + if (sDspChannels[i].mStatus == 2) { + count++; + } + } + return count; +} |
