mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-06-20 14:44:24 -04:00
Reorganize library code into libs/ (#3119)
* Reorganize files into libs/{dolphin,JSystem,PowerPC_EABI_Support,revolution,TRK_MINNOW_DOLPHIN}
* Update configure.py and project.py for new libs structure
* Refactor `#include <dolphin/x.h>` -> `<x.h>`
* Remove `__REVOLUTION_SDK__` forwards from dolphin
* Fix dolphin/ references in revolution
* Wrap `#include <dolphin.h>` in `!__REVOLUTION_SDK__`
* Always build TRK against dolphin headers
* Resolve revolution SDK header resolution issues
This commit is contained in:
@@ -0,0 +1,125 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/JAudio2/JAIStreamMgr.h"
|
||||
#include "JSystem/JAudio2/JAISoundHandles.h"
|
||||
#include "JSystem/JAudio2/JAIStreamDataMgr.h"
|
||||
#include "JSystem/JAudio2/JAISoundInfo.h"
|
||||
|
||||
JAIStreamMgr::JAIStreamMgr(bool setInstance) : JASGlobalInstance<JAIStreamMgr>(setInstance) {
|
||||
streamDataMgr_ = NULL;
|
||||
mStreamAramMgr = NULL;
|
||||
field_0x6c = NULL;
|
||||
mAudience = NULL;
|
||||
mParams.init();
|
||||
mActivity.init();
|
||||
}
|
||||
|
||||
bool JAIStreamMgr::startSound(JAISoundID id, JAISoundHandle* handle, const JGeometry::TVec3<f32>* posPtr) {
|
||||
JUT_ASSERT(37, streamDataMgr_);
|
||||
if (handle != NULL && *handle) {
|
||||
(*handle)->stop();
|
||||
}
|
||||
|
||||
s32 streamFileEntry = streamDataMgr_->getStreamFileEntry(id);
|
||||
if (streamFileEntry < 0) {
|
||||
JUT_WARN(46, "Cannot find the stream file entry for ID:%08x\n", id.id_.composite_)
|
||||
return false;
|
||||
}
|
||||
|
||||
JAIStream* stream = newStream_();
|
||||
JAISoundInfo* soundInfo = JASGlobalInstance<JAISoundInfo>::getInstance();
|
||||
|
||||
int category = -1;
|
||||
if (soundInfo != NULL) {
|
||||
category = soundInfo->getCategory(id);
|
||||
}
|
||||
|
||||
if (stream == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
stream->JAIStreamMgr_startID_(id, streamFileEntry, posPtr, mAudience, category);
|
||||
if (soundInfo != NULL) {
|
||||
soundInfo->getStreamInfo(id, stream);
|
||||
}
|
||||
|
||||
if (handle != NULL) {
|
||||
stream->attachHandle(handle);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void JAIStreamMgr::freeDeadStream_() {
|
||||
JSULink<JAIStream>* i = mStreamList.getFirst();
|
||||
while (i != NULL) {
|
||||
JAIStream* stream = i->getObject();
|
||||
JSULink<JAIStream>* next = i->getNext();
|
||||
if (stream->status_.isDead()) {
|
||||
mStreamList.remove(i);
|
||||
void* aramAddr = stream->JAIStreamMgr_getAramAddr_();
|
||||
if (aramAddr != NULL) {
|
||||
bool result = mStreamAramMgr->deleteStreamAram((u32)aramAddr);
|
||||
JUT_ASSERT(105, result);
|
||||
}
|
||||
|
||||
delete stream;
|
||||
}
|
||||
i = next;
|
||||
}
|
||||
}
|
||||
|
||||
void JAIStreamMgr::calc() {
|
||||
JSULink<JAIStream>* i;
|
||||
mParams.calc();
|
||||
for (i = mStreamList.getFirst(); i != NULL; i = i->getNext()) {
|
||||
i->getObject()->JAIStreamMgr_calc_();
|
||||
}
|
||||
freeDeadStream_();
|
||||
}
|
||||
|
||||
void JAIStreamMgr::stop() {
|
||||
JSULink<JAIStream>* i;
|
||||
for (i = mStreamList.getFirst(); i != NULL; i = i->getNext()) {
|
||||
i->getObject()->stop();
|
||||
}
|
||||
}
|
||||
|
||||
void JAIStreamMgr::stop(u32 fadeTime) {
|
||||
JSULink<JAIStream>* i;
|
||||
for (i = mStreamList.getFirst(); i != NULL; i = i->getNext()) {
|
||||
i->getObject()->stop(fadeTime);
|
||||
}
|
||||
}
|
||||
|
||||
void JAIStreamMgr::stopSoundID(JAISoundID id) {
|
||||
JSULink<JAIStream>* i;
|
||||
for (i = mStreamList.getFirst(); i != NULL; i = i->getNext()) {
|
||||
if ((u32)i->getObject()->getID() == (u32)id) {
|
||||
i->getObject()->stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void JAIStreamMgr::mixOut() {
|
||||
JSULink<JAIStream>* i;
|
||||
for (i = mStreamList.getFirst(); i != NULL; i = i->getNext()) {
|
||||
i->getObject()->JAIStreamMgr_mixOut_(mParams.params_, mActivity);
|
||||
}
|
||||
}
|
||||
|
||||
JAIStream* JAIStreamMgr::newStream_() {
|
||||
if (mStreamAramMgr == NULL) {
|
||||
JUT_WARN(229, "%s", "JAIStreamAramMgr must be set.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
JAIStream* stream = new JAIStream(this, field_0x6c);
|
||||
if (stream == NULL) {
|
||||
JUT_WARN(235, "%s", "JASPoolAllocObject::<JAIStream>::operator new failed .\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mStreamList.append(stream);
|
||||
return stream;
|
||||
}
|
||||
Reference in New Issue
Block a user