mirror of
https://github.com/encounter/tp.git
synced 2026-07-11 06:18:46 -07:00
JAudio2 debug (#2990)
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
|
||||
struct JKRHeap;
|
||||
|
||||
const int OSC_MAX = 2;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
@@ -46,6 +48,7 @@ struct JASBasicInst : public JASInst {
|
||||
struct TKeymap {
|
||||
~TKeymap();
|
||||
TKeymap() { mHighKey = -1; }
|
||||
s32 getHighKey() const { return mHighKey; }
|
||||
void setHighKey(int key) { mHighKey = key; }
|
||||
|
||||
/* 0x0 */ s32 mHighKey;
|
||||
@@ -59,6 +62,7 @@ struct JASBasicInst : public JASInst {
|
||||
void setKeyRegionCount(u32, JKRHeap*);
|
||||
void setOsc(int, JASOscillator::Data const*);
|
||||
TKeymap* getKeyRegion(int);
|
||||
TKeymap* getKeyRegion(int) const;
|
||||
|
||||
virtual ~JASBasicInst();
|
||||
virtual bool getParam(int, int, JASInstParam*) const;
|
||||
@@ -66,10 +70,11 @@ struct JASBasicInst : public JASInst {
|
||||
|
||||
void setVolume(f32 volume) { mVolume = volume; }
|
||||
void setPitch(f32 pitch) { mPitch = pitch; }
|
||||
u32 getKeyRegionCount() const { return mKeymapCount; }
|
||||
|
||||
/* 0x04 */ f32 mVolume;
|
||||
/* 0x08 */ f32 mPitch;
|
||||
/* 0x0C */ JASOscillator::Data const* field_0xc[2];
|
||||
/* 0x0C */ JASOscillator::Data const* field_0xc[OSC_MAX];
|
||||
/* 0x10 */ u32 mKeymapCount;
|
||||
/* 0x14 */ TKeymap* mKeymap;
|
||||
};
|
||||
|
||||
@@ -52,6 +52,7 @@ public:
|
||||
class JASChannel : public JASPoolAllocObject_MultiThreaded<JASChannel> {
|
||||
public:
|
||||
typedef void (*Callback)(u32, JASChannel*, JASDsp::TChannel*, void*);
|
||||
static const int BUSOUT_CPUCH = 6;
|
||||
|
||||
enum CallbackType {
|
||||
/* 0 */ CB_PLAY,
|
||||
@@ -140,7 +141,7 @@ public:
|
||||
/* 0x1C */ JASOscillator mOscillators[2];
|
||||
/* 0x5C */ JASLfo mVibrate;
|
||||
/* 0x74 */ JASLfo mTremolo;
|
||||
/* 0x8C */ MixConfig mMixConfig[6];
|
||||
/* 0x8C */ MixConfig mMixConfig[BUSOUT_CPUCH];
|
||||
/* 0x98 */ u16 mPriority;
|
||||
/* 0x9C */ JASChannelParams mParams;
|
||||
/* 0xB4 */ JASSoundParams mSoundParams;
|
||||
|
||||
@@ -42,10 +42,15 @@ struct JASPortCmd : JSULink<JASPortCmd> {
|
||||
void execCommandStay();
|
||||
};
|
||||
|
||||
bool addPortCmdOnce();
|
||||
bool setPortCmd(Command func, JASPortArgs*);
|
||||
static void execAllCommand();
|
||||
|
||||
Command _10;
|
||||
JASPortArgs* _14;
|
||||
Command getFunc() { return mFunc; }
|
||||
JASPortArgs* getArgs() { return mArgs; }
|
||||
|
||||
Command mFunc;
|
||||
JASPortArgs* mArgs;
|
||||
|
||||
static TPortHead sCommandListOnce;
|
||||
static TPortHead sCommandListStay;
|
||||
|
||||
@@ -32,10 +32,12 @@ struct JASDrumSet : public JASInst {
|
||||
void newPercArray(u8, JKRHeap*);
|
||||
virtual bool getParam(int, int, JASInstParam*) const;
|
||||
void setPerc(int, JASDrumSet::TPerc*);
|
||||
JASDrumSet::TPerc* getPerc(int);
|
||||
JASDrumSet::TPerc* getPerc(int) const;
|
||||
virtual u32 getType() const;
|
||||
|
||||
/* 0x4 */ TPerc** field_0x4;
|
||||
/* 0x8 */ u8 field_0x8;
|
||||
/* 0x4 */ TPerc** mPercArray;
|
||||
/* 0x8 */ u8 mPercNumMax;
|
||||
};
|
||||
|
||||
#endif /* JASDRUMSET_H */
|
||||
|
||||
@@ -22,13 +22,15 @@ public:
|
||||
bool alloc(JASHeap*, u32);
|
||||
bool allocTail(JASHeap*, u32);
|
||||
bool free();
|
||||
u32 getTotalFreeSize();
|
||||
u32 getFreeSize();
|
||||
void insertChild(JASHeap*, JASHeap*, void*, u32, bool);
|
||||
JASHeap* getTailHeap();
|
||||
u32 getTailOffset();
|
||||
u32 getCurOffset();
|
||||
|
||||
void* getBase() { return mBase; }
|
||||
bool isAllocated() { return mBase; }
|
||||
bool isAllocated() const { return mBase; }
|
||||
u32 getSize() const { return mSize; }
|
||||
|
||||
/* 0x00 */ JSUTree<JASHeap> mTree;
|
||||
@@ -180,7 +182,7 @@ class JASMemChunkPool : public T<JASMemChunkPool<ChunkSize, T> >::ObjectLevelLoc
|
||||
mNextChunk = chunk;
|
||||
}
|
||||
|
||||
u32 getFreeSize() {
|
||||
u32 getFreeSize() const {
|
||||
return ChunkSize - mUsedSize;
|
||||
}
|
||||
|
||||
@@ -201,27 +203,22 @@ public:
|
||||
}
|
||||
|
||||
bool createNewChunk() {
|
||||
bool uVar2;
|
||||
if (field_0x18 != NULL && field_0x18->isEmpty()) {
|
||||
field_0x18->revive();
|
||||
uVar2 = 1;
|
||||
} else {
|
||||
MemoryChunk* pMVar4 = field_0x18;
|
||||
field_0x18 = new (JASKernel::getSystemHeap(), 0) MemoryChunk(pMVar4);
|
||||
if (field_0x18 != NULL) {
|
||||
uVar2 = 1;
|
||||
} else {
|
||||
JUT_WARN(428, "%s", "Not enough JASSystemHeap");
|
||||
field_0x18 = new (JKRHeap::getSystemHeap(), 0) MemoryChunk(pMVar4);
|
||||
if (field_0x18 != NULL) {
|
||||
uVar2 = 1;
|
||||
} else {
|
||||
field_0x18 = pMVar4;
|
||||
uVar2 = 0;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return uVar2;
|
||||
MemoryChunk* pMVar4 = field_0x18;
|
||||
field_0x18 = new (JASKernel::getSystemHeap(), 0) MemoryChunk(pMVar4);
|
||||
if (field_0x18 != NULL) {
|
||||
return true;
|
||||
}
|
||||
JUT_WARN(428, "%s", "Not enough JASSystemHeap");
|
||||
field_0x18 = new (JKRHeap::getSystemHeap(), 0) MemoryChunk(pMVar4);
|
||||
if (field_0x18 != NULL) {
|
||||
return true;
|
||||
}
|
||||
field_0x18 = pMVar4;
|
||||
return false;
|
||||
}
|
||||
|
||||
void* alloc(u32 size) {
|
||||
@@ -269,6 +266,8 @@ namespace JASKernel {
|
||||
JASMemChunkPool<1024, JASThreadingModel::ObjectLevelLockable>* getCommandHeap();
|
||||
void setupAramHeap(u32, u32);
|
||||
JASHeap* getAramHeap();
|
||||
u32 getAramFreeSize();
|
||||
u32 getAramSize();
|
||||
|
||||
extern JASHeap audioAramHeap;
|
||||
extern u32 sAramBase;
|
||||
@@ -348,14 +347,14 @@ class JASPoolAllocObject_MultiThreaded {
|
||||
public:
|
||||
static void* operator new(size_t n) {
|
||||
JASMemPool_MultiThreaded<T>& memPool_ = getMemPool();
|
||||
return memPool_.alloc(sizeof(T));
|
||||
return memPool_.alloc(n);
|
||||
}
|
||||
static void* operator new(size_t n, void* ptr) {
|
||||
return ptr;
|
||||
}
|
||||
static void operator delete(void* ptr, size_t n) {
|
||||
JASMemPool_MultiThreaded<T>& memPool_ = getMemPool();
|
||||
memPool_.free(ptr, sizeof(T));
|
||||
memPool_.free(ptr, n);
|
||||
}
|
||||
|
||||
static void newMemPool(int n) {
|
||||
|
||||
@@ -38,7 +38,7 @@ struct JASOscillator {
|
||||
/* 0x00 */ u32 mTarget;
|
||||
/* 0x04 */ f32 _04;
|
||||
/* 0x08 */ const Point* mTable;
|
||||
/* 0x0C */ const Point* _0C;
|
||||
/* 0x0C */ const Point* rel_table;
|
||||
/* 0x10 */ f32 mScale;
|
||||
/* 0x14 */ f32 _14;
|
||||
};
|
||||
|
||||
@@ -9,37 +9,39 @@ namespace JASResArcLoader {
|
||||
size_t getResMaxSize(JKRArchive const*);
|
||||
static void loadResourceCallback(void*);
|
||||
int loadResourceAsync(JKRArchive*, u16, u8*, u32, void (*)(u32, u32), u32);
|
||||
|
||||
// from pikmin2
|
||||
typedef void (*LoadCallback)(u32, u32);
|
||||
|
||||
struct TLoadResInfo {
|
||||
inline TLoadResInfo(JKRArchive* archive, u16 id, void* buf, u32 size)
|
||||
: mArchive(archive)
|
||||
, mID(id)
|
||||
, mBuffer(buf)
|
||||
, mBufferSize(size)
|
||||
, mCallback(0)
|
||||
, mCallbackArg(0)
|
||||
, mQueue(0)
|
||||
{
|
||||
}
|
||||
|
||||
JKRArchive* mArchive; // _00
|
||||
u16 mID; // _04
|
||||
void* mBuffer; // _08
|
||||
u32 mBufferSize; // _0C
|
||||
LoadCallback mCallback; // _10
|
||||
u32 mCallbackArg; // _14, arg to pass to mCallback along with readResource result
|
||||
OSMessageQueue* mQueue; // _18
|
||||
};
|
||||
};
|
||||
|
||||
class JKRArchive;
|
||||
|
||||
// from pikmin2
|
||||
typedef void (*LoadCallback)(u32, u32);
|
||||
|
||||
enum ResArcMessage {
|
||||
RESARCMSG_Error = -1,
|
||||
RESARCMSG_Success = 0,
|
||||
};
|
||||
|
||||
struct CallbackArgs {
|
||||
inline CallbackArgs(u16 id, u8* buf, u32 size, JKRArchive* archive)
|
||||
: mArchive(archive)
|
||||
, mID(id)
|
||||
, mBuffer(buf)
|
||||
, mBufferSize(size)
|
||||
, mCallback(0)
|
||||
, mCallbackArg(0)
|
||||
, mQueue(0)
|
||||
{
|
||||
}
|
||||
|
||||
JKRArchive* mArchive; // _00
|
||||
u16 mID; // _04
|
||||
u8* mBuffer; // _08
|
||||
u32 mBufferSize; // _0C
|
||||
LoadCallback mCallback; // _10
|
||||
u32 mCallbackArg; // _14, arg to pass to mCallback along with readResource result
|
||||
OSMessageQueue* mQueue; // _18
|
||||
};
|
||||
|
||||
#endif /* JASRESARCLOADER_H */
|
||||
|
||||
@@ -22,10 +22,14 @@ namespace JASDsp {
|
||||
*
|
||||
*/
|
||||
struct JASTrack : public JASPoolAllocObject_MultiThreaded<JASTrack> {
|
||||
static const int CHANNEL_MGR_MAX = 4;
|
||||
static const int TIMED_PARAMS = 6;
|
||||
static const int OSC_NUM = 2;
|
||||
|
||||
enum Status {
|
||||
STATUS_FREE,
|
||||
STATUS_RUN,
|
||||
STATUS_STOP,
|
||||
STATUS_STOPPED,
|
||||
};
|
||||
|
||||
struct TChannelMgr : public JASPoolAllocObject_MultiThreaded<TChannelMgr> {
|
||||
@@ -82,6 +86,11 @@ struct JASTrack : public JASPoolAllocObject_MultiThreaded<JASTrack> {
|
||||
void closeChild(u32);
|
||||
JASTrack* openChild(u32);
|
||||
void connectBus(int, int);
|
||||
f32 getVolume() const;
|
||||
f32 getPitch() const;
|
||||
f32 getPan() const;
|
||||
f32 getFxmix() const;
|
||||
f32 getDolby() const;
|
||||
void setLatestKey(u8);
|
||||
JASChannel* channelStart(JASTrack::TChannelMgr*, u32, u32, u32);
|
||||
int noteOn(u32, u32, u32);
|
||||
@@ -115,6 +124,7 @@ struct JASTrack : public JASPoolAllocObject_MultiThreaded<JASTrack> {
|
||||
void setTimebase(u16);
|
||||
void updateChannel(JASChannel*, JASDsp::TChannel*);
|
||||
JASTrack* getRootTrack();
|
||||
int getChannelCount() const;
|
||||
int tickProc();
|
||||
int seqMain();
|
||||
|
||||
@@ -191,7 +201,7 @@ struct JASTrack : public JASPoolAllocObject_MultiThreaded<JASTrack> {
|
||||
MoveParam_ dolby;
|
||||
MoveParam_ distFilter;
|
||||
} params;
|
||||
MoveParam_ array[6];
|
||||
MoveParam_ array[TIMED_PARAMS];
|
||||
} mMoveParam;
|
||||
#else
|
||||
/* 0x09C */ union MoveParam_u {
|
||||
@@ -203,17 +213,17 @@ struct JASTrack : public JASPoolAllocObject_MultiThreaded<JASTrack> {
|
||||
MoveParam_ dolby;
|
||||
MoveParam_ distFilter;
|
||||
} params;
|
||||
MoveParam_ array[6];
|
||||
MoveParam_ array[TIMED_PARAMS];
|
||||
MoveParam_u() {}
|
||||
} mMoveParam;
|
||||
#endif
|
||||
/* 0x0e4 */ JASOscillator::Data mOscParam[2];
|
||||
/* 0x0e4 */ JASOscillator::Data mOscParam[OSC_NUM];
|
||||
/* 0x114 */ JASOscillator::Point mOscPoint[4];
|
||||
/* 0x12C */ JASTrack* mParent;
|
||||
/* 0x130 */ JASTrack* mChildren[MAX_CHILDREN];
|
||||
/* 0x170 */ TChannelMgr* mChannelMgrs[4];
|
||||
/* 0x170 */ TChannelMgr* mChannelMgrs[CHANNEL_MGR_MAX];
|
||||
/* 0x180 */ TChannelMgr mDefaultChannelMgr;
|
||||
/* 0x1D0 */ int mChannelMgrCount;
|
||||
/* 0x1D0 */ u32 mChannelMgrCount;
|
||||
/* 0x1D4 */ const JASDefaultBankTable* mBankTable;
|
||||
/* 0x1D8 */ f32 field_0x1d8;
|
||||
/* 0x1DC */ f32 field_0x1dc;
|
||||
|
||||
@@ -230,7 +230,7 @@ public:
|
||||
|
||||
T* getObject() const { return this->mTree->getObject(); }
|
||||
|
||||
bool operator==(JSUTree<T>* other) { return this->mTree == other; }
|
||||
bool operator==(const JSUTree<T>* other) const { return this->mTree == other; }
|
||||
|
||||
bool operator!=(const JSUTree<T>* other) const { return this->mTree != other; }
|
||||
|
||||
@@ -245,7 +245,7 @@ public:
|
||||
return *this;
|
||||
}
|
||||
|
||||
T* operator*() { return this->getObject(); }
|
||||
T* operator*() const { return this->getObject(); }
|
||||
|
||||
T* operator->() const { return this->getObject(); }
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ void JAISe::stopTrack_() {
|
||||
case JASTrack::STATUS_RUN:
|
||||
inner_.track.stopSeq();
|
||||
break;
|
||||
case JASTrack::STATUS_STOP:
|
||||
case JASTrack::STATUS_STOPPED:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,7 @@ void JAISe::stopTrack_() {
|
||||
void JAISe::startTrack_(const JASSoundParams& params) {
|
||||
JUT_ASSERT(72, inner_.track.getStatus() != JASTrack::STATUS_RUN);
|
||||
|
||||
if (inner_.track.getStatus() == JASTrack::STATUS_STOP) {
|
||||
if (inner_.track.getStatus() == JASTrack::STATUS_STOPPED) {
|
||||
inner_.track.init();
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ void JAISe::JAISeCategoryMgr_mixOut_(bool param_0, const JASSoundParams& params,
|
||||
if (status_.isPlaying()) {
|
||||
if (inner_.field_0x26c) {
|
||||
switch (inner_.track.getStatus()) {
|
||||
case JASTrack::STATUS_STOP:
|
||||
case JASTrack::STATUS_STOPPED:
|
||||
if (status_.field_0x1.flags.flag1) {
|
||||
startTrack_(params);
|
||||
} else {
|
||||
@@ -116,7 +116,7 @@ void JAISe::JAISeCategoryMgr_calc_() {
|
||||
bool JAISe::JAISound_tryDie_() {
|
||||
switch (inner_.track.getStatus()) {
|
||||
case JASTrack::STATUS_FREE:
|
||||
case JASTrack::STATUS_STOP:
|
||||
case JASTrack::STATUS_STOPPED:
|
||||
if (inner_.field_0x278) {
|
||||
inner_.mSoundStrategyMgr->virtual4(inner_.field_0x278);
|
||||
inner_.field_0x278 = NULL;
|
||||
|
||||
@@ -10,7 +10,7 @@ namespace {
|
||||
|
||||
static bool JASTrack_isFreeOrStopped(JASTrack* track) {
|
||||
u32 status = track->getStatus();
|
||||
return status == JASTrack::STATUS_FREE || status == JASTrack::STATUS_STOP;
|
||||
return status == JASTrack::STATUS_FREE || status == JASTrack::STATUS_STOPPED;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
@@ -151,7 +151,7 @@ bool JAISeq::prepare_(const JASSoundParams& params, JAISoundActivity activity) {
|
||||
}
|
||||
|
||||
void JAISeq::JAISeqMgr_calc_() {
|
||||
if (inner_.outputTrack.getStatus() == JASTrack::STATUS_STOP || (inner_.outputTrack.getStatus() == JASTrack::STATUS_FREE && status_.state.unk == 2)) {
|
||||
if (inner_.outputTrack.getStatus() == JASTrack::STATUS_STOPPED || (inner_.outputTrack.getStatus() == JASTrack::STATUS_FREE && status_.state.unk == 2)) {
|
||||
die_();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -25,14 +25,21 @@ u32 JASAramStream::sChannelMax;
|
||||
bool struct_80451260;
|
||||
bool struct_80451261;
|
||||
|
||||
void JASAramStream::initSystem(u32 i_blockSize, u32 i_channelMax) {
|
||||
if (JASDriver::registerSubFrameCallback(dvdErrorCheck, NULL)) {
|
||||
void JASAramStream::initSystem(u32 block_size, u32 channel_max) {
|
||||
JUT_ASSERT(66, block_size % 32 == 0);
|
||||
JUT_ASSERT(67, block_size % 9 == 0);
|
||||
JUT_ASSERT(68, channel_max > 0 && channel_max <= CHANNEL_MAX);
|
||||
JUT_ASSERT(69, sReadBuffer == 0);
|
||||
if (!JASDriver::registerSubFrameCallback(dvdErrorCheck, NULL)) {
|
||||
JUT_WARN(72, "%s", "registerSubFrameCallback Failed");
|
||||
} else {
|
||||
if (sLoadThread == NULL) {
|
||||
sLoadThread = JASDvd::getThreadPointer();
|
||||
}
|
||||
sReadBuffer = new (JASDram, 0x20) u8[(i_blockSize + 0x20) * i_channelMax];
|
||||
sBlockSize = i_blockSize;
|
||||
sChannelMax = i_channelMax;
|
||||
sReadBuffer = new (JASDram, 0x20) u8[(block_size + 0x20) * channel_max];
|
||||
JUT_ASSERT(79, sReadBuffer);
|
||||
sBlockSize = block_size;
|
||||
sChannelMax = channel_max;
|
||||
struct_80451260 = false;
|
||||
struct_80451261 = false;
|
||||
}
|
||||
@@ -85,6 +92,7 @@ JASAramStream::JASAramStream() {
|
||||
}
|
||||
|
||||
void JASAramStream::init(u32 param_0, u32 param_1, StreamCallback i_callback, void* i_callbackData) {
|
||||
JUT_ASSERT(153, sReadBuffer != 0);
|
||||
field_0x148 = param_0;
|
||||
field_0x14c = param_1;
|
||||
field_0x0c8 = 0.0f;
|
||||
@@ -110,9 +118,11 @@ void JASAramStream::init(u32 param_0, u32 param_1, StreamCallback i_callback, vo
|
||||
|
||||
bool JASAramStream::prepare(s32 param_0, int param_1) {
|
||||
if (!DVDFastOpen(param_0, &mDvdFileInfo)) {
|
||||
JUT_WARN(240, "%s", "DVDFastOpen Failed");
|
||||
return false;
|
||||
}
|
||||
if (!JASDriver::registerSubFrameCallback(channelProcCallback, this)) {
|
||||
JUT_WARN(245, "%s", "registerSubFrameCallback Failed");
|
||||
return false;
|
||||
}
|
||||
TaskData data;
|
||||
@@ -120,6 +130,7 @@ bool JASAramStream::prepare(s32 param_0, int param_1) {
|
||||
data.field_0x4 = field_0x14c;
|
||||
data.field_0x8 = param_1;
|
||||
if (!sLoadThread->sendCmdMsg(headerLoadTask, &data, 0xc)) {
|
||||
JUT_WARN(254, "%s", "sendCmdMsg headerLoadTask Failed");
|
||||
JASDriver::rejectCallback(channelProcCallback, this);
|
||||
return false;
|
||||
}
|
||||
@@ -127,21 +138,25 @@ bool JASAramStream::prepare(s32 param_0, int param_1) {
|
||||
}
|
||||
|
||||
bool JASAramStream::start() {
|
||||
return OSSendMessage(&field_0x000, (OSMessage)0, OS_MESSAGE_NOBLOCK);
|
||||
if (!OSSendMessage(&field_0x000, (OSMessage)0, OS_MESSAGE_NOBLOCK)) {
|
||||
JUT_WARN(273, "%s", "OSSendMessage Failed")
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool JASAramStream::stop(u16 param_0) {
|
||||
return OSSendMessage(&field_0x000, (OSMessage)(param_0 << 0x10 | 1), OS_MESSAGE_NOBLOCK);
|
||||
if (!OSSendMessage(&field_0x000, (OSMessage)(param_0 << 0x10 | 1), OS_MESSAGE_NOBLOCK)) {
|
||||
JUT_WARN(290, "%s", "OSSendMessage Failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool JASAramStream::pause(bool param_0) {
|
||||
OSMessage msg;
|
||||
if (param_0) {
|
||||
msg = (OSMessage)2;
|
||||
} else {
|
||||
msg = (OSMessage)3;
|
||||
}
|
||||
OSMessage msg = param_0 ? (OSMessage)2 : (OSMessage)3;
|
||||
if (!OSSendMessage(&field_0x000, msg, OS_MESSAGE_NOBLOCK)) {
|
||||
JUT_WARN(308, "%s", "OSSendMessage Failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -149,14 +164,15 @@ bool JASAramStream::pause(bool param_0) {
|
||||
|
||||
bool JASAramStream::cancel() {
|
||||
field_0x114 = 1;
|
||||
return sLoadThread->sendCmdMsg(finishTask, this);
|
||||
if (!sLoadThread->sendCmdMsg(finishTask, this)) {
|
||||
JUT_WARN(326, "%s", "sendCmdMsg finishTask Failed");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
u32 JASAramStream::getBlockSamples() const {
|
||||
if (field_0x158 == 0) {
|
||||
return (sBlockSize << 4) / 9;
|
||||
}
|
||||
return sBlockSize >> 1;
|
||||
return field_0x158 == 0 ? (sBlockSize << 4) / 9 : sBlockSize >> 1;
|
||||
}
|
||||
|
||||
void JASAramStream::headerLoadTask(void* i_data) {
|
||||
@@ -174,6 +190,7 @@ void JASAramStream::firstLoadTask(void* i_data) {
|
||||
data->field_0x8--;
|
||||
if (data->field_0x8 == 0) {
|
||||
if (!sLoadThread->sendCmdMsg(prepareFinishTask, _this)) {
|
||||
JUT_WARN(364, "%s", "sendCmdMsg prepareFinishTask Failed");
|
||||
struct_80451261 = true;
|
||||
}
|
||||
}
|
||||
@@ -181,6 +198,7 @@ void JASAramStream::firstLoadTask(void* i_data) {
|
||||
if (data->field_0x4 != 0) {
|
||||
data->field_0x4--;
|
||||
if (!sLoadThread->sendCmdMsg(firstLoadTask, data, 0xc)) {
|
||||
JUT_WARN(372, "%s", "sendCmdMsg firstLoadTask Failed");
|
||||
struct_80451261 = true;
|
||||
}
|
||||
JASCriticalSection cs;
|
||||
@@ -189,12 +207,15 @@ void JASAramStream::firstLoadTask(void* i_data) {
|
||||
}
|
||||
|
||||
void JASAramStream::loadToAramTask(void* i_this) {
|
||||
((JASAramStream*)i_this)->load();
|
||||
JASAramStream* stream = (JASAramStream*)i_this;
|
||||
stream->load();
|
||||
}
|
||||
|
||||
void JASAramStream::finishTask(void* i_this) {
|
||||
JASAramStream* _this = (JASAramStream*)i_this;
|
||||
JASDriver::rejectCallback(channelProcCallback, _this);
|
||||
if (!JASDriver::rejectCallback(channelProcCallback, _this)) {
|
||||
JUT_WARN(392, "%s", "rejectSubFrameCallback Failed");
|
||||
}
|
||||
if (_this->mCallback != NULL) {
|
||||
_this->mCallback(CB_START, _this, _this->mCallbackData);
|
||||
_this->mCallback = NULL;
|
||||
@@ -217,10 +238,16 @@ bool JASAramStream::headerLoad(u32 param_0, int param_1) {
|
||||
return false;
|
||||
}
|
||||
if (DVDReadPrio(&mDvdFileInfo, sReadBuffer, sizeof(Header), 0, 1) < 0) {
|
||||
JUT_WARN(420, "%s", "DVDReadPrio Failed");
|
||||
struct_80451261 = true;
|
||||
return false;
|
||||
}
|
||||
Header* header = (Header*)sReadBuffer;
|
||||
JUT_ASSERT(426, header->tag == 'STRM');
|
||||
JUT_ASSERT(427, header->format <= 1);
|
||||
JUT_ASSERT(428, header->bits == 16);
|
||||
JUT_ASSERT(429, header->channels <= sChannelMax);
|
||||
JUT_ASSERT(430, header->block_size == sBlockSize);
|
||||
field_0x158 = header->format;
|
||||
mChannelNum = header->channels;
|
||||
field_0x164 = header->field_0x10;
|
||||
@@ -233,9 +260,16 @@ bool JASAramStream::headerLoad(u32 param_0, int param_1) {
|
||||
field_0x10c = 0;
|
||||
field_0x160 = (param_0 / sBlockSize) / header->channels;
|
||||
mBufCount = field_0x160;
|
||||
JUT_ASSERT(445, mBufCount > 0);
|
||||
mBufCount--;
|
||||
if (mBufCount < 3) {
|
||||
JUT_WARN(449, "%s", "Too few Buffer-Size");
|
||||
}
|
||||
field_0x108 = mBufCount;
|
||||
getBlockSamples();
|
||||
u32 local_2c = (mLoopEnd - 1) / getBlockSamples();
|
||||
if (local_2c <= mBufCount && mLoop) {
|
||||
JUT_WARN(458, "%s", "Too few samples for Loop-buffer");
|
||||
}
|
||||
if (param_1 < 0 || param_1 > field_0x108) {
|
||||
param_1 = field_0x108;
|
||||
}
|
||||
@@ -247,6 +281,7 @@ bool JASAramStream::headerLoad(u32 param_0, int param_1) {
|
||||
data.field_0x4 = field_0x108 - 1;
|
||||
data.field_0x8 = param_1;
|
||||
if (!sLoadThread->sendCmdMsg(firstLoadTask, &data, 0xc)) {
|
||||
JUT_WARN(472, "%s", "sendCmdMsg firstLoadTask Failed");
|
||||
struct_80451261 = true;
|
||||
return false;
|
||||
}
|
||||
@@ -331,11 +366,13 @@ bool JASAramStream::load() {
|
||||
}
|
||||
|
||||
s32 JASAramStream::channelProcCallback(void* i_this) {
|
||||
return ((JASAramStream*)i_this)->channelProc();
|
||||
JASAramStream* stream = (JASAramStream*)i_this;
|
||||
return stream->channelProc();
|
||||
}
|
||||
|
||||
s32 JASAramStream::dvdErrorCheck(void* param_0) {
|
||||
switch (DVDGetDriveStatus()) {
|
||||
s32 status = DVDGetDriveStatus();
|
||||
switch (status) {
|
||||
case DVD_STATE_END:
|
||||
struct_80451260 = false;
|
||||
break;
|
||||
@@ -359,7 +396,8 @@ s32 JASAramStream::dvdErrorCheck(void* param_0) {
|
||||
|
||||
void JASAramStream::channelCallback(u32 i_callbackType, JASChannel* i_channel,
|
||||
JASDsp::TChannel* i_dspChannel, void* i_this) {
|
||||
((JASAramStream*)i_this)->updateChannel(i_callbackType, i_channel, i_dspChannel);
|
||||
JASAramStream* stream = (JASAramStream*)i_this;
|
||||
stream->updateChannel(i_callbackType, i_channel, i_dspChannel);
|
||||
}
|
||||
|
||||
void JASAramStream::updateChannel(u32 i_callbackType, JASChannel* i_channel,
|
||||
@@ -632,18 +670,21 @@ void JASAramStream::channelStart() {
|
||||
// probably a fake match, this should be set in the JASWaveInfo constructor
|
||||
static u32 const one = 1;
|
||||
wave_info.field_0x20 = &one;
|
||||
JASChannel* channel = new JASChannel(channelCallback, this);
|
||||
channel->setPriority(0x7f7f);
|
||||
JASChannel* jc = new JASChannel(channelCallback, this);
|
||||
JUT_ASSERT(963, jc);
|
||||
jc->setPriority(0x7f7f);
|
||||
for (u32 j = 0; j < 6; j++) {
|
||||
channel->setMixConfig(j, field_0x1dc[j]);
|
||||
jc->setMixConfig(j, field_0x1dc[j]);
|
||||
}
|
||||
channel->setInitPitch(field_0x164 / JASDriver::getDacRate());
|
||||
channel->setOscInit(0, &OSC_ENV);
|
||||
channel->field_0xdc.field_0x4 = wave_info;
|
||||
channel->field_0x104 = field_0x148 + sBlockSize * field_0x160 * i;
|
||||
channel->field_0xdc.field_0x0 = 0;
|
||||
channel->playForce();
|
||||
mChannels[i] = channel;
|
||||
jc->setInitPitch(field_0x164 / JASDriver::getDacRate());
|
||||
jc->setOscInit(0, &OSC_ENV);
|
||||
jc->field_0xdc.field_0x4 = wave_info;
|
||||
jc->field_0x104 = field_0x148 + sBlockSize * field_0x160 * i;
|
||||
jc->field_0xdc.field_0x0 = 0;
|
||||
int ret = jc->playForce();
|
||||
JUT_ASSERT(977, ret);
|
||||
JUT_ASSERT_MSG(979, mChannels[i] == NULL, "channelStart for already playing channel");
|
||||
mChannels[i] = jc;
|
||||
}
|
||||
field_0x0a8 = NULL;
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ JASBasicBank* JASBNKParser::Ver1::createBasicBank(void const* stream, JKRHeap* h
|
||||
data->mScale = osc->mScale;
|
||||
data->_14 = osc->_18;
|
||||
data->mTable = (JASOscillator::Point*)(envt + osc->mTableOffset);
|
||||
data->_0C = (JASOscillator::Point*)(envt + osc->_10);
|
||||
data->rel_table = (JASOscillator::Point*)(envt + osc->_10);
|
||||
}
|
||||
|
||||
bank->newInstTable(list_chunk->mCount, heap);
|
||||
@@ -208,9 +208,9 @@ JASBasicBank* JASBNKParser::Ver0::createBasicBank(void const* stream, JKRHeap* h
|
||||
JASOscillator::Point* table = new (heap, 0) JASOscillator::Point[size];
|
||||
JUT_ASSERT(409, table != NULL);
|
||||
JASCalc::bcopy(points, table, size * sizeof(JASOscillator::Point));
|
||||
osc->_0C = table;
|
||||
osc->rel_table = table;
|
||||
} else {
|
||||
osc->_0C = NULL;
|
||||
osc->rel_table = NULL;
|
||||
}
|
||||
|
||||
osc->mScale = tosc->mScale;
|
||||
|
||||
@@ -49,19 +49,32 @@ bool JASBasicInst::getParam(int param_0, int param_1, JASInstParam* param_2) con
|
||||
void JASBasicInst::setKeyRegionCount(u32 count, JKRHeap* param_1) {
|
||||
delete [] mKeymap;
|
||||
mKeymap = new (param_1, 0) TKeymap[count];
|
||||
JUT_ASSERT(114, mKeymap != 0);
|
||||
mKeymapCount = count;
|
||||
}
|
||||
|
||||
void JASBasicInst::setOsc(int param_0, JASOscillator::Data const* param_1) {
|
||||
field_0xc[param_0] = param_1;
|
||||
void JASBasicInst::setOsc(int index, JASOscillator::Data const* param_1) {
|
||||
JUT_ASSERT(128, index < OSC_MAX);
|
||||
JUT_ASSERT(129, index >= 0);
|
||||
field_0xc[index] = param_1;
|
||||
}
|
||||
|
||||
JASBasicInst::TKeymap* JASBasicInst::getKeyRegion(int param_0) {
|
||||
if (param_0 >= mKeymapCount) {
|
||||
JASBasicInst::TKeymap* JASBasicInst::getKeyRegion(int index) {
|
||||
JUT_ASSERT(146, index >= 0);
|
||||
if (index >= mKeymapCount) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return mKeymap + param_0;
|
||||
return mKeymap + index;
|
||||
}
|
||||
|
||||
JASBasicInst::TKeymap* JASBasicInst::getKeyRegion(int index) const {
|
||||
JUT_ASSERT(155, index >= 0);
|
||||
if (index >= mKeymapCount) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return mKeymap + index;
|
||||
}
|
||||
|
||||
JASBasicInst::TKeymap::~TKeymap() {
|
||||
|
||||
@@ -322,7 +322,7 @@ f32 JASCalc::pow2(f32 x) {
|
||||
|
||||
template <>
|
||||
s16 JASCalc::clamp(s32 x) {
|
||||
if (std::numeric_limits<s16>::min() >= x)
|
||||
if (x <= std::numeric_limits<s16>::min())
|
||||
return std::numeric_limits<s16>::min();
|
||||
if (x >= std::numeric_limits<s16>::max())
|
||||
return std::numeric_limits<s16>::max();
|
||||
|
||||
@@ -5,32 +5,48 @@
|
||||
#include "JSystem/JSystem.h" // IWYU pragma: keep
|
||||
|
||||
#include "JSystem/JAudio2/JASCmdStack.h"
|
||||
#include "JSystem/JAudio2/JASCriticalSection.h"
|
||||
#include "dolphin/os.h"
|
||||
|
||||
JASPortCmd::TPortHead JASPortCmd::sCommandListOnce;
|
||||
|
||||
JASPortCmd::TPortHead JASPortCmd::sCommandListStay;
|
||||
|
||||
bool JASPortCmd::addPortCmdOnce() {
|
||||
JASCriticalSection cs;
|
||||
return sCommandListOnce.append(this);
|
||||
}
|
||||
|
||||
bool JASPortCmd::setPortCmd(Command func, JASPortArgs* args) {
|
||||
JUT_ASSERT(81, func != 0);
|
||||
if (getSupervisor()) {
|
||||
return false;
|
||||
}
|
||||
mFunc = func;
|
||||
mArgs = args;
|
||||
return true;
|
||||
}
|
||||
|
||||
void JASPortCmd::execAllCommand() {
|
||||
sCommandListOnce.execCommandOnce();
|
||||
sCommandListStay.execCommandStay();
|
||||
}
|
||||
|
||||
void JASPortCmd::TPortHead::execCommandOnce() {
|
||||
volatile BOOL interrupts = OSDisableInterrupts();
|
||||
JASCriticalSection cs;
|
||||
JSULink<JASPortCmd>* next;
|
||||
for (JSULink<JASPortCmd>* link = getFirst(); link != NULL; link = next) {
|
||||
next = link->getNext();
|
||||
link->getObject()->_10(link->getObject()->_14);
|
||||
JASPortCmd* cmd = link->getObject();
|
||||
cmd->getFunc()(cmd->getArgs());
|
||||
remove(link);
|
||||
}
|
||||
OSRestoreInterrupts(interrupts);
|
||||
}
|
||||
|
||||
void JASPortCmd::TPortHead::execCommandStay() {
|
||||
volatile int interrupts = OSDisableInterrupts();
|
||||
JASCriticalSection cs;
|
||||
for (JSULink<JASPortCmd>* link = getFirst(); link != NULL; link = link->getNext()) {
|
||||
link->getObject()->_10(link->getObject()->_14);
|
||||
JASPortCmd* cmd = link->getObject();
|
||||
cmd->getFunc()(cmd->getArgs());
|
||||
}
|
||||
OSRestoreInterrupts(interrupts);
|
||||
}
|
||||
|
||||
@@ -6,35 +6,34 @@
|
||||
|
||||
|
||||
JASDrumSet::JASDrumSet() {
|
||||
field_0x4 = NULL;
|
||||
field_0x8 = 0;
|
||||
mPercArray = NULL;
|
||||
mPercNumMax = 0;
|
||||
}
|
||||
|
||||
JASDrumSet::~JASDrumSet() {
|
||||
}
|
||||
|
||||
void JASDrumSet::newPercArray(u8 param_0, JKRHeap* param_1) {
|
||||
if (param_0) {
|
||||
field_0x8 = param_0;
|
||||
field_0x4 = new (param_1, 0) TPerc*[field_0x8];
|
||||
JASCalc::bzero(field_0x4, field_0x8 * sizeof(TPerc*));
|
||||
void JASDrumSet::newPercArray(u8 num, JKRHeap* heap) {
|
||||
if (num) {
|
||||
JUT_ASSERT(39, num <= 128);
|
||||
mPercNumMax = num;
|
||||
mPercArray = new (heap, 0) TPerc*[mPercNumMax];
|
||||
JASCalc::bzero(mPercArray, mPercNumMax * sizeof(TPerc*));
|
||||
}
|
||||
}
|
||||
|
||||
bool JASDrumSet::getParam(int param_0, int param_1, JASInstParam* param_2) const {
|
||||
static JASOscillator::Data osc;
|
||||
static JASOscillator::Data* oscp;
|
||||
static s8 data_80451274;
|
||||
|
||||
if (field_0x4 == NULL) {
|
||||
bool JASDrumSet::getParam(int key, int param_1, JASInstParam* param_2) const {
|
||||
JUT_ASSERT(48, key >= 0);
|
||||
if (mPercArray == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (param_0 >= field_0x8) {
|
||||
if (key >= mPercNumMax) {
|
||||
JUT_WARN(54, "JASDrumSet: key %d >= PERC_MAX %d\n", key, mPercNumMax);
|
||||
return false;
|
||||
}
|
||||
|
||||
TPerc* perc = field_0x4[param_0];
|
||||
TPerc* perc = mPercArray[key];
|
||||
if (perc == NULL) {
|
||||
return false;
|
||||
}
|
||||
@@ -44,31 +43,60 @@ bool JASDrumSet::getParam(int param_0, int param_1, JASInstParam* param_2) const
|
||||
param_2->mVolume = perc->mVolume;
|
||||
param_2->mPitch = perc->mPitch;
|
||||
param_2->mPan = perc->mPan;
|
||||
param_2->field_0x18 = perc->field_0xc;
|
||||
param_2->field_0x18 = u16(perc->field_0xc);
|
||||
|
||||
static JASOscillator::Data osc;
|
||||
|
||||
osc.mTarget = 0;
|
||||
osc._04 = 1.0f;
|
||||
osc.mTable = NULL;
|
||||
osc._0C = NULL;
|
||||
osc.rel_table = NULL;
|
||||
osc.mScale = 1.0f;
|
||||
osc._14 = 0.0f;
|
||||
|
||||
if (data_80451274 == 0) {
|
||||
oscp = &osc;
|
||||
data_80451274 = 1;
|
||||
}
|
||||
static JASOscillator::Data* oscp = &osc;
|
||||
|
||||
param_2->field_0x14 = &oscp;
|
||||
param_2->field_0x1d = 1;
|
||||
param_2->mVolume *= perc->field_0x10;
|
||||
param_2->mPitch *= perc->field_0x14;
|
||||
param_2->field_0x1a = perc->field_0xe;
|
||||
param_2->field_0x1a = u16(perc->field_0xe);
|
||||
return true;
|
||||
}
|
||||
|
||||
void JASDrumSet::setPerc(int param_0, JASDrumSet::TPerc* param_1) {
|
||||
field_0x4[param_0] = param_1;
|
||||
void JASDrumSet::setPerc(int index, JASDrumSet::TPerc* param_1) {
|
||||
JUT_ASSERT(123, index >= 0);
|
||||
JUT_ASSERT(125, index < mPercNumMax);
|
||||
JUT_ASSERT(126, mPercArray);
|
||||
JUT_ASSERT(127, mPercArray[index] == 0);
|
||||
mPercArray[index] = param_1;
|
||||
}
|
||||
|
||||
JASDrumSet::TPerc* JASDrumSet::getPerc(int index) {
|
||||
if (index < 0) {
|
||||
return NULL;
|
||||
}
|
||||
if (index >= mPercNumMax) {
|
||||
return NULL;
|
||||
}
|
||||
if (!mPercArray) {
|
||||
return NULL;
|
||||
}
|
||||
return mPercArray[index];
|
||||
}
|
||||
|
||||
JASDrumSet::TPerc* JASDrumSet::getPerc(int index) const {
|
||||
if (index < 0) {
|
||||
return NULL;
|
||||
}
|
||||
if (index >= mPercNumMax) {
|
||||
return NULL;
|
||||
}
|
||||
if (!mPercArray) {
|
||||
return NULL;
|
||||
}
|
||||
return mPercArray[index];
|
||||
}
|
||||
|
||||
JASDrumSet::TPerc::TPerc() {
|
||||
mVolume = 1.0f;
|
||||
@@ -77,8 +105,9 @@ JASDrumSet::TPerc::TPerc() {
|
||||
field_0xc = 1000;
|
||||
}
|
||||
|
||||
void JASDrumSet::TPerc::setRelease(u32 param_0) {
|
||||
field_0xc = param_0;
|
||||
void JASDrumSet::TPerc::setRelease(u32 release) {
|
||||
JUT_ASSERT(224, release < 0x10000);
|
||||
field_0xc = release;
|
||||
}
|
||||
|
||||
u32 JASDrumSet::getType() const { return 'PERC'; }
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "JSystem/JKernel/JKRExpHeap.h"
|
||||
#include "JSystem/JKernel/JKRSolidHeap.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "dolphin/ar.h"
|
||||
|
||||
JASHeap::JASHeap(JASDisposer* disposer) : mTree(this) {
|
||||
mDisposer = disposer;
|
||||
@@ -45,7 +46,8 @@ bool JASHeap::alloc(JASHeap* mother, u32 param_1) {
|
||||
bool local_43 = false;
|
||||
JASHeap* local_30 = NULL;
|
||||
void* local_34;
|
||||
for (JSUTreeIterator<JASHeap> it = mother->mTree.getFirstChild(); it != mother->mTree.getEndChild(); it++) {
|
||||
JSUTreeIterator<JASHeap> it;
|
||||
for (it = mother->mTree.getFirstChild(); it != mother->mTree.getEndChild(); it++) {
|
||||
if (r29 >= mother->mBase + local_2c) {
|
||||
break;
|
||||
}
|
||||
@@ -77,8 +79,10 @@ bool JASHeap::alloc(JASHeap* mother, u32 param_1) {
|
||||
}
|
||||
|
||||
bool JASHeap::allocTail(JASHeap* mother, u32 size) {
|
||||
JUT_ASSERT(208, mother != NULL);
|
||||
JASMutexLock lock(&mMutex);
|
||||
if (isAllocated()) {
|
||||
OS_REPORT("[JASHeap::alloc] すでにヒープは確保されています。初期化してからにしてください。\n");
|
||||
return false;
|
||||
}
|
||||
if (!mother->isAllocated()) {
|
||||
@@ -128,6 +132,39 @@ bool JASHeap::free() {
|
||||
return true;
|
||||
}
|
||||
|
||||
u32 JASHeap::getTotalFreeSize() {
|
||||
JASMutexLock lock(&mMutex);
|
||||
u8* r28 = mBase;
|
||||
u32 r29 = 0;
|
||||
for (JSUTreeIterator<JASHeap> it = mTree.getFirstChild(); it != mTree.getEndChild(); it++) {
|
||||
r29 += it->mBase - r28;
|
||||
u32 r26 = it->mSize;
|
||||
r28 = it->mBase + r26;
|
||||
}
|
||||
r29 += mBase + mSize - r28;
|
||||
return r29;
|
||||
}
|
||||
|
||||
u32 JASHeap::getFreeSize() {
|
||||
JASMutexLock lock(&mMutex);
|
||||
u8* r27 = mBase;
|
||||
u32 r29 = 0;
|
||||
u32 r28;
|
||||
for (JSUTreeIterator<JASHeap> it = mTree.getFirstChild(); it != mTree.getEndChild(); it++) {
|
||||
r28 = it->mBase - r27;
|
||||
if (r28 > r29) {
|
||||
r29 = r28;
|
||||
}
|
||||
u32 r25 = it->mSize;
|
||||
r27 = it->mBase + r25;
|
||||
}
|
||||
r28 = mBase + mSize - r27;
|
||||
if (r28 > r29) {
|
||||
r29 = r28;
|
||||
}
|
||||
return r29;
|
||||
}
|
||||
|
||||
void JASHeap::insertChild(JASHeap* heap, JASHeap* next, void* param_2, u32 param_3, bool param_4) {
|
||||
JUT_ASSERT(513, heap != NULL);
|
||||
JUT_ASSERT(514, next == NULL || &mTree == next->mTree.getParent());
|
||||
@@ -260,6 +297,10 @@ JASMemChunkPool<1024, JASThreadingModel::ObjectLevelLockable>* JASKernel::getCom
|
||||
JASHeap JASKernel::audioAramHeap;
|
||||
|
||||
void JASKernel::setupAramHeap(u32 param_0, u32 param_1) {
|
||||
#if !PLATFORM_GCN
|
||||
OSReport("setupAramHeap %x, %x, %x\n", param_0, ARGetBaseAddress(), param_1);
|
||||
param_0 = ARGetBaseAddress();
|
||||
#endif
|
||||
sAramBase = param_0;
|
||||
audioAramHeap.initRootHeap((void*)sAramBase, param_1);
|
||||
}
|
||||
@@ -267,3 +308,11 @@ void JASKernel::setupAramHeap(u32 param_0, u32 param_1) {
|
||||
JASHeap* JASKernel::getAramHeap() {
|
||||
return &audioAramHeap;
|
||||
}
|
||||
|
||||
u32 JASKernel::getAramFreeSize() {
|
||||
audioAramHeap.getFreeSize();
|
||||
}
|
||||
|
||||
u32 JASKernel::getAramSize() {
|
||||
audioAramHeap.getSize();
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ f32 JASOscillator::getValue() const {
|
||||
}
|
||||
|
||||
void JASOscillator::release() {
|
||||
if (mData->_0C == NULL && mDirectRelease == 0) {
|
||||
if (mData->rel_table == NULL && mDirectRelease == 0) {
|
||||
stop();
|
||||
return;
|
||||
}
|
||||
@@ -72,12 +72,12 @@ void JASOscillator::release() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mData->mTable != mData->_0C) {
|
||||
if (mData->mTable != mData->rel_table) {
|
||||
_04 = 0.0f;
|
||||
_0C = _08;
|
||||
_10 = mData->_0C[0]._4 / 32768.0f;
|
||||
_10 = mData->rel_table[0]._4 / 32768.0f;
|
||||
_14 = 0;
|
||||
_18 = mData->_0C[0]._0;
|
||||
_18 = mData->rel_table[0]._0;
|
||||
}
|
||||
|
||||
_1C = 3;
|
||||
@@ -102,7 +102,7 @@ void JASOscillator::update() {
|
||||
if (_1C == 1) {
|
||||
psVar1 = mData->mTable;
|
||||
} else {
|
||||
psVar1 = mData->_0C;
|
||||
psVar1 = mData->rel_table;
|
||||
}
|
||||
|
||||
if (psVar1 == NULL) {
|
||||
|
||||
@@ -23,8 +23,8 @@ size_t JASResArcLoader::getResSize(JKRArchive const* i_archiveP, u16 i_resourceI
|
||||
size_t JASResArcLoader::getResMaxSize(JKRArchive const* i_archiveP) {
|
||||
u32 maxSize, index;
|
||||
u32 fileEntries = i_archiveP->countFile();
|
||||
|
||||
for (maxSize = 0, index = 0; index < fileEntries; index++) {
|
||||
maxSize = 0;
|
||||
for (index = 0; index < fileEntries; index++) {
|
||||
JKRArchive::SDIFileEntry* file = i_archiveP->findIdxResource(index);
|
||||
if (file) {
|
||||
if (maxSize < file->data_size) {
|
||||
@@ -37,7 +37,7 @@ size_t JASResArcLoader::getResMaxSize(JKRArchive const* i_archiveP) {
|
||||
}
|
||||
|
||||
static void JASResArcLoader::loadResourceCallback(void* args) {
|
||||
CallbackArgs* castedArgs = static_cast<CallbackArgs*>(args);
|
||||
TLoadResInfo* castedArgs = static_cast<TLoadResInfo*>(args);
|
||||
u32 readResult = castedArgs->mArchive->readResource(castedArgs->mBuffer, castedArgs->mBufferSize, castedArgs->mID);
|
||||
if (castedArgs->mCallback) {
|
||||
castedArgs->mCallback(readResult, castedArgs->mCallbackArg);
|
||||
@@ -47,19 +47,23 @@ static void JASResArcLoader::loadResourceCallback(void* args) {
|
||||
if (castedArgs->mQueue) {
|
||||
OSSendMessage(castedArgs->mQueue, (void*)RESARCMSG_Error, OS_MESSAGE_BLOCK);
|
||||
}
|
||||
} else {
|
||||
if (castedArgs->mQueue) {
|
||||
OSSendMessage(castedArgs->mQueue, (void*)RESARCMSG_Success, OS_MESSAGE_BLOCK);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (castedArgs->mQueue) {
|
||||
OSSendMessage(castedArgs->mQueue, (void*)RESARCMSG_Success, OS_MESSAGE_BLOCK);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int JASResArcLoader::loadResourceAsync(JKRArchive* archive, u16 id, u8* buffer, u32 size, LoadCallback callback, u32 cbArg)
|
||||
{
|
||||
CallbackArgs args(id, buffer, size, archive);
|
||||
TLoadResInfo args(archive, id, buffer, size);
|
||||
args.mCallback = callback;
|
||||
args.mCallbackArg = cbArg;
|
||||
|
||||
return JASDvd::getThreadPointer()->sendCmdMsg(&loadResourceCallback, (void*)&args, sizeof(CallbackArgs));
|
||||
int r31 = JASDvd::getThreadPointer()->sendCmdMsg(&loadResourceCallback, (void*)&args, sizeof(TLoadResInfo));
|
||||
if (!r31) {
|
||||
JUT_WARN(160, "%s", "sendCmdMsg loadResourceCallback Failed");
|
||||
}
|
||||
return r31;
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user