mirror of https://github.com/zeldaret/tp.git
JAudio2 debug (#2990)
This commit is contained in:
parent
c9d0c58ffe
commit
6ef13c620a
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,18 +21,22 @@ JASTrack::TList JASTrack::sTrackList;
|
|||
|
||||
// NONMATCHING JASPoolAllocObject_MultiThreaded<_> locations
|
||||
JASTrack::~JASTrack() {
|
||||
JUT_ASSERT(70, mStatus != STATUS_RUN);
|
||||
for (int i = 1; i < 4; i++) {
|
||||
delete mChannelMgrs[i];
|
||||
}
|
||||
}
|
||||
|
||||
// NONMATCHING JASPoolAllocObject_MultiThreaded<_> locations
|
||||
void JASTrack::setChannelMgrCount(u32 i_count) {
|
||||
void JASTrack::setChannelMgrCount(u32 count) {
|
||||
JUT_ASSERT(79, mStatus != STATUS_RUN);
|
||||
JUT_ASSERT(80, count >= 1 && count <= CHANNEL_MGR_MAX);
|
||||
mChannelMgrCount = 1;
|
||||
for (int i = 1; i < i_count; i++) {
|
||||
for (int i = 1; i < count; i++) {
|
||||
if (mChannelMgrs[i] == NULL) {
|
||||
mChannelMgrs[i] = new TChannelMgr(this);
|
||||
if (mChannelMgrs[i] == NULL) {
|
||||
JUT_WARN(87, "%s", "Not enough JASTrackChannelMgr\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -59,6 +63,7 @@ JASOscillator::Data const JASTrack::sPitchEnvOsc = {1, 1.0f, NULL, NULL, 1.0f, 0
|
|||
|
||||
// NONMATCHING JASPoolAllocObject_MultiThreaded<_> locations
|
||||
void JASTrack::init() {
|
||||
JUT_ASSERT(104, mStatus == STATUS_FREE || mStatus == STATUS_STOPPED);
|
||||
mSeqCtrl.init();
|
||||
mTrackPort.init();
|
||||
initTimed();
|
||||
|
|
@ -126,7 +131,7 @@ void JASTrack::init() {
|
|||
mFlags.autoDelete = false;
|
||||
mFlags.flag4 = false;
|
||||
mFlags.flag6 = false;
|
||||
mStatus = 0;
|
||||
mStatus = STATUS_FREE;
|
||||
}
|
||||
|
||||
void JASTrack::initTimed() {
|
||||
|
|
@ -161,18 +166,22 @@ void JASTrack::inherit(JASTrack const& i_parent) {
|
|||
}
|
||||
}
|
||||
|
||||
void JASTrack::assignExtBuffer(u32 i_index, JASSoundParams* i_soundParams) {
|
||||
mChannelMgrs[i_index]->mSoundParams = i_soundParams;
|
||||
void JASTrack::assignExtBuffer(u32 index, JASSoundParams* i_soundParams) {
|
||||
JUT_ASSERT(249, index < mChannelMgrCount);
|
||||
mChannelMgrs[index]->mSoundParams = i_soundParams;
|
||||
}
|
||||
|
||||
void JASTrack::setSeqData(void* param_0, u32 param_1) {
|
||||
JUT_ASSERT(257, mStatus == STATUS_FREE);
|
||||
mSeqCtrl.start(param_0, param_1);
|
||||
}
|
||||
|
||||
void JASTrack::startSeq() {
|
||||
JUT_ASSERT(265, mParent == 0);
|
||||
JUT_ASSERT(266, mStatus == STATUS_FREE);
|
||||
JASCriticalSection critical_section;
|
||||
sTrackList.append(this);
|
||||
mStatus = 1;
|
||||
mStatus = STATUS_RUN;
|
||||
}
|
||||
|
||||
void JASTrack::stopSeq() {
|
||||
|
|
@ -181,7 +190,9 @@ void JASTrack::stopSeq() {
|
|||
}
|
||||
|
||||
void JASTrack::start() {
|
||||
mStatus = 1;
|
||||
JUT_ASSERT(289, mParent != 0);
|
||||
JUT_ASSERT(290, mStatus == STATUS_FREE);
|
||||
mStatus = STATUS_RUN;
|
||||
}
|
||||
|
||||
void JASTrack::close() {
|
||||
|
|
@ -201,66 +212,77 @@ void JASTrack::close() {
|
|||
}
|
||||
}
|
||||
mParent = NULL;
|
||||
mStatus = 2;
|
||||
mStatus = STATUS_STOPPED;
|
||||
}
|
||||
|
||||
bool JASTrack::connectChild(u32 i_index, JASTrack* i_child) {
|
||||
if (mChildren[i_index] != NULL) {
|
||||
bool JASTrack::connectChild(u32 track_no, JASTrack* i_child) {
|
||||
JUT_ASSERT(326, track_no < MAX_CHILDREN);
|
||||
if (mChildren[track_no] != NULL) {
|
||||
return false;
|
||||
}
|
||||
i_child->mParent = this;
|
||||
mChildren[i_index] = i_child;
|
||||
mChildren[track_no] = i_child;
|
||||
return true;
|
||||
}
|
||||
|
||||
void JASTrack::closeChild(u32 i_index) {
|
||||
JASTrack* child = mChildren[i_index];
|
||||
void JASTrack::closeChild(u32 track_no) {
|
||||
JUT_ASSERT(340, track_no < MAX_CHILDREN);
|
||||
JASTrack* child = mChildren[track_no];
|
||||
if (child != NULL) {
|
||||
getRootTrack()->updateSeq(false, 1.0f);
|
||||
child->close();
|
||||
if (child->mFlags.autoDelete) {
|
||||
delete child;
|
||||
mChildren[i_index] = NULL;
|
||||
mChildren[track_no] = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// NONMATCHING JASPoolAllocObject_MultiThreaded<_> locations
|
||||
JASTrack* JASTrack::openChild(u32 i_index) {
|
||||
JASTrack* child = mChildren[i_index];
|
||||
JASTrack* JASTrack::openChild(u32 trk_no) {
|
||||
JUT_ASSERT(358, trk_no < MAX_CHILDREN);
|
||||
JASTrack* child = mChildren[trk_no];
|
||||
if (child != NULL) {
|
||||
switch (child->mStatus) {
|
||||
case 0:
|
||||
case STATUS_FREE:
|
||||
break;
|
||||
case 1:
|
||||
case STATUS_RUN:
|
||||
getRootTrack()->updateSeq(false, 1.0f);
|
||||
child->close();
|
||||
// no break
|
||||
case 2:
|
||||
case STATUS_STOPPED:
|
||||
bool auto_delete = child->mFlags.autoDelete;
|
||||
child->init();
|
||||
child->mFlags.autoDelete = auto_delete;
|
||||
mChildren[i_index] = NULL;
|
||||
connectChild(i_index, child);
|
||||
mChildren[trk_no] = NULL;
|
||||
connectChild(trk_no, child);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
child = new JASTrack();
|
||||
if (child == NULL) {
|
||||
JUT_WARN(388, "%s", "Not enough JASTrack\n");
|
||||
return NULL;
|
||||
}
|
||||
child->mFlags.autoDelete = true;
|
||||
connectChild(i_index, child);
|
||||
connectChild(trk_no, child);
|
||||
}
|
||||
child->setChannelMgrCount(mChannelMgrCount);
|
||||
child->inherit(*this);
|
||||
return child;
|
||||
}
|
||||
|
||||
void JASTrack::connectBus(int param_0, int param_1) {
|
||||
mMixConfig[param_0] = param_1;
|
||||
void JASTrack::connectBus(int line, int param_1) {
|
||||
JUT_ASSERT(404, line < JASChannel::BUSOUT_CPUCH);
|
||||
mMixConfig[line] = param_1;
|
||||
}
|
||||
|
||||
f32 JASTrack::getVolume() const { return mMoveParam.params.volume.mValue; }
|
||||
f32 JASTrack::getPitch() const { return mMoveParam.params.pitch.mValue; }
|
||||
f32 JASTrack::getPan() const { return mMoveParam.params.pan.mValue; }
|
||||
f32 JASTrack::getFxmix() const { return mMoveParam.params.fxmix.mValue; }
|
||||
f32 JASTrack::getDolby() const { return mMoveParam.params.dolby.mValue; }
|
||||
|
||||
void JASTrack::setLatestKey(u8 param_0) {
|
||||
field_0x22b = param_0;
|
||||
field_0x22b += getTransposeTotal();
|
||||
|
|
@ -293,7 +315,8 @@ JASChannel* JASTrack::channelStart(JASTrack::TChannelMgr* i_channelMgr, u32 para
|
|||
return channel;
|
||||
}
|
||||
|
||||
int JASTrack::noteOn(u32 i_noteID, u32 param_1, u32 param_2) {
|
||||
int JASTrack::noteOn(u32 noteid, u32 param_1, u32 param_2) {
|
||||
JUT_ASSERT(486, noteid != 0 && noteid < TChannelMgr::CHANNEL_MAX);
|
||||
if (isMute()) {
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -301,12 +324,12 @@ int JASTrack::noteOn(u32 i_noteID, u32 param_1, u32 param_2) {
|
|||
param_1 += getTransposeTotal();
|
||||
for (u32 i = 0; i < mChannelMgrCount; i++) {
|
||||
if (mChannelMgrs[i] != NULL) {
|
||||
mChannelMgrs[i]->noteOff(i_noteID, 0);
|
||||
mChannelMgrs[i]->noteOff(noteid, 0);
|
||||
JASChannel* channel = channelStart(mChannelMgrs[i], param_1, param_2, 0);
|
||||
if (channel == NULL) {
|
||||
ret = 0;
|
||||
}
|
||||
mChannelMgrs[i]->mChannels[i_noteID] = channel;
|
||||
mChannelMgrs[i]->mChannels[noteid] = channel;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
|
|
@ -337,9 +360,9 @@ int JASTrack::gateOn(u32 param_0, u32 i_velocity, f32 i_time, u32 i_flags) {
|
|||
} else {
|
||||
JASChannel* channel = channel_mgr->mChannels[0];
|
||||
if (channel != NULL) {
|
||||
channel->mKey = uvar7 - channel->field_0xdc.field_0x4.field_0x01;
|
||||
channel->mVelocity = i_velocity;
|
||||
channel->mUpdateTimer = update_timer;
|
||||
channel->setKey(uvar7 - channel->field_0xdc.field_0x4.field_0x01);
|
||||
channel->setVelocity(i_velocity);
|
||||
channel->setUpdateTimer(update_timer);
|
||||
}
|
||||
}
|
||||
if ((i_flags & 1) && channel_mgr->mChannels[0] != NULL) {
|
||||
|
|
@ -352,11 +375,12 @@ int JASTrack::gateOn(u32 param_0, u32 i_velocity, f32 i_time, u32 i_flags) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
int JASTrack::noteOff(u32 i_noteID, u16 param_1) {
|
||||
int JASTrack::noteOff(u32 noteid, u16 param_1) {
|
||||
JUT_ASSERT(563, noteid < TChannelMgr::CHANNEL_MAX);
|
||||
int ret = 1;
|
||||
for (u32 i = 0; i < mChannelMgrCount; i++) {
|
||||
if (mChannelMgrs[i] != NULL) {
|
||||
if (!mChannelMgrs[i]->noteOff(i_noteID, param_1)) {
|
||||
if (!mChannelMgrs[i]->noteOff(noteid, param_1)) {
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -364,10 +388,14 @@ int JASTrack::noteOff(u32 i_noteID, u16 param_1) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool JASTrack::checkNoteStop(u32 i_noteID) const {
|
||||
bool JASTrack::checkNoteStop(u32 noteid) const {
|
||||
JUT_ASSERT(581, noteid < TChannelMgr::CHANNEL_MAX);
|
||||
for (u32 i = 0; i < mChannelMgrCount; i++) {
|
||||
if (mChannelMgrs[i] != NULL && mChannelMgrs[i]->mChannels[i_noteID] != NULL) {
|
||||
return false;
|
||||
if (mChannelMgrs[i] != NULL) {
|
||||
JASChannel* channel = mChannelMgrs[i]->mChannels[noteid];
|
||||
if (channel != NULL) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
|
@ -376,13 +404,14 @@ bool JASTrack::checkNoteStop(u32 i_noteID) const {
|
|||
void JASTrack::overwriteOsc(JASChannel* i_channel) {
|
||||
for (u32 i = 0; i < 2; i++) {
|
||||
if (mOscParam[i].mTable != NULL) {
|
||||
JUT_ASSERT(599, mOscParam[i].rel_table == 0);
|
||||
i_channel->setOscInit(i, &mOscParam[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void JASTrack::updateTimedParam() {
|
||||
for (u32 i = 0; i < 6; i++) {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
MoveParam_* param = &mMoveParam.array[i];
|
||||
if (param->mCount != 0) {
|
||||
param->mValue += (param->mTarget - param->mValue) / param->mCount;
|
||||
|
|
@ -403,13 +432,12 @@ void JASTrack::updateTrack(f32 param_0) {
|
|||
f32 pan = (mMoveParam.params.pan.mValue - 0.5f) * mPanPower;
|
||||
f32 fxmix = mMoveParam.params.fxmix.mValue;
|
||||
f32 dolby = mMoveParam.params.dolby.mValue;
|
||||
JASSoundParams* sound_params = channel_mgr->mSoundParams;
|
||||
if (sound_params != NULL) {
|
||||
volume *= sound_params->mVolume;
|
||||
pitch *= sound_params->mPitch;
|
||||
pan += sound_params->mPan - 0.5f;
|
||||
fxmix += sound_params->mFxMix;
|
||||
dolby += sound_params->mDolby;
|
||||
if (channel_mgr->mSoundParams != NULL) {
|
||||
volume *= channel_mgr->mSoundParams->mVolume;
|
||||
pitch *= channel_mgr->mSoundParams->mPitch;
|
||||
pan += channel_mgr->mSoundParams->mPan - 0.5f;
|
||||
fxmix += channel_mgr->mSoundParams->mFxMix;
|
||||
dolby += channel_mgr->mSoundParams->mDolby;
|
||||
}
|
||||
pan *= param_0;
|
||||
if (mParent == NULL) {
|
||||
|
|
@ -456,25 +484,26 @@ void JASTrack::updateSeq(bool param_0, f32 param_1) {
|
|||
}
|
||||
f32 fvar1 = param_1 * mPanPower;
|
||||
for (int i = 0; i < 16; i++) {
|
||||
if (mChildren[i] != NULL && mChildren[i]->mStatus == 1) {
|
||||
mChildren[i]->updateSeq(param_0, fvar1);
|
||||
JASTrack* child = mChildren[i];
|
||||
if (child != NULL && child->mStatus == STATUS_RUN) {
|
||||
child->updateSeq(param_0, fvar1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
u32 JASTrack::seqTimeToDspTime(f32 i_seqTime) {
|
||||
f32 dsp_time;
|
||||
if (mFlags.flag2) {
|
||||
dsp_time = i_seqTime / field_0x1dc;
|
||||
i_seqTime = i_seqTime / field_0x1dc;
|
||||
} else {
|
||||
dsp_time = i_seqTime * (120.0f / mTimebase);
|
||||
dsp_time *= JASDriver::getSubFrames() / 10.0f;
|
||||
i_seqTime = i_seqTime * (120.0f / mTimebase);
|
||||
i_seqTime *= JASDriver::getSubFrames() / 10.0f;
|
||||
}
|
||||
return dsp_time;
|
||||
return i_seqTime;
|
||||
}
|
||||
|
||||
void JASTrack::setParam(u32 i_index, f32 i_target, u32 i_count) {
|
||||
MoveParam_* param = &mMoveParam.array[i_index];
|
||||
void JASTrack::setParam(u32 target, f32 i_target, u32 i_count) {
|
||||
JUT_ASSERT(739, target < TIMED_PARAMS);
|
||||
MoveParam_* param = &mMoveParam.array[target];
|
||||
param->mTarget = i_target;
|
||||
if (i_count == 0) {
|
||||
param->mValue = param->mTarget;
|
||||
|
|
@ -487,8 +516,9 @@ void JASTrack::noteOffAll(u16 param_0) {
|
|||
noteOff(i, param_0);
|
||||
}
|
||||
for (int i = 0; i < 16; i++) {
|
||||
if (mChildren[i] != NULL && mChildren[i]->mStatus == 1) {
|
||||
mChildren[i]->noteOffAll(param_0);
|
||||
JASTrack* child = mChildren[i];
|
||||
if (child != NULL && child->mStatus == STATUS_RUN) {
|
||||
child->noteOffAll(param_0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -500,14 +530,16 @@ void JASTrack::mute(bool i_mute) {
|
|||
}
|
||||
}
|
||||
|
||||
void JASTrack::setOscScale(u32 i_oscNo, f32 i_scale) {
|
||||
mOscParam[i_oscNo].mScale = i_scale;
|
||||
void JASTrack::setOscScale(u32 osc_no, f32 i_scale) {
|
||||
JUT_ASSERT(792, osc_no < OSC_NUM);
|
||||
mOscParam[osc_no].mScale = i_scale;
|
||||
}
|
||||
|
||||
void JASTrack::setOscTable(u32 i_oscNo, JASOscillator::Point const* i_table) {
|
||||
mOscParam[i_oscNo].mTable = i_table;
|
||||
if (i_oscNo != 0) {
|
||||
mOscParam[i_oscNo]._0C = NULL;
|
||||
void JASTrack::setOscTable(u32 osc_no, JASOscillator::Point const* i_table) {
|
||||
JUT_ASSERT(799, osc_no < OSC_NUM)
|
||||
mOscParam[osc_no].mTable = i_table;
|
||||
if (osc_no != 0) {
|
||||
mOscParam[osc_no].rel_table = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -547,9 +579,9 @@ void JASTrack::writePortSelf(u32 param_0, u16 param_1) {
|
|||
}
|
||||
|
||||
void JASTrack::writePort(u32 param_0, u16 param_1) {
|
||||
JASSeqCtrl::IntrType intr;
|
||||
mTrackPort.writeImport(param_0, param_1);
|
||||
if (param_0 == 0 || param_0 == 1) {
|
||||
JASSeqCtrl::IntrType intr;
|
||||
if (param_0 == 0) {
|
||||
intr = JASSeqCtrl::INTRTYPE_VALUE_2;
|
||||
} else {
|
||||
|
|
@ -565,13 +597,15 @@ u16 JASTrack::readPort(u32 param_0) {
|
|||
|
||||
void JASTrack::setChannelPauseFlag(bool i_pause) {
|
||||
for (u32 i = 0; i < mChannelMgrCount; i++) {
|
||||
if (mChannelMgrs[i] != NULL) {
|
||||
mChannelMgrs[i]->setPauseFlag(i_pause);
|
||||
TChannelMgr* mgr = mChannelMgrs[i];
|
||||
if (mgr != NULL) {
|
||||
mgr->setPauseFlag(i_pause);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < 16; i++) {
|
||||
if (mChildren[i] != NULL) {
|
||||
mChildren[i]->setChannelPauseFlag(i_pause);
|
||||
JASTrack* child = mChildren[i];
|
||||
if (child != NULL) {
|
||||
child->setChannelPauseFlag(i_pause);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -601,18 +635,21 @@ bool JASTrack::isMute() const {
|
|||
}
|
||||
|
||||
void JASTrack::setTempo(u16 i_tempo) {
|
||||
JUT_ASSERT(961, mParent == 0);
|
||||
mTempo = i_tempo;
|
||||
mFlags.flag5 = true;
|
||||
updateTempo();
|
||||
}
|
||||
|
||||
void JASTrack::setTempoRate(f32 i_tempoRate) {
|
||||
JUT_ASSERT(969, mParent == 0);
|
||||
mTempoRate = i_tempoRate;
|
||||
mFlags.flag5 = true;
|
||||
updateTempo();
|
||||
}
|
||||
|
||||
void JASTrack::setTimebase(u16 i_timebase) {
|
||||
JUT_ASSERT(977, mParent == 0);
|
||||
mTimebase = i_timebase;
|
||||
mFlags.flag5 = true;
|
||||
updateTempo();
|
||||
|
|
@ -639,7 +676,7 @@ void JASTrack::channelUpdateCallback(u32 param_0, JASChannel* param_1,
|
|||
switch (param_0) {
|
||||
case 0:
|
||||
case 1:
|
||||
param_1->mParams = channel_mgr->mParams;
|
||||
param_1->setParams(channel_mgr->mParams);
|
||||
track->updateChannel(param_1, param_2);
|
||||
break;
|
||||
case 3:
|
||||
|
|
@ -658,6 +695,21 @@ void JASTrack::channelUpdateCallback(u32 param_0, JASChannel* param_1,
|
|||
}
|
||||
}
|
||||
|
||||
int JASTrack::getChannelCount() const {
|
||||
JASCriticalSection cs;
|
||||
int count = 0;
|
||||
for (int i = 0; i < mChannelMgrCount; i++) {
|
||||
if (mChannelMgrs[i]) {
|
||||
for (int j = 0; j < 8; j++) {
|
||||
if (mChannelMgrs[i]->mChannels[j]) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
JASTrack* JASTrack::getRootTrack() {
|
||||
JASTrack* track = this;
|
||||
while (track->mParent != NULL) {
|
||||
|
|
@ -678,7 +730,8 @@ int JASTrack::tickProc() {
|
|||
}
|
||||
for (int i = 0; i < 16; i++) {
|
||||
JASTrack* child = mChildren[i];
|
||||
if (child != NULL && child->mStatus == 1) {
|
||||
if (child != NULL && child->mStatus == STATUS_RUN) {
|
||||
JUT_ASSERT(1090, this == child->mParent);
|
||||
ret = child->tickProc();
|
||||
if (ret < 0) {
|
||||
getRootTrack()->updateSeq(false, 1.0f);
|
||||
|
|
@ -694,6 +747,7 @@ int JASTrack::tickProc() {
|
|||
}
|
||||
|
||||
int JASTrack::seqMain() {
|
||||
JUT_ASSERT(1108, mStatus == STATUS_RUN);
|
||||
if (mFlags.flag6) {
|
||||
updateSeq(true, 1.0f);
|
||||
close();
|
||||
|
|
@ -701,7 +755,8 @@ int JASTrack::seqMain() {
|
|||
} else {
|
||||
while (field_0x1d8 >= 1.0f) {
|
||||
field_0x1d8 -= 1.0f;
|
||||
if (tickProc() < 0) {
|
||||
int ret = tickProc();
|
||||
if (ret < 0) {
|
||||
updateSeq(false, 1.0f);
|
||||
close();
|
||||
return -1;
|
||||
|
|
@ -714,13 +769,15 @@ int JASTrack::seqMain() {
|
|||
}
|
||||
|
||||
s32 JASTrack::TList::cbSeqMain(void* i_this) {
|
||||
static_cast<JASTrack::TList*>(i_this)->seqMain();
|
||||
JASTrack::TList* list = static_cast<JASTrack::TList*>(i_this);
|
||||
list->seqMain();
|
||||
return 0;
|
||||
}
|
||||
|
||||
void JASTrack::TList::append(JASTrack* i_track) {
|
||||
if (!mCallbackRegistered) {
|
||||
if (!JASDriver::registerSubFrameCallback(cbSeqMain, this)) {
|
||||
JUT_WARN(1157, "%s", "Failed: registerSubFrameCallback");
|
||||
return;
|
||||
}
|
||||
mCallbackRegistered = true;
|
||||
|
|
@ -796,8 +853,9 @@ void JASTrack::TChannelMgr::releaseAll() {
|
|||
}
|
||||
}
|
||||
|
||||
bool JASTrack::TChannelMgr::noteOff(u32 i_channel, u16 param_1) {
|
||||
JASChannel* channel = mChannels[i_channel];
|
||||
bool JASTrack::TChannelMgr::noteOff(u32 noteid, u16 param_1) {
|
||||
JUT_ASSERT(1224, noteid < CHANNEL_MAX);
|
||||
JASChannel* channel = mChannels[noteid];
|
||||
if (channel == NULL) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -807,14 +865,15 @@ bool JASTrack::TChannelMgr::noteOff(u32 i_channel, u16 param_1) {
|
|||
channel->release(param_1);
|
||||
}
|
||||
channel->free();
|
||||
mChannels[i_channel] = NULL;
|
||||
mChannels[noteid] = NULL;
|
||||
return true;
|
||||
}
|
||||
|
||||
void JASTrack::TChannelMgr::setPauseFlag(bool i_pause) {
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (mChannels[i] != NULL) {
|
||||
mChannels[i]->setPauseFlag(i_pause);
|
||||
JASChannel* channel = mChannels[i];
|
||||
if (channel != NULL) {
|
||||
channel->setPauseFlag(i_pause);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue