mirror of
https://github.com/TwilitRealm/dusklight
synced 2026-08-17 12:39:27 -04:00
Merge branch 'main' into 26-02-27-allocator-isolation
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
#ifndef JAIAUDIBLE_H
|
||||
#define JAIAUDIBLE_H
|
||||
|
||||
#include "JSystem/JGeometry.h"
|
||||
|
||||
struct JASSoundParams;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAIAudible {
|
||||
public:
|
||||
virtual ~JAIAudible();
|
||||
virtual JASSoundParams* getOuterParams(int) = 0;
|
||||
virtual void calc() = 0;
|
||||
|
||||
JGeometry::TVec3<float>& getPos() { return mPos; }
|
||||
void setPos(const JGeometry::TVec3<float>& other) { mPos.set(other); }
|
||||
|
||||
/* 0x04 */ JGeometry::TVec3<float> mPos;
|
||||
};
|
||||
|
||||
#endif /* JAIAUDIBLE_H */
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef JAIAUDIENCE_H
|
||||
#define JAIAUDIENCE_H
|
||||
|
||||
#include "JSystem/JGeometry.h"
|
||||
|
||||
class JAIAudible;
|
||||
class JAISoundID;
|
||||
struct JASSoundParams;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAIAudience {
|
||||
virtual ~JAIAudience();
|
||||
virtual JAIAudible* newAudible(JGeometry::TVec3<f32> const&, JAISoundID,
|
||||
JGeometry::TVec3<f32> const*, u32) = 0;
|
||||
virtual int getMaxChannels() = 0;
|
||||
virtual void deleteAudible(JAIAudible*) = 0;
|
||||
virtual u32 calcPriority(JAIAudible*) = 0;
|
||||
virtual void mixChannelOut(JASSoundParams const&, JAIAudible*, int) = 0;
|
||||
};
|
||||
|
||||
#endif /* JAIAUDIENCE_H */
|
||||
@@ -0,0 +1,58 @@
|
||||
#ifndef JAISE_H
|
||||
#define JAISE_H
|
||||
|
||||
#include "JSystem/JAudio2/JAISeqDataMgr.h"
|
||||
#include "JSystem/JAudio2/JASTrack.h"
|
||||
|
||||
class JAISeMgr;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAISe : public JSULink<JAISe>, public JAISound, public JASPoolAllocObject<JAISe> {
|
||||
public:
|
||||
class TInner {
|
||||
public:
|
||||
TInner() : mSeqData(NULL, 0) {}
|
||||
|
||||
/* 0x000 */ u32 mProperPriority;
|
||||
/* 0x004 */ u32 mPriority;
|
||||
/* 0x008 */ JASSoundParams mSoundParams;
|
||||
/* 0x01c */ JASTrack track;
|
||||
/* 0x264 */ JAISeqData mSeqData;
|
||||
/* 0x26c */ u8 field_0x26c;
|
||||
/* 0x270 */ JAISeMgr* seMgr;
|
||||
/* 0x274 */ JAISoundStrategyMgr<JAISe>* mSoundStrategyMgr;
|
||||
/* 0x278 */ JAISoundStrategyMgr__unknown<JAISe>* field_0x278;
|
||||
/* 0x27c */ JAITempoMgr mTempoMgr;
|
||||
};
|
||||
|
||||
virtual s32 getNumChild() const;
|
||||
virtual JAISoundChild* getChild(int);
|
||||
virtual void releaseChild(int);
|
||||
virtual JASTrack* getTrack();
|
||||
virtual JASTrack* getChildTrack(int);
|
||||
virtual JAISe* asSe();
|
||||
virtual JAITempoMgr* getTempoMgr();
|
||||
virtual bool JAISound_tryDie_();
|
||||
|
||||
JAISe(JAISeMgr* seMgr, JAISoundStrategyMgr<JAISe>* soundStrategyMgr, u32 priority);
|
||||
void mixOut_(const JASSoundParams& params);
|
||||
void stopTrack_();
|
||||
void startTrack_(const JASSoundParams& params);
|
||||
void JAISeCategoryMgr_mixOut_(bool, const JASSoundParams& params, JAISoundActivity activity);
|
||||
void JAISeCategoryMgr_calc_();
|
||||
void JAISeMgr_startID_(JAISoundID id, const JGeometry::TVec3<f32>* posPtr, JAIAudience* audience);
|
||||
bool prepare_getSeqData_();
|
||||
void prepare_();
|
||||
|
||||
const JAISeqData* getSeqData() const { return &inner_.mSeqData; }
|
||||
u32 JAISeCategoryMgr_getProperPriority_() const { return inner_.mProperPriority; }
|
||||
u32 JAISeCategoryMgr_getPriority_() const { return inner_.mPriority; }
|
||||
bool isFarAway() const { return inner_.mPriority == -1; }
|
||||
|
||||
/* 0x0ac */ TInner inner_;
|
||||
};
|
||||
|
||||
#endif /* JAISE_H */
|
||||
@@ -0,0 +1,147 @@
|
||||
#ifndef JAISEMGR_H
|
||||
#define JAISEMGR_H
|
||||
|
||||
#include "JSystem/JAudio2/JAISe.h"
|
||||
#include "global.h"
|
||||
|
||||
struct JAIAudience;
|
||||
struct JASSoundParams;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JASNonCopyable {
|
||||
JASNonCopyable() {}
|
||||
~JASNonCopyable() {}
|
||||
|
||||
/* 0x0 */ void* field_0x0;
|
||||
}; // Size: 0x4
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAISeCategoryArrangementItem {
|
||||
u8 mMaxActiveSe;
|
||||
u8 mMaxInactiveSe;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAISeCategoryArrangement {
|
||||
JAISeCategoryArrangementItem mItems[16];
|
||||
};
|
||||
|
||||
class JAISeMgr;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAISeCategoryMgr : public JAISeqDataUser, public JASNonCopyable {
|
||||
public:
|
||||
void JAISeMgr_calc_();
|
||||
void JAISeMgr_freeDeadSe_();
|
||||
bool JAISeMgr_acceptsNewSe_(u32 priority) const;
|
||||
void sortByPriority_();
|
||||
void stop(u32 fadeTime);
|
||||
void stop();
|
||||
void stopSoundID(JAISoundID id);
|
||||
void pause(bool);
|
||||
void JAISeMgr_mixOut_(const JAISoundParamsMove& params, JAISoundActivity activity);
|
||||
JAISeCategoryMgr() {
|
||||
mParams.init();
|
||||
mMaxActiveSe = 0;
|
||||
mMaxInactiveSe = 0;
|
||||
field_0x0 = NULL;
|
||||
}
|
||||
|
||||
virtual bool isUsingSeqData(const JAISeqDataRegion& seqDataRegion);
|
||||
virtual int releaseSeqData(const JAISeqDataRegion& seqDataRegion);
|
||||
|
||||
JAISoundParamsMove* getParams() { return &mParams; }
|
||||
int getMaxSe() const {
|
||||
if (mMaxActiveSe == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return mMaxActiveSe + mMaxInactiveSe;
|
||||
}
|
||||
int getMaxInactiveSe() const { return mMaxInactiveSe; }
|
||||
int getMaxActiveSe() const { return mMaxActiveSe; }
|
||||
void setMaxActiveSe(int num) { mMaxActiveSe = num; }
|
||||
void setMaxInactiveSe(int num) { mMaxInactiveSe = num; }
|
||||
const JSUList<JAISe>* getSeList() const { return &mSeList; }
|
||||
int getNumSe() const { return mSeList.getNumLinks(); }
|
||||
JAIAudience* getAudience() { return (JAIAudience*)field_0x0; }
|
||||
void JAISeMgr_appendSe_(JAISe* se) { mSeList.append(se); }
|
||||
|
||||
/* 0x08 */ JAISoundParamsMove mParams;
|
||||
/* 0x58 */ JSUList<JAISe> mSeList;
|
||||
/* 0x64 */ int mMaxInactiveSe;
|
||||
/* 0x68 */ int mMaxActiveSe;
|
||||
}; // Size: 0x6C
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAISeMgr : public JASGlobalInstance<JAISeMgr>,
|
||||
public JAISeqDataUser {
|
||||
public:
|
||||
JAISeMgr(bool setInstance);
|
||||
void setCategoryArrangement(const JAISeCategoryArrangement& arrangement);
|
||||
void getCategoryArrangement(JAISeCategoryArrangement*);
|
||||
void stop();
|
||||
void stopSoundID(JAISoundID id);
|
||||
void initParams();
|
||||
void setAudience(JAIAudience* audience);
|
||||
void setSeqDataMgr(JAISeqDataMgr* seqDataMgr);
|
||||
void resetSeqDataMgr();
|
||||
JAISe* newSe_(int category, u32 priority);
|
||||
void calc();
|
||||
void mixOut();
|
||||
bool startSound(JAISoundID id, JAISoundHandle* handle, const JGeometry::TVec3<f32>* posPtr);
|
||||
int getNumActiveSe() const;
|
||||
|
||||
/* 0x004 */ JAISoundActivity mSoundActivity;
|
||||
|
||||
virtual bool isUsingSeqData(const JAISeqDataRegion& seqDataRegion);
|
||||
virtual int releaseSeqData(const JAISeqDataRegion& seqDataRegion);
|
||||
|
||||
JAISeCategoryMgr* getCategory(int categoryIndex) {
|
||||
JUT_ASSERT(222, categoryIndex >= 0);
|
||||
JUT_ASSERT(223, categoryIndex < NUM_CATEGORIES);
|
||||
return &mCategoryMgrs[categoryIndex];
|
||||
}
|
||||
JAIAudience* getAudience() { return mAudience; }
|
||||
JAIAudience* getAudience(int index) {
|
||||
if (index >= 0 && index < NUM_CATEGORIES) {
|
||||
JAIAudience* rv = mCategoryMgrs[index].getAudience();
|
||||
if (rv) return rv;
|
||||
}
|
||||
return mAudience;
|
||||
}
|
||||
JAISeqDataMgr* getSeqDataMgr() { return mSeqDataMgr; }
|
||||
JAISoundParamsMove* getParams() { return &mParams; }
|
||||
|
||||
bool isActive() const { return getNumActiveSe() > 0; }
|
||||
|
||||
static const int NUM_CATEGORIES = 16;
|
||||
|
||||
private:
|
||||
/* 0x008 */ JAIAudience* mAudience;
|
||||
/* 0x00C */ JAISeqDataMgr* mSeqDataMgr;
|
||||
/* 0x010 */ JAISoundStrategyMgr<JAISe>* mStrategyMgr;
|
||||
/* 0x014 */ JAISeCategoryMgr mCategoryMgrs[NUM_CATEGORIES];
|
||||
/* 0x6D4 */ JAISoundParamsMove mParams;
|
||||
}; // Size: 0x724
|
||||
|
||||
#if VERSION != VERSION_SHIELD_DEBUG
|
||||
STATIC_ASSERT(sizeof(JAISeMgr) == 0x724);
|
||||
#endif
|
||||
|
||||
#endif /* JAISEMGR_H */
|
||||
@@ -0,0 +1,62 @@
|
||||
#ifndef JAISEQ_H
|
||||
#define JAISEQ_H
|
||||
|
||||
#include "JSystem/JAudio2/JAISeqDataMgr.h"
|
||||
#include "JSystem/JAudio2/JASTrack.h"
|
||||
#include "JSystem/JSupport/JSUList.h"
|
||||
|
||||
class JAISeqMgr;
|
||||
struct JAISoundChild;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAISeq : public JAISound, public JSULink<JAISeq>, public JASPoolAllocObject<JAISeq> {
|
||||
public:
|
||||
static const int NUM_CHILDREN = 32;
|
||||
|
||||
class TInner {
|
||||
public:
|
||||
TInner() : mSeqData(NULL, 0) {}
|
||||
|
||||
/* 0x000 */ JASTrack outputTrack;
|
||||
/* 0x248 */ JAISoundChild* mSoundChild[NUM_CHILDREN];
|
||||
/* 0x2C8 */ JAITempoMgr mTempoMgr;
|
||||
/* 0x2D8 */ JASSoundParams mSoundParams;
|
||||
/* 0x2EC */ JAISeqData mSeqData;
|
||||
/* 0x2F4 */ s32 field_0x39c;
|
||||
/* 0x2F8 */ JAISeqMgr* seqMgr;
|
||||
/* 0x2FC */ JAISoundStrategyMgr<JAISeq>* strategyMgr;
|
||||
};
|
||||
|
||||
virtual s32 getNumChild() const;
|
||||
virtual JAISoundChild* getChild(int index);
|
||||
virtual void releaseChild(int index);
|
||||
virtual JAISeq* asSeq();
|
||||
virtual JASTrack* getTrack();
|
||||
virtual JASTrack* getChildTrack(int);
|
||||
virtual JAITempoMgr* getTempoMgr();
|
||||
virtual bool JAISound_tryDie_();
|
||||
|
||||
JAISeq(JAISeqMgr* seqMgr, JAISoundStrategyMgr<JAISeq>* soundStrategyMgr);
|
||||
void JAISeqMgr_startID_(JAISoundID id, const JGeometry::TVec3<f32>* posPtr, JAIAudience* audience,
|
||||
int category, int);
|
||||
void playSeqData_(const JASSoundParams& params, JAISoundActivity activity);
|
||||
void reserveChildTracks_(int);
|
||||
void releaseChildTracks_();
|
||||
bool prepare_getSeqData_();
|
||||
bool prepare_(const JASSoundParams& params, JAISoundActivity activity);
|
||||
void JAISeqMgr_calc_();
|
||||
void die_();
|
||||
void mixOut_(const JASSoundParams& params, JAISoundActivity activity);
|
||||
void JAISeqMgr_mixOut_(const JASSoundParams& params, JAISoundActivity activity);
|
||||
|
||||
const JAISeqData& getSeqData() const { return inner_.mSeqData; }
|
||||
s32 getCategory() const { return inner_.field_0x39c; }
|
||||
|
||||
/* 0x0A8 */ TInner inner_;
|
||||
/* 0x3A8 */ JAISoundStrategyMgr__unknown<JAISeq>* field_0x3a8;
|
||||
};
|
||||
|
||||
#endif /* JAISEQ_H */
|
||||
@@ -0,0 +1,67 @@
|
||||
#ifndef JAISEQDATAMGR_H
|
||||
#define JAISEQDATAMGR_H
|
||||
|
||||
#include "JSystem/JAudio2/JAISound.h"
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAISeqData {
|
||||
JAISeqData(const void* param_0, u32 param_1) {
|
||||
field_0x0 = (void*)param_0;
|
||||
field_0x4 = param_1;
|
||||
}
|
||||
|
||||
void set(const void* param_0, u32 param_1) {
|
||||
field_0x0 = (void*)param_0;
|
||||
field_0x4 = param_1;
|
||||
}
|
||||
|
||||
/* 0x00 */ void* field_0x0;
|
||||
/* 0x04 */ u32 field_0x4;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAISeqDataRegion {
|
||||
bool intersects(const JAISeqData& seqData) const {
|
||||
if ((uintptr_t)addr + size < (uintptr_t)seqData.field_0x0) {
|
||||
return false;
|
||||
}
|
||||
if ((uintptr_t)seqData.field_0x0 + seqData.field_0x4 < (uintptr_t)addr) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* 0x00 */ u8* addr;
|
||||
/* 0x04 */ u32 size;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAISeqDataUser {
|
||||
virtual ~JAISeqDataUser();
|
||||
virtual bool isUsingSeqData(JAISeqDataRegion const&) = 0;
|
||||
virtual int releaseSeqData(JAISeqDataRegion const&) = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAISeqDataMgr {
|
||||
enum SeqDataReturnValue{ SeqDataReturnValue_0 = 0, SeqDataReturnValue_1 = 1, SeqDataReturnValue_2 = 2};
|
||||
virtual ~JAISeqDataMgr();
|
||||
virtual SeqDataReturnValue getSeqData(JAISoundID, JAISeqData*) = 0;
|
||||
virtual int releaseSeqData() = 0;
|
||||
virtual bool setSeqDataUser(JAISeqDataUser*) = 0;
|
||||
};
|
||||
|
||||
#endif /* JAISEQDATAMGR_H */
|
||||
@@ -0,0 +1,72 @@
|
||||
#ifndef JAISEQMGR_H
|
||||
#define JAISEQMGR_H
|
||||
|
||||
#include "JSystem/JAudio2/JAISeqDataMgr.h"
|
||||
#include "JSystem/JAudio2/JASGadget.h"
|
||||
#include "JSystem/JSupport/JSUList.h"
|
||||
|
||||
struct JAIAudience;
|
||||
class JAISeq;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAISeqMgr : public JASGlobalInstance<JAISeqMgr>, public JAISeqDataUser {
|
||||
public:
|
||||
enum ReleaseSeqResult {
|
||||
RELEASE_SEQ_1 = 1,
|
||||
RELEASE_SEQ_2 = 2,
|
||||
};
|
||||
JAISeqMgr(bool setInstance);
|
||||
void freeDeadSeq_();
|
||||
bool startSound(JAISoundID id, JAISoundHandle* handle, const JGeometry::TVec3<f32>* posPtr);
|
||||
void calc();
|
||||
void stop();
|
||||
void stop(u32 fadeTime);
|
||||
void stopSoundID(JAISoundID id);
|
||||
void mixOut();
|
||||
JAISeq* beginStartSeq_();
|
||||
bool endStartSeq_(JAISeq* seq, JAISoundHandle* handle);
|
||||
|
||||
/* 0x04 */ JAISoundActivity mActivity;
|
||||
|
||||
virtual ~JAISeqMgr() {}
|
||||
virtual bool isUsingSeqData(const JAISeqDataRegion& seqDataRegion);
|
||||
virtual int releaseSeqData(const JAISeqDataRegion& seqDataRegion);
|
||||
|
||||
void setAudience(JAIAudience* audience) { mAudience = audience; }
|
||||
JAIAudience* getAudience() { return mAudience; }
|
||||
|
||||
JAISeqDataMgr* getSeqDataMgr() { return seqDataMgr_; }
|
||||
|
||||
void setSeqDataMgr(JAISeqDataMgr* seqDataMgr) {
|
||||
JUT_ASSERT(124, !isActive());
|
||||
resetSeqDataMgr();
|
||||
seqDataMgr_ = seqDataMgr;
|
||||
seqDataMgr_->setSeqDataUser(this);
|
||||
}
|
||||
|
||||
void resetSeqDataMgr() {
|
||||
JUT_ASSERT(131, !isActive());
|
||||
if (seqDataMgr_) {
|
||||
seqDataMgr_->setSeqDataUser(NULL);
|
||||
seqDataMgr_ = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
JAISoundParamsMove* getParams() { return &mMove; }
|
||||
bool isActive() const { return mSeqList.getNumLinks() != 0; }
|
||||
int getNumActiveSeqs() const { return mSeqList.getNumLinks(); }
|
||||
void pause(bool paused) { mActivity.field_0x0.flags.flag2 = paused; }
|
||||
|
||||
private:
|
||||
/* 0x08 */ JAIAudience* mAudience;
|
||||
/* 0x0C */ JAISeqDataMgr* seqDataMgr_;
|
||||
/* 0x10 */ JAISoundStrategyMgr<JAISeq>* field_0x10;
|
||||
/* 0x14 */ JAISoundParamsMove mMove;
|
||||
/* 0x64 */ JSUList<JAISeq> mSeqList;
|
||||
/* 0x70 */ int field_0x70;
|
||||
}; // Size: 0x74
|
||||
|
||||
#endif /* JAISEQMGR_H */
|
||||
@@ -0,0 +1,378 @@
|
||||
#ifndef JAISOUND_H
|
||||
#define JAISOUND_H
|
||||
|
||||
#include "JSystem/JAudio2/JAISoundParams.h"
|
||||
#include "JSystem/JAudio2/JAIAudible.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include "global.h"
|
||||
#include <cstdint>
|
||||
|
||||
class JAISound;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAISoundHandle {
|
||||
public:
|
||||
JAISoundHandle() {sound_ = NULL;};
|
||||
~JAISoundHandle() { releaseSound(); }
|
||||
|
||||
bool isSoundAttached() const { return sound_ != NULL; }
|
||||
|
||||
JAISound* getSound() {
|
||||
JUT_ASSERT(41, sound_ != NULL);
|
||||
return sound_;
|
||||
}
|
||||
|
||||
JAISound* operator->() const {
|
||||
JUT_ASSERT(58, sound_ != NULL);
|
||||
return sound_;
|
||||
}
|
||||
|
||||
operator bool() const { return isSoundAttached(); }
|
||||
|
||||
void releaseSound();
|
||||
|
||||
JAISound* sound_;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAISoundID {
|
||||
public:
|
||||
operator u32() const { return id_.composite_; }
|
||||
|
||||
JAISoundID(u32 id) { id_.composite_ = id; };
|
||||
|
||||
JAISoundID(const JAISoundID& other) { id_.composite_ = other.id_.composite_; };
|
||||
|
||||
JAISoundID() {}
|
||||
|
||||
bool isAnonymous() const { return id_.composite_ == -1; }
|
||||
void setAnonymous() { id_.composite_ = -1; }
|
||||
|
||||
union {
|
||||
u32 composite_;
|
||||
struct {
|
||||
union {
|
||||
u16 value;
|
||||
struct {
|
||||
u8 sectionID;
|
||||
u8 groupID;
|
||||
} parts;
|
||||
} type;
|
||||
u16 waveID;
|
||||
} info;
|
||||
} id_;
|
||||
};
|
||||
|
||||
struct JASTrack;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAISoundStatus_ {
|
||||
s32 lockWhenPrepared();
|
||||
s32 unlockIfLocked();
|
||||
|
||||
void init() {
|
||||
field_0x0.value = 0;
|
||||
field_0x1.value = 0;
|
||||
*((u16*)&state) = 0;
|
||||
userdata_ = 0;
|
||||
}
|
||||
|
||||
bool isAlive() const { return state.unk != 6; }
|
||||
bool isDead() const { return state.unk == 6;}
|
||||
|
||||
bool isPlaying() const { return state.unk == 5; }
|
||||
bool isPrepared() const { return state.unk >= 3; }
|
||||
bool isMute() const { return field_0x0.flags.mute; }
|
||||
bool isPaused() const { return field_0x0.flags.paused; }
|
||||
void pauseWhenOut() {
|
||||
field_0x1.flags.flag3 = 1;
|
||||
}
|
||||
|
||||
/* 0x0 */ union {
|
||||
u8 value;
|
||||
struct {
|
||||
u8 mute : 1;
|
||||
u8 paused : 1;
|
||||
u8 flag3 : 1;
|
||||
u8 flag4 : 1;
|
||||
u8 flag5 : 1;
|
||||
u8 flag6 : 1;
|
||||
u8 flag7 : 1;
|
||||
u8 flag8 : 1;
|
||||
} flags;
|
||||
} field_0x0;
|
||||
/* 0x1 */ union {
|
||||
u8 value;
|
||||
struct {
|
||||
u8 flag1 : 1;
|
||||
u8 flag2 : 1;
|
||||
u8 flag3 : 1;
|
||||
u8 flag4 : 1;
|
||||
u8 flag5 : 1;
|
||||
u8 flag6 : 1;
|
||||
u8 flag7 : 1;
|
||||
u8 flag8 : 1;
|
||||
} flags;
|
||||
} field_0x1;
|
||||
/* 0x2 */ struct {
|
||||
u8 unk;
|
||||
struct {
|
||||
u8 flag1 : 1;
|
||||
u8 calcedOnce : 1;
|
||||
u8 animationState : 2;
|
||||
u8 flag5 : 1;
|
||||
u8 flag6 : 1;
|
||||
u8 flag7 : 1;
|
||||
u8 flag8 : 1;
|
||||
} flags;
|
||||
} state;
|
||||
/* 0x4 */ uintptr_t userdata_;
|
||||
}; // Size: 0x8
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAISoundFader {
|
||||
void forceIn() {
|
||||
value_ = 1.0f;
|
||||
mTransition.zero();
|
||||
}
|
||||
|
||||
void forceOut() {
|
||||
value_ = 0.0f;
|
||||
mTransition.zero();
|
||||
}
|
||||
|
||||
void fadeOut(u32 maxSteps) {
|
||||
if (maxSteps != 0) {
|
||||
mTransition.set(0.0f, value_, maxSteps);
|
||||
} else {
|
||||
forceOut();
|
||||
}
|
||||
}
|
||||
|
||||
void fadeIn(u32 maxSteps) {
|
||||
if (maxSteps != 0) {
|
||||
mTransition.set(1.0f, value_, maxSteps);
|
||||
} else {
|
||||
forceIn();
|
||||
}
|
||||
}
|
||||
|
||||
void fadeInFromOut(u32 maxSteps) {
|
||||
value_ = 0.0f;
|
||||
fadeIn(maxSteps);
|
||||
}
|
||||
|
||||
bool isOut() const {
|
||||
return (mTransition.remainingSteps_ == 0 && value_ < 0.01f);
|
||||
}
|
||||
|
||||
void calc() { value_ = mTransition.apply(value_); }
|
||||
f32 getIntensity() const { return value_; }
|
||||
|
||||
/* 0x00 */ f32 value_;
|
||||
/* 0x04 */ JAISoundParamsTransition::TTransition mTransition;
|
||||
}; // Size: 0x10
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
template <typename A0>
|
||||
struct JAISoundStrategyMgr__unknown {
|
||||
virtual void virtual2();
|
||||
virtual void calc(A0*);
|
||||
virtual void virtual4(A0*, const JASSoundParams&);
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
template <typename A0>
|
||||
struct JAISoundStrategyMgr {
|
||||
virtual void virtual2();
|
||||
virtual JAISoundStrategyMgr__unknown<A0>* calc(JAISoundID);
|
||||
virtual void virtual4(JAISoundStrategyMgr__unknown<A0>*);
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAISoundActivity {
|
||||
public:
|
||||
void init() { field_0x0.value = 0; }
|
||||
|
||||
/* 0x0 */ union {
|
||||
u8 value;
|
||||
struct {
|
||||
u8 flag1 : 1;
|
||||
u8 flag2 : 1;
|
||||
u8 flag3 : 1;
|
||||
u8 flag4 : 1;
|
||||
u8 flag5 : 1;
|
||||
u8 flag6 : 1;
|
||||
u8 flag7 : 1;
|
||||
u8 flag8 : 1;
|
||||
} flags;
|
||||
} field_0x0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAITempoMgr {
|
||||
public:
|
||||
/* 0x00 */ f32 tempo_;
|
||||
/* 0x04 */ JAISoundParamsTransition::TTransition transition_;
|
||||
|
||||
JAITempoMgr() { init(); }
|
||||
void init() { setTempo(1.0f); }
|
||||
void setTempo(f32 tempo) {
|
||||
tempo_ = tempo;
|
||||
transition_.zero();
|
||||
}
|
||||
f32 getTempo() const { return tempo_; }
|
||||
void calc() { tempo_ = transition_.apply(tempo_); }
|
||||
};
|
||||
|
||||
class JAISoundHandle;
|
||||
class JAIAudible;
|
||||
struct JAIAudience;
|
||||
class JAISe;
|
||||
class JAISeq;
|
||||
struct JAISoundChild;
|
||||
class JAIStream;
|
||||
class JAITempoMgr;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAISound {
|
||||
public:
|
||||
void releaseHandle();
|
||||
void attachHandle(JAISoundHandle* handle);
|
||||
JAISound();
|
||||
void start_JAISound_(JAISoundID id, const JGeometry::TVec3<f32>* posPtr, JAIAudience* audience);
|
||||
bool acceptsNewAudible() const;
|
||||
void newAudible(const JGeometry::TVec3<f32>&, JGeometry::TVec3<f32> const*, u32,
|
||||
JAIAudience*);
|
||||
void stop();
|
||||
void stop(u32 fadeTime);
|
||||
void die_JAISound_();
|
||||
void increasePrepareCount_JAISound_();
|
||||
bool calc_JAISound_();
|
||||
void initTrack_JAISound_(JASTrack* track);
|
||||
|
||||
virtual s32 getNumChild() const = 0;
|
||||
virtual JAISoundChild* getChild(int) = 0;
|
||||
virtual void releaseChild(int) = 0;
|
||||
virtual JAISe* asSe();
|
||||
virtual JAISeq* asSeq();
|
||||
virtual JAIStream* asStream();
|
||||
virtual JASTrack* getTrack() = 0;
|
||||
virtual JASTrack* getChildTrack(int) = 0;
|
||||
virtual JAITempoMgr* getTempoMgr() = 0;
|
||||
virtual bool JAISound_tryDie_() = 0;
|
||||
|
||||
JAISoundID getID() const { return soundID_; }
|
||||
u32 getAnimationState() const { return status_.state.flags.animationState; }
|
||||
bool isAnimated() const { return getAnimationState() != 0; }
|
||||
void setAnimationState(u32 state) {
|
||||
status_.state.flags.animationState = state;
|
||||
}
|
||||
uintptr_t getUserData() const { return status_.userdata_; }
|
||||
void setUserData(uintptr_t userData) { status_.userdata_ = userData; }
|
||||
JAIAudible* getAudible() { return audible_; }
|
||||
bool isHandleAttached() const { return handle_ != NULL; }
|
||||
bool hasLifeTime() const { return status_.field_0x1.flags.flag2; }
|
||||
|
||||
void removeLifeTime_() {
|
||||
status_.field_0x1.flags.flag1 = false;
|
||||
status_.field_0x1.flags.flag2 = 0;
|
||||
}
|
||||
|
||||
bool isPrepared() const { return status_.isPrepared(); }
|
||||
void unlockIfLocked() { status_.unlockIfLocked(); }
|
||||
void lockWhenPrepared() { status_.lockWhenPrepared(); }
|
||||
void stop_JAISound_() {
|
||||
status_.state.flags.flag5 = 0;
|
||||
status_.state.flags.flag1 = 1;
|
||||
}
|
||||
|
||||
bool isStopping() const {
|
||||
return status_.state.flags.flag1 && (!status_.state.flags.flag5 || fader_.isOut());
|
||||
}
|
||||
|
||||
void pause(bool param_0) {
|
||||
status_.field_0x0.flags.paused = param_0;
|
||||
}
|
||||
|
||||
void updateLifeTime(u32 lifeTime) {
|
||||
if (lifeTime > lifeTime_) {
|
||||
lifeTime_ = lifeTime;
|
||||
}
|
||||
}
|
||||
|
||||
void setLifeTime(u32 lifeTime, bool param_1) {
|
||||
JUT_ASSERT(333, status_.state.flags.calcedOnce == 0);
|
||||
lifeTime_ = lifeTime;
|
||||
setComesBack(param_1);
|
||||
status_.field_0x1.flags.flag2 = 1;
|
||||
}
|
||||
|
||||
void setComesBack(bool param_0) {
|
||||
JUT_ASSERT(354, status_.state.flags.calcedOnce == 0);
|
||||
status_.field_0x1.flags.flag1 = 1;
|
||||
if (param_0) {
|
||||
status_.pauseWhenOut();
|
||||
}
|
||||
}
|
||||
|
||||
bool setPos(const JGeometry::TVec3<f32>& pos) {
|
||||
if (audible_ != NULL) {
|
||||
audible_->setPos(pos);
|
||||
}
|
||||
return audible_ != NULL;
|
||||
}
|
||||
|
||||
JAISoundFader* getFader() const { return (JAISoundFader*)&fader_; }
|
||||
void fadeIn(u32 maxSteps) { fader_.fadeInFromOut(maxSteps); }
|
||||
void fadeOut(u32 maxSteps) { fader_.fadeOut(maxSteps); }
|
||||
|
||||
JAISoundParamsProperty& getProperty() { return params_.property_; }
|
||||
|
||||
s32 getCount() const { return count_; }
|
||||
|
||||
JAISoundParamsMove& getAuxiliary() { return params_.move_; }
|
||||
|
||||
/* 0x04 */ JAISoundHandle* handle_;
|
||||
/* 0x08 */ JAIAudible* audible_;
|
||||
/* 0x0C */ JAIAudience* audience_;
|
||||
/* 0x10 */ u32 lifeTime_;
|
||||
/* 0x14 */ s32 prepareCount_;
|
||||
/* 0x18 */ JAISoundID soundID_;
|
||||
/* 0x1C */ JAISoundStatus_ status_;
|
||||
/* 0x24 */ JAISoundFader fader_;
|
||||
/* 0x34 */ u32 priority_;
|
||||
/* 0x38 */ s32 count_;
|
||||
/* 0x3C */ JAISoundParams params_;
|
||||
}; // Size: 0x98
|
||||
|
||||
STATIC_ASSERT(sizeof(JAISound) == 0x98);
|
||||
|
||||
#endif /* JAISOUND_H */
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef JAISOUNDCHILD_H
|
||||
#define JAISOUNDCHILD_H
|
||||
|
||||
#include "JSystem/JAudio2/JAISoundParams.h"
|
||||
#include "JSystem/JAudio2/JASHeapCtrl.h"
|
||||
|
||||
struct JASTrack;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAISoundChild : JASPoolAllocObject<JAISoundChild> {
|
||||
void init();
|
||||
void mixOut(JASTrack*);
|
||||
void calc();
|
||||
|
||||
JAISoundChild() { init(); }
|
||||
|
||||
/* 0x00 */ JAISoundParamsMove mMove;
|
||||
/* 0x50 */ JASSoundParams mParams;
|
||||
}; // Size: 0x64
|
||||
|
||||
#endif /* JAISOUNDCHILD_H */
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef JAISOUNDHANDLES_H
|
||||
#define JAISOUNDHANDLES_H
|
||||
|
||||
#include "JSystem/JAudio2/JAISound.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
|
||||
class JAISound;
|
||||
class JAISoundID;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAISoundHandles {
|
||||
public:
|
||||
JAISoundHandles(JAISoundHandle* handle, int handleNum) {
|
||||
handle_ = handle;
|
||||
numHandles_ = handleNum;
|
||||
};
|
||||
|
||||
JAISoundHandle& operator[](int n) { return handle_[n]; }
|
||||
|
||||
JAISoundHandle* getHandleSoundID(JAISoundID id);
|
||||
JAISoundHandle* getFreeHandle();
|
||||
|
||||
private:
|
||||
JAISoundHandle* handle_;
|
||||
int numHandles_;
|
||||
};
|
||||
|
||||
#endif /* JAISOUNDHANDLES_H */
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef JAISOUNDINFO_H
|
||||
#define JAISOUNDINFO_H
|
||||
|
||||
#include "JSystem/JAudio2/JAISound.h"
|
||||
#include "JSystem/JAudio2/JASGadget.h"
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAISoundInfo : public JASGlobalInstance<JAISoundInfo> {
|
||||
JAISoundInfo(bool);
|
||||
virtual int getSoundType(JAISoundID) const = 0;
|
||||
virtual int getCategory(JAISoundID) const = 0;
|
||||
virtual u32 getPriority(JAISoundID) const = 0;
|
||||
virtual void getSeInfo(JAISoundID, JAISe*) const = 0;
|
||||
virtual void getSeqInfo(JAISoundID, JAISeq*) const = 0;
|
||||
virtual void getStreamInfo(JAISoundID, JAIStream*) const = 0;
|
||||
virtual ~JAISoundInfo();
|
||||
};
|
||||
|
||||
#endif /* JAISOUNDINFO_H */
|
||||
@@ -0,0 +1,122 @@
|
||||
#ifndef JAISOUNDPARAMS_H
|
||||
#define JAISOUNDPARAMS_H
|
||||
|
||||
#include "JSystem/JAudio2/JASSoundParams.h"
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAISoundParamsProperty {
|
||||
void init() {
|
||||
field_0x0 = 1.0f;
|
||||
field_0x4 = 0.0f;
|
||||
field_0x8 = 1.0f;
|
||||
}
|
||||
|
||||
/* 0x00 */ f32 field_0x0;
|
||||
/* 0x04 */ f32 field_0x4;
|
||||
/* 0x08 */ f32 field_0x8;
|
||||
}; // Size: 0xC
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAISoundParamsTransition {
|
||||
struct TTransition {
|
||||
void zero() {
|
||||
step_ = 0.0f;
|
||||
remainingSteps_ = 0;
|
||||
targetValue_ = 0.0f;
|
||||
}
|
||||
|
||||
void set(f32 newValue, f32 currentValue, u32 maxSteps) {
|
||||
remainingSteps_ = maxSteps;
|
||||
step_ = (newValue - currentValue) / remainingSteps_;
|
||||
targetValue_ = newValue;
|
||||
}
|
||||
|
||||
f32 apply(f32 value) {
|
||||
if (remainingSteps_ > 1) {
|
||||
remainingSteps_--;
|
||||
value += step_;
|
||||
} else {
|
||||
if (remainingSteps_ == 1) {
|
||||
remainingSteps_ = 0;
|
||||
value = targetValue_;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/* 0x0 */ f32 step_;
|
||||
/* 0x4 */ f32 targetValue_;
|
||||
/* 0x8 */ u32 remainingSteps_;
|
||||
}; // Size: 0xC
|
||||
|
||||
void init() {
|
||||
volume_.zero();
|
||||
pitch_.zero();
|
||||
fxMix_.zero();
|
||||
pan_.zero();
|
||||
dolby_.zero();
|
||||
}
|
||||
|
||||
void apply(JASSoundParams* params) {
|
||||
params->mVolume = volume_.apply(params->mVolume);
|
||||
params->mPitch = pitch_.apply(params->mPitch);
|
||||
params->mFxMix = fxMix_.apply(params->mFxMix);
|
||||
params->mDolby = dolby_.apply(params->mDolby);
|
||||
params->mPan = pan_.apply(params->mPan);
|
||||
}
|
||||
|
||||
/* 0x00 */ TTransition volume_;
|
||||
/* 0x0C */ TTransition pitch_;
|
||||
/* 0x18 */ TTransition fxMix_;
|
||||
/* 0x24 */ TTransition pan_;
|
||||
/* 0x30 */ TTransition dolby_;
|
||||
}; // Size: 0x3C
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAISoundParamsMove {
|
||||
JAISoundParamsMove() : params_() {}
|
||||
|
||||
void init() {
|
||||
params_.init();
|
||||
transition_.init();
|
||||
}
|
||||
|
||||
void calc() { transition_.apply(¶ms_); }
|
||||
|
||||
void moveVolume(f32 newValue, u32 maxSteps);
|
||||
void movePitch(f32 newValue, u32 maxSteps);
|
||||
void moveFxMix(f32 newValue, u32 maxSteps);
|
||||
void movePan(f32 newValue, u32 maxSteps);
|
||||
void moveDolby(f32 newValue, u32 maxSteps);
|
||||
|
||||
/* 0x00 */ JASSoundParams params_;
|
||||
/* 0x14 */ JAISoundParamsTransition transition_;
|
||||
}; // Size: 0x50
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAISoundParams {
|
||||
JAISoundParams() : move_() {}
|
||||
void mixOutAll(const JASSoundParams& inParams, JASSoundParams* outParams, f32);
|
||||
|
||||
void init() {
|
||||
move_.init();
|
||||
property_.init();
|
||||
}
|
||||
|
||||
/* 0x0 */ JAISoundParamsProperty property_;
|
||||
/* 0xC */ JAISoundParamsMove move_;
|
||||
}; // Size: 0x5C
|
||||
|
||||
#endif /* JAISOUNDPARAMS_H */
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef JAISOUNDSTARTER_H
|
||||
#define JAISOUNDSTARTER_H
|
||||
|
||||
#include "JSystem/JAudio2/JAISound.h"
|
||||
#include "JSystem/JAudio2/JASGadget.h"
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAISoundStarter : public JASGlobalInstance<JAISoundStarter> {
|
||||
JAISoundStarter(bool setInstance);
|
||||
|
||||
virtual ~JAISoundStarter();
|
||||
virtual bool startSound(JAISoundID id, JAISoundHandle* handlePtr, const JGeometry::TVec3<f32>* posPtr) = 0;
|
||||
bool startLevelSound(JAISoundID id, JAISoundHandle* handlePtr, const JGeometry::TVec3<f32>* posPtr);
|
||||
};
|
||||
|
||||
#endif /* JAISOUNDSTARTER_H */
|
||||
@@ -0,0 +1,57 @@
|
||||
#ifndef JAISTREAM_H
|
||||
#define JAISTREAM_H
|
||||
|
||||
#include "JSystem/JAudio2/JAISound.h"
|
||||
#include "JSystem/JAudio2/JASAramStream.h"
|
||||
#include "JSystem/JSupport/JSUList.h"
|
||||
|
||||
class JAIStreamMgr;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAIStream : public JAISound, public JSULink<JAIStream>, public JASPoolAllocObject<JAIStream> {
|
||||
public:
|
||||
struct TInner {
|
||||
JASAramStream aramStream_;
|
||||
};
|
||||
|
||||
JAIStream(JAIStreamMgr* streamMgr, JAISoundStrategyMgr<JAIStream>* soundStrategyMgr);
|
||||
void JAIStreamMgr_startID_(JAISoundID id, s32 streamFileEntry,
|
||||
const JGeometry::TVec3<f32>* posPtr, JAIAudience* audience,
|
||||
int category);
|
||||
bool prepare_prepareStream_();
|
||||
void prepare_();
|
||||
void prepare_startStream_();
|
||||
void JAIStreamMgr_mixOut_(const JASSoundParams& inParams, JAISoundActivity activity);
|
||||
void die_JAIStream_();
|
||||
bool JAISound_tryDie_();
|
||||
void JAIStreamMgr_calc_();
|
||||
s32 getNumChild() const;
|
||||
JAISoundChild* getChild(int index);
|
||||
void releaseChild(int index);
|
||||
JASTrack* getTrack();
|
||||
JASTrack* getChildTrack(int);
|
||||
JAIStream* asStream();
|
||||
JAITempoMgr* getTempoMgr();
|
||||
|
||||
void* JAIStreamMgr_getAramAddr_() const { return streamAramAddr_; }
|
||||
|
||||
static const int NUM_CHILDREN = 6;
|
||||
|
||||
/* 0x0A8 */ TInner inner_;
|
||||
/* 0x290 */ int field_0x290;
|
||||
/* 0x294 */ s32 field_0x294;
|
||||
/* 0x298 */ int field_0x298;
|
||||
/* 0x29C */ void* streamAramAddr_;
|
||||
/* 0x2A0 */ JAISoundChild* children_[NUM_CHILDREN];
|
||||
/* 0x2B8 */ JAIStreamMgr* streamMgr_;
|
||||
/* 0x2BC */ JAISoundStrategyMgr__unknown<JAIStream>* field_0x2bc;
|
||||
/* 0x2C0 */ JAISoundStrategyMgr<JAIStream>* field_0x2c0;
|
||||
/* 0x2C4 */ bool field_0x2c4;
|
||||
/* 0x2C5 */ u8 field_0x2c5;
|
||||
/* 0x2C6 */ u8 field_0x2c6;
|
||||
};
|
||||
|
||||
#endif /* JAISTREAM_H */
|
||||
@@ -0,0 +1,25 @@
|
||||
#ifndef JAISTREAMDATAMGR_H
|
||||
#define JAISTREAMDATAMGR_H
|
||||
|
||||
#include "JSystem/JAudio2/JAISound.h"
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAIStreamDataMgr {
|
||||
virtual s32 getStreamFileEntry(JAISoundID) = 0;
|
||||
virtual ~JAIStreamDataMgr();
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAIStreamAramMgr {
|
||||
virtual void* newStreamAram(u32*) = 0;
|
||||
virtual bool deleteStreamAram(u32) = 0;
|
||||
virtual ~JAIStreamAramMgr();
|
||||
};
|
||||
|
||||
#endif /* JAISTREAMDATAMGR_H */
|
||||
@@ -0,0 +1,55 @@
|
||||
#ifndef JAISTREAMMGR_H
|
||||
#define JAISTREAMMGR_H
|
||||
|
||||
#include "JSystem/JAudio2/JASGadget.h"
|
||||
#include "JSystem/JAudio2/JAIStream.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
|
||||
class JAIStreamAramMgr;
|
||||
struct JAIStreamDataMgr;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAIStreamMgr : public JASGlobalInstance<JAIStreamMgr> {
|
||||
public:
|
||||
JAIStreamMgr(bool setInstance);
|
||||
bool startSound(JAISoundID id, JAISoundHandle* handle, const JGeometry::TVec3<f32>* posPtr);
|
||||
void freeDeadStream_();
|
||||
void calc();
|
||||
void stop();
|
||||
void stop(u32 fadeTime);
|
||||
void stopSoundID(JAISoundID id);
|
||||
void mixOut();
|
||||
JAIStream* newStream_();
|
||||
bool isActive() const { return mStreamList.getNumLinks() != 0; }
|
||||
|
||||
JAIAudience* getAudience() { return mAudience; }
|
||||
JAISoundParamsMove* getParams() { return &mParams; }
|
||||
JAIStreamAramMgr* getStreamAramMgr() { return mStreamAramMgr; }
|
||||
JSUList<JAIStream>* getStreamList() { return &mStreamList; }
|
||||
|
||||
void setStreamDataMgr(JAIStreamDataMgr* streamDataMgr) {
|
||||
JUT_ASSERT(139, !isActive());
|
||||
streamDataMgr_ = streamDataMgr;
|
||||
}
|
||||
|
||||
void setStreamAramMgr(JAIStreamAramMgr* streamDataMgr) {
|
||||
JUT_ASSERT(157, !isActive());
|
||||
mStreamAramMgr = streamDataMgr;
|
||||
}
|
||||
|
||||
void pause(bool paused) { mActivity.field_0x0.flags.flag2 = paused; }
|
||||
|
||||
private:
|
||||
/* 0x00 */ JAISoundActivity mActivity;
|
||||
/* 0x04 */ JAISoundParamsMove mParams;
|
||||
/* 0x54 */ JAIAudience* mAudience;
|
||||
/* 0x58 */ JSUList<JAIStream> mStreamList;
|
||||
/* 0x64 */ JAIStreamDataMgr* streamDataMgr_;
|
||||
/* 0x68 */ JAIStreamAramMgr* mStreamAramMgr;
|
||||
/* 0x6C */ JAISoundStrategyMgr<JAIStream>* field_0x6c;
|
||||
}; // Size: 0x70
|
||||
|
||||
#endif /* JAISTREAMMGR_H */
|
||||
@@ -0,0 +1,61 @@
|
||||
#ifndef JASAICTRL_H
|
||||
#define JASAICTRL_H
|
||||
|
||||
#include <types.h>
|
||||
|
||||
enum JASOutputRate {
|
||||
OUTPUT_RATE_0,
|
||||
};
|
||||
|
||||
enum JASMixMode {
|
||||
MIX_MODE_MONO,
|
||||
MIX_MODE_MONO_WIDE,
|
||||
MIX_MODE_EXTRA,
|
||||
MIX_MODE_INTERLEAVE,
|
||||
};
|
||||
|
||||
namespace JASDriver {
|
||||
typedef s16* (*MixCallback)(s32);
|
||||
typedef void (*MixFunc)(s16*, u32, MixCallback);
|
||||
typedef void (*DSPBufCallback)(s16*, u32);
|
||||
|
||||
void initAI(void (*)(void));
|
||||
void startDMA();
|
||||
void stopDMA();
|
||||
void setOutputRate(JASOutputRate);
|
||||
void updateDac();
|
||||
void updateDSP();
|
||||
void readDspBuffer(s16*, u32);
|
||||
void finishDSPFrame();
|
||||
void registerMixCallback(MixCallback, JASMixMode);
|
||||
void registDSPBufCallback(DSPBufCallback);
|
||||
f32 getDacRate();
|
||||
u32 getSubFrames();
|
||||
u32 getDacSize();
|
||||
u32 getFrameSamples();
|
||||
void mixMonoTrack(s16*, u32, MixCallback);
|
||||
void mixMonoTrackWide(s16*, u32, MixCallback);
|
||||
void mixExtraTrack(s16*, u32, MixCallback);
|
||||
void mixInterleaveTrack(s16*, u32, MixCallback);
|
||||
u32 getSubFrameCounter();
|
||||
void subframeCallback();
|
||||
void DSPSyncCallback();
|
||||
|
||||
extern const MixFunc sMixFuncs[4];
|
||||
extern s16* sDmaDacBuffer[3];
|
||||
extern JASMixMode sMixMode;
|
||||
extern f32 sDacRate;
|
||||
extern u32 sSubFrames;
|
||||
extern s16** sDspDacBuffer;
|
||||
extern s32 sDspDacWriteBuffer;
|
||||
extern s32 sDspDacReadBuffer;
|
||||
extern s32 sDspStatus;
|
||||
extern DSPBufCallback sDspDacCallback;
|
||||
extern s16* lastRspMadep;
|
||||
extern void (*dacCallbackFunc)(s16*, u32);
|
||||
extern MixCallback extMixCallback;
|
||||
extern u32 sOutputRate;
|
||||
extern u32 sSubFrameCounter;
|
||||
};
|
||||
|
||||
#endif /* JASAICTRL_H */
|
||||
@@ -0,0 +1,188 @@
|
||||
#ifndef JASARAMSTREAM_H
|
||||
#define JASARAMSTREAM_H
|
||||
|
||||
#include "JSystem/JAudio2/JASTaskThread.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include <dvd.h>
|
||||
|
||||
class JASChannel;
|
||||
|
||||
namespace JASDsp {
|
||||
struct TChannel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JASAramStream {
|
||||
public:
|
||||
typedef void (*StreamCallback)(u32, JASAramStream*, void*);
|
||||
|
||||
enum CallbackType {
|
||||
/* 0 */ CB_START,
|
||||
/* 1 */ CB_STOP,
|
||||
};
|
||||
|
||||
// Used internally for passing data to task functions
|
||||
struct TaskData {
|
||||
/* 0x0 */ JASAramStream* stream;
|
||||
/* 0x4 */ u32 field_0x4;
|
||||
/* 0x8 */ int field_0x8;
|
||||
};
|
||||
|
||||
struct Header {
|
||||
/* 0x00 */ u32 tag;
|
||||
/* 0x04 */ u8 field_0x4[5];
|
||||
/* 0x09 */ u8 format;
|
||||
/* 0x0A */ u8 bits;
|
||||
/* 0x0C */ u16 channels;
|
||||
/* 0x0E */ u16 loop;
|
||||
/* 0x10 */ int field_0x10;
|
||||
/* 0x14 */ u8 field_0x14[4];
|
||||
/* 0x18 */ int loop_start;
|
||||
/* 0x1C */ int loop_end;
|
||||
/* 0x20 */ u32 block_size;
|
||||
/* 0x24 */ u8 field_0x24[4];
|
||||
/* 0x28 */ u8 field_0x28;
|
||||
/* 0x29 */ u8 field_0x29[0x17];
|
||||
}; // Size: 0x40
|
||||
|
||||
struct BlockHeader {
|
||||
/* 0x00 */ u32 tag;
|
||||
/* 0x04 */ u32 field_0x4;
|
||||
/* 0x08 */ struct {
|
||||
s16 field_0x0;
|
||||
s16 field_0x2;
|
||||
} field_0x8[6];
|
||||
}; // Size: 0x20
|
||||
|
||||
static void initSystem(u32, u32);
|
||||
JASAramStream();
|
||||
void init(u32, u32, StreamCallback, void*);
|
||||
bool prepare(s32, int);
|
||||
bool start();
|
||||
bool stop(u16);
|
||||
bool pause(bool);
|
||||
bool cancel();
|
||||
u32 getBlockSamples() const;
|
||||
static void headerLoadTask(void*);
|
||||
static void firstLoadTask(void*);
|
||||
static void loadToAramTask(void*);
|
||||
static void finishTask(void*);
|
||||
static void prepareFinishTask(void*);
|
||||
bool headerLoad(u32, int);
|
||||
bool load();
|
||||
static s32 channelProcCallback(void*);
|
||||
static s32 dvdErrorCheck(void*);
|
||||
static void channelCallback(u32, JASChannel*, JASDsp::TChannel*, void*);
|
||||
void updateChannel(u32, JASChannel*, JASDsp::TChannel*);
|
||||
s32 channelProc();
|
||||
void channelStart();
|
||||
void channelStop(u16);
|
||||
|
||||
void setPitch(f32 pitch) { mPitch = pitch; }
|
||||
void setVolume(f32 volume) {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
mChannelVolume[i] = volume;
|
||||
}
|
||||
}
|
||||
|
||||
void setPan(f32 pan) {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
mChannelPan[i] = pan;
|
||||
}
|
||||
}
|
||||
|
||||
void setFxmix(f32 fxMix) {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
mChannelFxMix[i] = fxMix;
|
||||
}
|
||||
}
|
||||
|
||||
void setDolby(f32 dolby) {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
mChannelDolby[i] = dolby;
|
||||
}
|
||||
}
|
||||
|
||||
void setChannelVolume(int channel, f32 volume) {
|
||||
JUT_ASSERT(290, channel < CHANNEL_MAX);
|
||||
mChannelVolume[channel] = volume;
|
||||
}
|
||||
|
||||
void setChannelPan(int channel, f32 pan) {
|
||||
JUT_ASSERT(296, channel < CHANNEL_MAX);
|
||||
mChannelPan[channel] = pan;
|
||||
}
|
||||
|
||||
void setChannelFxmix(int channel, f32 fxMix) {
|
||||
JUT_ASSERT(302, channel < CHANNEL_MAX);
|
||||
mChannelFxMix[channel] = fxMix;
|
||||
}
|
||||
|
||||
void setChannelDolby(int channel, f32 dolby) {
|
||||
JUT_ASSERT(308, channel < CHANNEL_MAX);
|
||||
mChannelDolby[channel] = dolby;
|
||||
}
|
||||
|
||||
static u32 getBlockSize() { return sBlockSize; }
|
||||
|
||||
static const int CHANNEL_MAX = 6;
|
||||
|
||||
/* 0x000 */ OSMessageQueue field_0x000;
|
||||
/* 0x020 */ OSMessageQueue field_0x020;
|
||||
/* 0x040 */ void* field_0x040[16];
|
||||
/* 0x080 */ void* field_0x080[4];
|
||||
/* 0x090 */ JASChannel* mChannels[CHANNEL_MAX];
|
||||
/* 0x0A8 */ JASChannel* field_0x0a8;
|
||||
/* 0x0AC */ bool field_0x0ac;
|
||||
/* 0x0AD */ bool field_0x0ad;
|
||||
/* 0x0AE */ u8 field_0x0ae;
|
||||
/* 0x0B0 */ int field_0x0b0;
|
||||
/* 0x0B4 */ int field_0x0b4;
|
||||
/* 0x0B8 */ u32 field_0x0b8;
|
||||
/* 0x0BC */ int field_0x0bc;
|
||||
/* 0x0C0 */ bool field_0x0c0;
|
||||
/* 0x0C4 */ volatile u32 field_0x0c4;
|
||||
/* 0x0C8 */ volatile f32 field_0x0c8;
|
||||
/* 0x0CC */ DVDFileInfo mDvdFileInfo;
|
||||
/* 0x108 */ u32 field_0x108;
|
||||
/* 0x10C */ int field_0x10c;
|
||||
/* 0x110 */ u32 mBlock;
|
||||
/* 0x114 */ u8 field_0x114;
|
||||
/* 0x118 */ u32 field_0x118;
|
||||
/* 0x11C */ int field_0x11c;
|
||||
/* 0x120 */ int field_0x120;
|
||||
/* 0x124 */ int field_0x124;
|
||||
/* 0x128 */ u16 field_0x128;
|
||||
/* 0x12C */ int field_0x12c;
|
||||
/* 0x130 */ s16 field_0x130[CHANNEL_MAX];
|
||||
/* 0x13C */ s16 field_0x13c[CHANNEL_MAX];
|
||||
/* 0x148 */ int field_0x148;
|
||||
/* 0x14C */ u32 field_0x14c;
|
||||
/* 0x150 */ StreamCallback mCallback;
|
||||
/* 0x154 */ void* mCallbackData;
|
||||
/* 0x158 */ u16 field_0x158;
|
||||
/* 0x15A */ u16 mChannelNum;
|
||||
/* 0x15C */ u32 mBufCount;
|
||||
/* 0x160 */ u32 field_0x160;
|
||||
/* 0x164 */ u32 field_0x164;
|
||||
/* 0x168 */ bool mLoop;
|
||||
/* 0x16C */ u32 mLoopStart;
|
||||
/* 0x170 */ u32 mLoopEnd;
|
||||
/* 0x174 */ f32 mVolume;
|
||||
/* 0x178 */ f32 mPitch;
|
||||
/* 0x17C */ f32 mChannelVolume[CHANNEL_MAX];
|
||||
/* 0x194 */ f32 mChannelPan[CHANNEL_MAX];
|
||||
/* 0x1AC */ f32 mChannelFxMix[CHANNEL_MAX];
|
||||
/* 0x1C4 */ f32 mChannelDolby[CHANNEL_MAX];
|
||||
/* 0x1DC */ u16 field_0x1dc[CHANNEL_MAX];
|
||||
|
||||
static JASTaskThread* sLoadThread;
|
||||
static u8* sReadBuffer;
|
||||
static u32 sBlockSize;
|
||||
static u32 sChannelMax;
|
||||
};
|
||||
|
||||
#endif /* JASARAMSTREAM_H */
|
||||
@@ -0,0 +1,25 @@
|
||||
#ifndef JASAUDIORESETER_H
|
||||
#define JASAUDIORESETER_H
|
||||
|
||||
#include <types.h>
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JASAudioReseter {
|
||||
JASAudioReseter();
|
||||
~JASAudioReseter();
|
||||
bool start(u32, bool);
|
||||
void resume();
|
||||
s32 checkDone() const;
|
||||
s32 calc();
|
||||
static s32 callback(void*);
|
||||
|
||||
/* 0x0 */ u32 field_0x0;
|
||||
/* 0x4 */ f32 mDSPLevel;
|
||||
/* 0x8 */ s32 mDoneFlag;
|
||||
/* 0xC */ bool mThreadStopFlag;
|
||||
}; // Size: 0x10
|
||||
|
||||
#endif /* JASAUDIORESETER_H */
|
||||
@@ -0,0 +1,42 @@
|
||||
#ifndef JASAUDIOTHREAD_H
|
||||
#define JASAUDIOTHREAD_H
|
||||
|
||||
#include "JSystem/JAudio2/JASGadget.h"
|
||||
#include "JSystem/JKernel/JKRThread.h"
|
||||
|
||||
enum JASAudioMessage {
|
||||
AUDIOMSG_DMA = 0,
|
||||
AUDIOMSG_DSP = 1,
|
||||
AUDIOMSG_STOP = 2,
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JASAudioThread : public JKRThread, public JASGlobalInstance<JASAudioThread> {
|
||||
JASAudioThread(int, int, u32);
|
||||
static void create(s32);
|
||||
void stop();
|
||||
virtual void* run();
|
||||
static void DMACallback();
|
||||
static void DSPCallback(void*);
|
||||
virtual ~JASAudioThread() {}
|
||||
|
||||
static JASAudioThread* getThreadPointer() { return getInstance(); }
|
||||
static int getDSPSyncCount() { return snIntCount; }
|
||||
static void setDSPSyncCount(u32 param_0) { snIntCount = param_0; }
|
||||
|
||||
/* 0x7c */ OSThreadQueue sThreadQueue;
|
||||
/* 0x84 */ bool sbPauseFlag; // type unsure
|
||||
|
||||
static volatile int snIntCount; // type unsure
|
||||
|
||||
#if TARGET_PC
|
||||
static bool sThreadInitComplete;
|
||||
static OSMutex sThreadInitCompleteMutex;
|
||||
static OSCond sThreadInitCompleteCond;
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif /* JASAUDIOTHREAD_H */
|
||||
@@ -0,0 +1,144 @@
|
||||
#ifndef JASBNKPARSER_H
|
||||
#define JASBNKPARSER_H
|
||||
|
||||
#include "JSystem/JAudio2/JASOscillator.h"
|
||||
#include "JSystem/JSupport/JSupport.h"
|
||||
|
||||
class JASBank;
|
||||
class JASBasicBank;
|
||||
class JKRHeap;
|
||||
|
||||
namespace JASBNKParser {
|
||||
struct TFileHeader {
|
||||
/* 0x0 */ BE(int) id;
|
||||
/* 0x4 */ BE(u32) mSize;
|
||||
/* 0x8 */ u8 _08[4];
|
||||
/* 0xC */ BE(u32) mVersion;
|
||||
};
|
||||
|
||||
namespace Ver1 {
|
||||
struct TOsc {
|
||||
/* 0x00 */ BE(u32) id;
|
||||
/* 0x04 */ u8 mTarget;
|
||||
/* 0x08 */ BE(f32) _08;
|
||||
/* 0x0C */ BE(u32) mTableOffset;
|
||||
/* 0x10 */ BE(u32) _10;
|
||||
/* 0x14 */ BE(f32) mScale;
|
||||
/* 0x18 */ BE(f32) _18;
|
||||
};
|
||||
|
||||
struct TPercData {
|
||||
/* 0x00 */ BE(f32) mVolume;
|
||||
/* 0x04 */ BE(f32) mPitch;
|
||||
/* 0x08 */ u8 mPan;
|
||||
/* 0x0A */ BE(u16) mRelease;
|
||||
/* 0x0C */ BE(u32) field_0xc;
|
||||
};
|
||||
|
||||
struct TChunk {
|
||||
/* 0x0 */ BE(u32) mID;
|
||||
/* 0x4 */ BE(u32) mSize;
|
||||
};
|
||||
|
||||
struct TEnvtChunk : TChunk {
|
||||
/* 0x8 */ u8 mData[0];
|
||||
};
|
||||
|
||||
struct TOscChunk : TChunk {
|
||||
/* 0x8 */ BE(u32) mCount;
|
||||
/* 0xC */ TOsc mOsc[0];
|
||||
};
|
||||
|
||||
struct TListChunk : TChunk {
|
||||
/* 0x8 */ BE(u32) count;
|
||||
/* 0xC */ BE(u32) mOffsets[0];
|
||||
};
|
||||
|
||||
TChunk* findChunk(void const*, u32);
|
||||
JASBasicBank* createBasicBank(void const*, JKRHeap*);
|
||||
};
|
||||
|
||||
namespace Ver0 {
|
||||
template<typename T>
|
||||
struct TOffset {
|
||||
/* 0x0 */ u32 offset;
|
||||
T* ptr(void const* stream) const { return JSUConvertOffsetToPtr<T>(stream, offset); }
|
||||
};
|
||||
|
||||
struct TOsc {
|
||||
/* 0x00 */ u8 mTarget;
|
||||
/* 0x04 */ BE(f32) field_0x4;
|
||||
/* 0x08 */ TOffset<JASOscillator::Point> mPointOffset;
|
||||
/* 0x0C */ TOffset<JASOscillator::Point> field_0xc;
|
||||
/* 0x10 */ BE(f32) mScale;
|
||||
/* 0x14 */ BE(f32) field_0x14;
|
||||
};
|
||||
|
||||
struct TVmap {
|
||||
/* 0x00 */ u8 field_0x0[4];
|
||||
/* 0x04 */ BE(u32) field_0x4;
|
||||
/* 0x08 */ BE(f32) field_0x8;
|
||||
/* 0x0C */ BE(f32) field_0xc;
|
||||
};
|
||||
|
||||
struct TKeymap {
|
||||
/* 0x00 */ u8 mHighKey;
|
||||
/* 0x01 */ u8 field_0x1[7];
|
||||
/* 0x08 */ TOffset<TVmap> mVmapOffset;
|
||||
};
|
||||
|
||||
struct TInst {
|
||||
/* 0x00 */ u8 field_0x0[8];
|
||||
/* 0x08 */ BE(f32) mVolume;
|
||||
/* 0x0C */ BE(f32) mPitch;
|
||||
/* 0x10 */ TOffset<TOsc> mOscOffset[2];
|
||||
/* 0x18 */ u8 field_0x18[0x10];
|
||||
/* 0x28 */ BE(u32) mKeyRegionCount;
|
||||
/* 0x2C */ TOffset<TKeymap> mKeymapOffset[0];
|
||||
};
|
||||
|
||||
struct TPmap {
|
||||
/* 0x00 */ BE(f32) mVolume;
|
||||
/* 0x04 */ BE(f32) mPitch;
|
||||
/* 0x08 */ u8 field_0x8[0xc];
|
||||
/* 0x14 */ TOffset<TVmap> mVmapOffset;
|
||||
};
|
||||
|
||||
struct TPerc {
|
||||
/* 0x000 */ BE(u32) mMagic;
|
||||
/* 0x000 */ u8 field_0x0[0x84];
|
||||
/* 0x088 */ TOffset<TPmap> mPmapOffset[0x80];
|
||||
/* 0x288 */ s8 mPan[0x80];
|
||||
/* 0x308 */ BE(u16) mRelease[0x80];
|
||||
};
|
||||
|
||||
struct TOffsetData {
|
||||
/* 0x000 */ u8 field_0x20[4];
|
||||
/* 0x004 */ TOffset<TInst> mInstOffset[0x80];
|
||||
/* 0x204 */ u8 field_0x204[0x190];
|
||||
/* 0x394 */ TOffset<TPerc> mPercOffset[12];
|
||||
};
|
||||
|
||||
struct THeader {
|
||||
/* 0x00 */ u8 field_0x0[0x20];
|
||||
/* 0x20 */ TOffsetData mOffsets;
|
||||
};
|
||||
|
||||
JASBasicBank* createBasicBank(void const*, JKRHeap*);
|
||||
JASOscillator::Data* findOscPtr(JASBasicBank*, THeader const*, TOsc const*);
|
||||
JASOscillator::Point const* getOscTableEndPtr(JASOscillator::Point const*);
|
||||
};
|
||||
|
||||
JASBank* createBank(void const*, JKRHeap*);
|
||||
JASBasicBank* createBasicBank(void const*, JKRHeap*);
|
||||
|
||||
inline u32 getBankNumber(const void* param_0) {
|
||||
BE(u32)* ptr = (BE(u32)*)param_0;
|
||||
return ptr[2];
|
||||
}
|
||||
|
||||
extern u32 sUsedHeapSize;
|
||||
};
|
||||
|
||||
|
||||
#endif /* JASBNKPARSER_H */
|
||||
@@ -0,0 +1,39 @@
|
||||
#ifndef JASBANK_H
|
||||
#define JASBANK_H
|
||||
|
||||
#include <types.h>
|
||||
|
||||
class JASChannel;
|
||||
struct JASInstParam;
|
||||
class JASWaveBank;
|
||||
|
||||
namespace JASDsp {
|
||||
struct TChannel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JASBank {
|
||||
public:
|
||||
static const int PRG_OSC = 240;
|
||||
|
||||
JASBank() { mWaveBank = NULL; }
|
||||
virtual ~JASBank() {};
|
||||
virtual bool getInstParam(int, int, int, JASInstParam*) const = 0;
|
||||
virtual u32 getType() const = 0;
|
||||
|
||||
JASWaveBank* getWaveBank() const { return mWaveBank; }
|
||||
void assignWaveBank(JASWaveBank* param_0) { mWaveBank = param_0; }
|
||||
|
||||
static JASChannel* noteOn(JASBank const*, int, u8, u8, u16,
|
||||
void (*)(u32, JASChannel*, JASDsp::TChannel*, void*), void*);
|
||||
static JASChannel* noteOnOsc(int, u8, u8, u16,
|
||||
void (*)(u32, JASChannel*, JASDsp::TChannel*, void*), void*);
|
||||
|
||||
private:
|
||||
/* 0x04 */ JASWaveBank* mWaveBank;
|
||||
};
|
||||
|
||||
#endif /* JASBANK_H */
|
||||
@@ -0,0 +1,17 @@
|
||||
#ifndef JASBANKLIST_H
|
||||
#define JASBANKLIST_H
|
||||
|
||||
#include <types.h>
|
||||
|
||||
class JASBank;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JASBankList {
|
||||
public:
|
||||
virtual const JASBank* getBank(u32 param_0) const = 0;
|
||||
};
|
||||
|
||||
#endif /* JASBANKLIST_H */
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef JASBANKTABLE_H
|
||||
#define JASBANKTABLE_H
|
||||
|
||||
#include "JSystem/JAudio2/JASBankList.h"
|
||||
#include "JSystem/JAudio2/JASGadget.h"
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
template<size_t N>
|
||||
class JASBankTable : public JASBankList {
|
||||
public:
|
||||
JASBank* getBank(u32 param_0) { return mArray.get(param_0); }
|
||||
virtual JASBank* getBank(u32 param_0) const { return mArray.get(param_0); }
|
||||
void registBank(u32 param_0, JASBank* param_1) { mArray.set(param_0, param_1); }
|
||||
|
||||
private:
|
||||
JASPtrArray<JASBank, N> mArray;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JASDefaultBankTable : public JASBankTable<256>, public JASGlobalInstance<JASDefaultBankTable> {
|
||||
public:
|
||||
JASDefaultBankTable() : JASGlobalInstance(true) {}
|
||||
};
|
||||
|
||||
#endif /* JASBANKTABLE_H */
|
||||
@@ -0,0 +1,22 @@
|
||||
#ifndef JASBASICBANK_H
|
||||
#define JASBASICBANK_H
|
||||
|
||||
#include "JSystem/JAudio2/JASBank.h"
|
||||
#include "JSystem/JAudio2/JASBasicInst.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
|
||||
class JASBasicBank : public JASBank {
|
||||
public:
|
||||
JASBasicBank();
|
||||
void newInstTable(u8, JKRHeap*);
|
||||
bool getInstParam(int, int, int, JASInstParam*) const;
|
||||
void setInst(int, JASInst*);
|
||||
JASInst* getInst(int) const;
|
||||
~JASBasicBank() {}
|
||||
u32 getType() const { return 'BSIC'; }
|
||||
|
||||
/* 0x8 */ JASInst** mInstTable;
|
||||
/* 0xC */ u8 mInstNumMax;
|
||||
};
|
||||
|
||||
#endif /* JASBASICBANK_H */
|
||||
@@ -0,0 +1,83 @@
|
||||
#ifndef JASBASICINST_H
|
||||
#define JASBASICINST_H
|
||||
|
||||
#include "JSystem/JAudio2/JASOscillator.h"
|
||||
#include "JSystem/JAudio2/JASSoundParams.h"
|
||||
|
||||
struct JKRHeap;
|
||||
|
||||
const int OSC_MAX = 2;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JASInstParam : public JASSoundParams {
|
||||
JASInstParam() {
|
||||
field_0x14 = NULL;
|
||||
field_0x18 = 0;
|
||||
field_0x1a = 0;
|
||||
field_0x1c = 0;
|
||||
field_0x1d = 0;
|
||||
field_0x1e = 0;
|
||||
}
|
||||
|
||||
JASOscillator::Data** field_0x14;
|
||||
u16 field_0x18;
|
||||
u16 field_0x1a;
|
||||
u8 field_0x1c;
|
||||
u8 field_0x1d;
|
||||
u8 field_0x1e;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JASInst {
|
||||
virtual ~JASInst() {}
|
||||
virtual bool getParam(int, int, JASInstParam*) const = 0;
|
||||
virtual u32 getType() const = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JASBasicInst : public JASInst {
|
||||
struct TKeymap {
|
||||
~TKeymap();
|
||||
TKeymap() { mHighKey = -1; }
|
||||
s32 getHighKey() const { return mHighKey; }
|
||||
void setHighKey(int key) { mHighKey = key; }
|
||||
|
||||
/* 0x0 */ s32 mHighKey;
|
||||
/* 0x4 */ u16 field_0x4;
|
||||
/* 0x6 */ u16 field_0x6;
|
||||
/* 0x8 */ f32 field_0x8;
|
||||
/* 0xC */ f32 field_0xc;
|
||||
};
|
||||
|
||||
JASBasicInst();
|
||||
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;
|
||||
virtual u32 getType() const { return 'BSIC'; };
|
||||
|
||||
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[OSC_MAX];
|
||||
/* 0x10 */ u32 mKeymapCount;
|
||||
/* 0x14 */ TKeymap* mKeymap;
|
||||
};
|
||||
|
||||
|
||||
#endif /* JASBASICINST_H */
|
||||
@@ -0,0 +1,68 @@
|
||||
#ifndef JASBASICWAVEBANK_H
|
||||
#define JASBASICWAVEBANK_H
|
||||
|
||||
#include "JSystem/JAudio2/JASWaveArcLoader.h"
|
||||
#include "JSystem/JAudio2/JASWaveInfo.h"
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JASBasicWaveBank : public JASWaveBank {
|
||||
struct TWaveHandle : public JASWaveHandle {
|
||||
TWaveHandle() { mHeap = NULL; }
|
||||
virtual intptr_t getWavePtr() const;
|
||||
virtual const JASWaveInfo* getWaveInfo() const { return &field_0x4; }
|
||||
bool compareHeap(JASHeap* heap) const { return mHeap == heap;}
|
||||
|
||||
/* 0x04 */ JASWaveInfo field_0x4;
|
||||
/* 0x28 */ JASHeap* mHeap;
|
||||
};
|
||||
|
||||
struct TGroupWaveInfo {
|
||||
TGroupWaveInfo() {
|
||||
field_0x0 = 0xffff;
|
||||
field_0x4 = -1;
|
||||
}
|
||||
|
||||
/* 0x00 */ u16 field_0x0;
|
||||
/* 0x04 */ int field_0x4;
|
||||
};
|
||||
|
||||
struct TWaveGroup : JASWaveArc {
|
||||
TWaveGroup();
|
||||
virtual ~TWaveGroup();
|
||||
void setWaveCount(u32, JKRHeap*);
|
||||
virtual void onLoadDone();
|
||||
virtual void onEraseDone();
|
||||
u32 getWaveID(int) const;
|
||||
|
||||
/* 0x74 */ JASBasicWaveBank* mBank;
|
||||
/* 0x78 */ TGroupWaveInfo* mCtrlWaveArray;
|
||||
/* 0x7C */ u16 mWaveCount;
|
||||
|
||||
u32 getWaveCount() const { return mWaveCount; }
|
||||
};
|
||||
|
||||
JASBasicWaveBank();
|
||||
~JASBasicWaveBank();
|
||||
TWaveGroup* getWaveGroup(u32);
|
||||
void setGroupCount(u32, JKRHeap*);
|
||||
void setWaveTableSize(u32, JKRHeap*);
|
||||
void incWaveTable(JASBasicWaveBank::TWaveGroup const*);
|
||||
void decWaveTable(JASBasicWaveBank::TWaveGroup const*);
|
||||
JASWaveHandle* getWaveHandle(u32) const;
|
||||
void setWaveInfo(JASBasicWaveBank::TWaveGroup*, int, u16, JASWaveInfo const&);
|
||||
JASWaveArc* getWaveArc(u32 param_0) { return getWaveGroup(param_0); }
|
||||
u32 getArcCount() const { return mGroupCount; }
|
||||
|
||||
/* 0x04 */ OSMutex field_0x4;
|
||||
/* 0x1C */ TWaveHandle* mWaveTable;
|
||||
/* 0x20 */ TWaveGroup* mWaveGroupArray;
|
||||
/* 0x24 */ u16 mHandleCount;
|
||||
/* 0x26 */ u16 mGroupCount;
|
||||
|
||||
static u32 mNoLoad;
|
||||
};
|
||||
|
||||
#endif /* JASBASICWAVEBANK_H */
|
||||
@@ -0,0 +1,48 @@
|
||||
#ifndef JASCALC_H
|
||||
#define JASCALC_H
|
||||
|
||||
#include <types.h>
|
||||
#include <limits>
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JASCalc {
|
||||
static void imixcopy(const s16*, const s16*, s16*, u32);
|
||||
static void bcopyfast(const void* src, void* dest, u32 size);
|
||||
static void bcopy(const void* src, void* dest, u32 size);
|
||||
static void bzerofast(void* dest, u32 size);
|
||||
static void bzero(void* dest, u32 size);
|
||||
static f32 pow2(f32);
|
||||
|
||||
template <typename A, typename B>
|
||||
static A clamp(B x);
|
||||
|
||||
static f32 clamp01(f32 i_value) {
|
||||
if (i_value <= 0.0f) {
|
||||
return 0.0f;
|
||||
}
|
||||
if (i_value >= 1.0f) {
|
||||
return 1.0f;
|
||||
}
|
||||
return i_value;
|
||||
}
|
||||
|
||||
f32 fake1();
|
||||
f32 fake2(s32 x);
|
||||
f32 fake3();
|
||||
|
||||
static const s16 CUTOFF_TO_IIR_TABLE[128][4];
|
||||
};
|
||||
|
||||
template <typename A, typename B>
|
||||
A JASCalc::clamp(B x) {
|
||||
if (x <= std::numeric_limits<A>::min())
|
||||
return std::numeric_limits<A>::min();
|
||||
if (x >= std::numeric_limits<A>::max())
|
||||
return std::numeric_limits<A>::max();
|
||||
return x;
|
||||
}
|
||||
|
||||
#endif /* JASCALC_H */
|
||||
@@ -0,0 +1,32 @@
|
||||
#ifndef JASCALLBACK_H
|
||||
#define JASCALLBACK_H
|
||||
|
||||
#include <types.h>
|
||||
|
||||
typedef s32 JASCallback(void*);
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JASCallbackMgr {
|
||||
struct TCallback {
|
||||
TCallback()
|
||||
: callback_(NULL)
|
||||
, arg_(NULL) {
|
||||
}
|
||||
|
||||
/* 0x00 */ JASCallback* callback_;
|
||||
/* 0x04 */ void* arg_;
|
||||
};
|
||||
|
||||
bool regist(JASCallback* callback, void* argument);
|
||||
int reject(JASCallback* callback, void* argument);
|
||||
void callback();
|
||||
|
||||
static const int NUM_CALLBACKS = 32;
|
||||
|
||||
/* 0x00 */ TCallback callbacks_[NUM_CALLBACKS];
|
||||
};
|
||||
|
||||
#endif /* JASCALLBACK_H */
|
||||
@@ -0,0 +1,167 @@
|
||||
#ifndef JASCHANNEL_H
|
||||
#define JASCHANNEL_H
|
||||
|
||||
#include "JSystem/JAudio2/JASHeapCtrl.h"
|
||||
#include "JSystem/JAudio2/JASLfo.h"
|
||||
#include "JSystem/JAudio2/JASOscillator.h"
|
||||
#include "JSystem/JAudio2/JASSoundParams.h"
|
||||
#include "JSystem/JAudio2/JASWaveInfo.h"
|
||||
#include <os.h>
|
||||
|
||||
struct JASDSPChannel;
|
||||
|
||||
namespace JASDsp {
|
||||
struct TChannel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JASChannelParams {
|
||||
public:
|
||||
JASChannelParams() {
|
||||
mVolume = 1.0f;
|
||||
mPitch = 1.0f;
|
||||
field_0x8 = 0.0f;
|
||||
mPan = 0.5f;
|
||||
mFxMix = 0.0f;
|
||||
mDolby = 0.0f;
|
||||
}
|
||||
void init() {
|
||||
mVolume = 1.0f;
|
||||
mPitch = 1.0f;
|
||||
field_0x8 = 0.0f;
|
||||
mPan = 0.5f;
|
||||
mFxMix = 0.0f;
|
||||
mDolby = 0.0f;
|
||||
}
|
||||
|
||||
/* 0x00 */ f32 mVolume;
|
||||
/* 0x04 */ f32 mPitch;
|
||||
/* 0x08 */ f32 field_0x8;
|
||||
/* 0x0C */ f32 mPan;
|
||||
/* 0x10 */ f32 mFxMix;
|
||||
/* 0x14 */ f32 mDolby;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JASChannel : public JASPoolAllocObject_MultiThreaded<JASChannel> {
|
||||
public:
|
||||
typedef void (*Callback)(u32, JASChannel*, JASDsp::TChannel*, void*);
|
||||
static const int BUSOUT_CPUCH = 6;
|
||||
static const int OSC_NUM = 2;
|
||||
|
||||
enum CallbackType {
|
||||
/* 0 */ CB_PLAY,
|
||||
/* 1 */ CB_START,
|
||||
/* 2 */ CB_STOP,
|
||||
/* 3 */ CB_TIMER,
|
||||
};
|
||||
|
||||
enum Status {
|
||||
/* 0 */ STATUS_STOP,
|
||||
/* 1 */ STATUS_PLAY,
|
||||
/* 2 */ STATUS_RELEASE,
|
||||
};
|
||||
|
||||
struct PanVector {
|
||||
/* 0x0 */ f32 mSound;
|
||||
/* 0x4 */ f32 mEffect;
|
||||
/* 0x8 */ f32 mChannel;
|
||||
};
|
||||
|
||||
union MixConfig {
|
||||
u16 whole;
|
||||
struct {
|
||||
u8 upper;
|
||||
u8 lower0 : 4;
|
||||
u8 lower1 : 4;
|
||||
} parts;
|
||||
};
|
||||
|
||||
JASChannel(Callback, void*);
|
||||
~JASChannel();
|
||||
int play();
|
||||
int playForce();
|
||||
void release(u16);
|
||||
void setOscInit(u32, JASOscillator::Data const*);
|
||||
void setMixConfig(u32, u16);
|
||||
static f32 calcEffect(JASChannel::PanVector const*);
|
||||
static f32 calcPan(JASChannel::PanVector const*);
|
||||
void effectOsc(u32, JASOscillator::EffectParams*);
|
||||
void setKeySweepTarget(s32, u32);
|
||||
void updateEffectorParam(JASDsp::TChannel*, u16*,
|
||||
JASOscillator::EffectParams const&);
|
||||
static s32 dspUpdateCallback(u32, JASDsp::TChannel*, void*);
|
||||
s32 initialUpdateDSPChannel(JASDsp::TChannel*);
|
||||
s32 updateDSPChannel(JASDsp::TChannel*);
|
||||
void updateAutoMixer(JASDsp::TChannel*, f32, f32, f32, f32);
|
||||
void updateMixer(f32, f32, f32, f32, u16*);
|
||||
void free();
|
||||
static void initBankDisposeMsgQueue();
|
||||
static void receiveBankDisposeMsg();
|
||||
bool checkBankDispose() const;
|
||||
|
||||
void setPauseFlag(bool param_0) { mPauseFlag = param_0; }
|
||||
void setUpdateTimer(u32 param_0) { mUpdateTimer = param_0; }
|
||||
void setBankDisposeID(const void* param_0) { mBankDisposeID = param_0; }
|
||||
void setDirectRelease(u16 param_0) { mOscillators[0].setDirectRelease(param_0); }
|
||||
void setVibrate(f32 param_0, f32 param_1) {
|
||||
mVibrate.setDepth(param_0);
|
||||
mVibrate.setPitch(param_1);
|
||||
}
|
||||
void setVibrateDelay(u16 param_0) { mVibrate.setDelay(param_0); }
|
||||
void setTremolo(f32 param_0, f32 param_1) {
|
||||
mTremolo.setDepth(param_0);
|
||||
mTremolo.setPitch(param_1);
|
||||
}
|
||||
void setTremoloDelay(u16 param_0) { mTremolo.setDelay(param_0); }
|
||||
void setPriority(u16 param_0) { mPriority = param_0; }
|
||||
void setParams(const JASChannelParams& param_0) { mParams = param_0; }
|
||||
void setInitVolume(f32 param_0) { mSoundParams.mVolume = param_0; }
|
||||
void setInitFxmix(f32 param_0) { mSoundParams.mFxMix = param_0; }
|
||||
void setInitPitch(f32 param_0) { mSoundParams.mPitch = param_0; }
|
||||
void setInitPan(f32 param_0) { mSoundParams.mPan = param_0; }
|
||||
void setInitDolby(f32 param_0) { mSoundParams.mDolby = param_0; }
|
||||
void setKey(s32 param_0) { mKey = param_0; }
|
||||
void setVelocity(u32 param_0) { mVelocity = param_0; }
|
||||
void setSkipSamples(u32 param_0) { mSkipSamples = param_0; }
|
||||
bool isDolbyMode() const { return mMixConfig[0].whole == 0xffff; }
|
||||
|
||||
/* 0x00 */ int mStatus;
|
||||
/* 0x04 */ bool mPauseFlag;
|
||||
/* 0x08 */ JASDSPChannel* mDspCh;
|
||||
/* 0x0C */ Callback mCallback;
|
||||
/* 0x10 */ void* mCallbackData;
|
||||
/* 0x14 */ u32 mUpdateTimer;
|
||||
/* 0x18 */ const void* mBankDisposeID;
|
||||
/* 0x1C */ JASOscillator mOscillators[2];
|
||||
/* 0x5C */ JASLfo mVibrate;
|
||||
/* 0x74 */ JASLfo mTremolo;
|
||||
/* 0x8C */ MixConfig mMixConfig[BUSOUT_CPUCH];
|
||||
/* 0x98 */ u16 mPriority;
|
||||
/* 0x9C */ JASChannelParams mParams;
|
||||
/* 0xB4 */ JASSoundParams mSoundParams;
|
||||
/* 0xC8 */ s16 mKey;
|
||||
/* 0xCA */ u16 mVelocity;
|
||||
/* 0xCC */ f32 mKeySweep;
|
||||
/* 0xD0 */ f32 mKeySweepTarget;
|
||||
/* 0xD4 */ u32 mKeySweepCount;
|
||||
/* 0xD8 */ u32 mSkipSamples;
|
||||
struct {
|
||||
u32 field_0x0;
|
||||
JASWaveInfo field_0x4;
|
||||
} field_0xdc;
|
||||
intptr_t field_0x104;
|
||||
|
||||
static OSMessageQueue sBankDisposeMsgQ;
|
||||
static OSMessage sBankDisposeMsg[16];
|
||||
static OSMessage sBankDisposeList[16];
|
||||
static int sBankDisposeListSize;
|
||||
};
|
||||
|
||||
#endif /* JASCHANNEL_H */
|
||||
@@ -0,0 +1,59 @@
|
||||
#ifndef JASCMDSTACK_H
|
||||
#define JASCMDSTACK_H
|
||||
|
||||
#include "JSystem/JSupport/JSUList.h"
|
||||
|
||||
struct JASTrack;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JASPortArgs {
|
||||
JASTrack* _00;
|
||||
u32 _04;
|
||||
u32 _08;
|
||||
f32 _0C;
|
||||
f32 _10;
|
||||
f32 _14;
|
||||
f32 _18;
|
||||
f32 _1C;
|
||||
f32 _20;
|
||||
u32 _24;
|
||||
f32 _28;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JASPortCmd : JSULink<JASPortCmd> {
|
||||
typedef void (*Command)(JASPortArgs*);
|
||||
|
||||
struct TPortHead : JSUList<JASPortCmd> {
|
||||
inline TPortHead()
|
||||
: JSUList<JASPortCmd>()
|
||||
{
|
||||
}
|
||||
|
||||
~TPortHead() {}
|
||||
|
||||
void execCommandOnce();
|
||||
void execCommandStay();
|
||||
};
|
||||
|
||||
bool addPortCmdOnce();
|
||||
bool setPortCmd(Command func, JASPortArgs*);
|
||||
static void execAllCommand();
|
||||
|
||||
Command getFunc() { return mFunc; }
|
||||
JASPortArgs* getArgs() { return mArgs; }
|
||||
|
||||
Command mFunc;
|
||||
JASPortArgs* mArgs;
|
||||
|
||||
static TPortHead sCommandListOnce;
|
||||
static TPortHead sCommandListStay;
|
||||
};
|
||||
|
||||
#endif /* JASCMDSTACK_H */
|
||||
@@ -0,0 +1,19 @@
|
||||
#ifndef JASCRITICALSECTION_H
|
||||
#define JASCRITICALSECTION_H
|
||||
|
||||
#include <os.h>
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JASCriticalSection {
|
||||
public:
|
||||
JASCriticalSection() { mInterruptState = OSDisableInterrupts(); };
|
||||
~JASCriticalSection() { OSRestoreInterrupts(mInterruptState); };
|
||||
|
||||
private:
|
||||
u32 mInterruptState;
|
||||
};
|
||||
|
||||
#endif /* JASCRITICALSECTION_H */
|
||||
@@ -0,0 +1,57 @@
|
||||
#ifndef JASDSPCHANNEL_H
|
||||
#define JASDSPCHANNEL_H
|
||||
|
||||
#include "JSystem/JAudio2/JASDSPInterface.h"
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JASDSPChannel {
|
||||
typedef s32 (*Callback)(u32, JASDsp::TChannel*, void*);
|
||||
|
||||
enum Status {
|
||||
/* 0 */ STATUS_ACTIVE,
|
||||
/* 1 */ STATUS_INACTIVE,
|
||||
/* 2 */ STATUS_DROP,
|
||||
};
|
||||
|
||||
enum CallbackType {
|
||||
/* 0 */ CB_PLAY,
|
||||
/* 1 */ CB_START,
|
||||
/* 2 */ CB_STOP,
|
||||
/* 3 */ CB_DROP,
|
||||
};
|
||||
|
||||
JASDSPChannel();
|
||||
void free();
|
||||
void start();
|
||||
void drop();
|
||||
void setPriority(u8);
|
||||
void updateProc();
|
||||
u8 getStatus() const { return mStatus; }
|
||||
|
||||
static void initAll();
|
||||
static JASDSPChannel* alloc(u8, Callback, void*);
|
||||
static JASDSPChannel* allocForce(u8, Callback, void*);
|
||||
static JASDSPChannel* getLowestChannel(int);
|
||||
static JASDSPChannel* getLowestActiveChannel();
|
||||
static void updateAll();
|
||||
static int killActiveChannel();
|
||||
static JASDSPChannel* getHandle(u32);
|
||||
static u32 getNumUse();
|
||||
static u32 getNumFree();
|
||||
static u32 getNumBreak();
|
||||
|
||||
static JASDSPChannel* sDspChannels;
|
||||
|
||||
/* 0x00 */ s32 mStatus;
|
||||
/* 0x04 */ s16 mPriority;
|
||||
/* 0x08 */ u32 mFlags;
|
||||
/* 0x0C */ u32 field_0xc;
|
||||
/* 0x10 */ Callback mCallback;
|
||||
/* 0x14 */ void* mCallbackData;
|
||||
/* 0x18 */ JASDsp::TChannel* mChannel;
|
||||
}; // Size: 0x1C
|
||||
|
||||
#endif /* JASDSPCHANNEL_H */
|
||||
@@ -0,0 +1,131 @@
|
||||
#ifndef JASDSPINTERFACE_H
|
||||
#define JASDSPINTERFACE_H
|
||||
|
||||
#include <types.h>
|
||||
|
||||
struct JASWaveInfo;
|
||||
|
||||
namespace JASDsp {
|
||||
struct FxlineConfig_ {
|
||||
u8 field_0x0;
|
||||
u8 field_0x1;
|
||||
u16 field_0x2;
|
||||
s16 field_0x4;
|
||||
u16 field_0x6;
|
||||
s16 field_0x8;
|
||||
u16 field_0xa;
|
||||
u32 field_0xc;
|
||||
s16 field_0x10[8];
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
u16 field_0x0;
|
||||
u16 field_0x2;
|
||||
s16* field_0x4;
|
||||
u16 field_0x8;
|
||||
s16 field_0xa;
|
||||
u16 field_0xc;
|
||||
s16 field_0xe;
|
||||
u16 field_0x10[8];
|
||||
} FxBuf;
|
||||
|
||||
struct TChannel {
|
||||
void init();
|
||||
void playStart();
|
||||
void playStop();
|
||||
void replyFinishRequest();
|
||||
void forceStop();
|
||||
bool isActive() const;
|
||||
bool isFinish() const;
|
||||
void setWaveInfo(JASWaveInfo const&, u32, u32);
|
||||
void setOscInfo(u32);
|
||||
void initAutoMixer();
|
||||
void setAutoMixer(u16, u8, u8, u8, u8);
|
||||
void setPitch(u16);
|
||||
void setMixerInitVolume(u8, s16);
|
||||
void setMixerVolume(u8, s16);
|
||||
void setPauseFlag(u8);
|
||||
void flush();
|
||||
void initFilter();
|
||||
void setFilterMode(u16);
|
||||
void setIIRFilterParam(s16*);
|
||||
void setFIR8FilterParam(s16*);
|
||||
void setDistFilter(s16);
|
||||
void setBusConnect(u8, u8);
|
||||
|
||||
/* 0x000 */ u16 mIsActive;
|
||||
/* 0x002 */ u16 mIsFinished;
|
||||
/* 0x004 */ u16 mPitch;
|
||||
/* 0x006 */ short field_0x006;
|
||||
/* 0x008 */ u16 field_0x008;
|
||||
/* 0x00A */ u8 field_0x00A[0x00C - 0x00A];
|
||||
/* 0x00C */ s16 mPauseFlag;
|
||||
/* 0x00E */ short field_0x00E;
|
||||
/* 0x010 */ u16 field_0x010[1][4]; // array size unknown
|
||||
/* 0x018 */ u8 field_0x018[0x050 - 0x018];
|
||||
/* 0x050 */ u16 field_0x050;
|
||||
/* 0x052 */ u16 field_0x052;
|
||||
/* 0x054 */ u16 field_0x054;
|
||||
/* 0x056 */ u16 field_0x056;
|
||||
/* 0x058 */ u16 field_0x058;
|
||||
/* 0x05A */ u8 field_0x05A[0x060 - 0x05A];
|
||||
/* 0x060 */ short field_0x060;
|
||||
/* 0x062 */ u8 field_0x062[0x064 - 0x062];
|
||||
/* 0x064 */ u16 field_0x064;
|
||||
/* 0x066 */ short field_0x066;
|
||||
/* 0x068 */ int field_0x068;
|
||||
/* 0x06C */ u8 field_0x06C[0x070 - 0x06C];
|
||||
/* 0x070 */ int field_0x070;
|
||||
/* 0x074 */ int field_0x074;
|
||||
/* 0x078 */ short field_0x078[4];
|
||||
/* 0x080 */ short field_0x080[20];
|
||||
/* 0x0A8 */ short field_0x0a8[4];
|
||||
/* 0x0B0 */ u16 field_0x0b0[16];
|
||||
/* 0x0D0 */ u8 field_0x0D0[0x100 - 0x0D0];
|
||||
/* 0x100 */ u16 field_0x100;
|
||||
/* 0x102 */ u16 field_0x102;
|
||||
/* 0x104 */ s16 field_0x104;
|
||||
/* 0x106 */ s16 field_0x106;
|
||||
/* 0x108 */ u16 mFilterMode;
|
||||
/* 0x10A */ u16 mForcedStop;
|
||||
/* 0x10C */ int field_0x10c;
|
||||
/* 0x110 */ u32 field_0x110;
|
||||
/* 0x114 */ u32 field_0x114;
|
||||
/* 0x118 */ u32 field_0x118;
|
||||
/* 0x11C */ int field_0x11c;
|
||||
/* 0x120 */ s16 fir_filter_params[8];
|
||||
/* 0x130 */ u8 field_0x130[0x148 - 0x130];
|
||||
/* 0x148 */ s16 iir_filter_params[8];
|
||||
/* 0x158 */ u8 field_0x158[0x180 - 0x158];
|
||||
};
|
||||
|
||||
void boot(void (*)(void*));
|
||||
void releaseHalt(u32);
|
||||
void finishWork(u16);
|
||||
void syncFrame(u32, u32, u32);
|
||||
void setDSPMixerLevel(f32);
|
||||
f32 getDSPMixerLevel();
|
||||
TChannel* getDSPHandle(int);
|
||||
TChannel* getDSPHandleNc(int);
|
||||
void setFilterTable(s16*, s16*, u32);
|
||||
void flushBuffer();
|
||||
void invalChannelAll();
|
||||
void initBuffer();
|
||||
int setFXLine(u8, s16*, JASDsp::FxlineConfig_*);
|
||||
BOOL changeFXLineParam(u8, u8, uintptr_t);
|
||||
|
||||
extern u8 const DSPADPCM_FILTER[64];
|
||||
extern u32 const DSPRES_FILTER[320];
|
||||
extern u16 SEND_TABLE[];
|
||||
extern TChannel* CH_BUF;
|
||||
extern FxBuf* FX_BUF;
|
||||
extern f32 sDSPVolume;
|
||||
|
||||
#if DEBUG
|
||||
extern s32 dspMutex;
|
||||
#endif
|
||||
};
|
||||
|
||||
u16 DSP_CreateMap2(u32 msg);
|
||||
|
||||
#endif /* JASDSPINTERFACE_H */
|
||||
@@ -0,0 +1,34 @@
|
||||
#ifndef JASDRIVERIF_H
|
||||
#define JASDRIVERIF_H
|
||||
|
||||
#include "JSystem/JAudio2/JASCallback.h"
|
||||
|
||||
typedef s32 (*DriverCallback)(void*);
|
||||
|
||||
namespace JASDriver {
|
||||
void setDSPLevel(f32);
|
||||
u16 getChannelLevel_dsp();
|
||||
f32 getChannelLevel();
|
||||
f32 getDSPLevel();
|
||||
void setOutputMode(u32);
|
||||
u32 getOutputMode();
|
||||
void waitSubFrame();
|
||||
int rejectCallback(DriverCallback, void*);
|
||||
bool registerDspSyncCallback(DriverCallback, void*);
|
||||
bool registerSubFrameCallback(DriverCallback, void*);
|
||||
void subframeCallback();
|
||||
void DSPSyncCallback();
|
||||
void updateDacCallback();
|
||||
|
||||
extern JASCallbackMgr sDspSyncCallback;
|
||||
extern JASCallbackMgr sSubFrameCallback;
|
||||
extern JASCallbackMgr sUpdateDacCallback;
|
||||
extern u16 MAX_MIXERLEVEL;
|
||||
extern u32 JAS_SYSTEM_OUTPUT_MODE;
|
||||
};
|
||||
|
||||
inline void JAISetOutputMode(u32 mode) {
|
||||
JASDriver::setOutputMode(mode);
|
||||
}
|
||||
|
||||
#endif /* JASDRIVERIF_H */
|
||||
@@ -0,0 +1,43 @@
|
||||
#ifndef JASDRUMSET_H
|
||||
#define JASDRUMSET_H
|
||||
|
||||
#include "JSystem/JAudio2/JASBasicInst.h"
|
||||
|
||||
struct JKRHeap;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JASDrumSet : public JASInst {
|
||||
struct TPerc {
|
||||
TPerc();
|
||||
void setRelease(u32);
|
||||
|
||||
void setVolume(f32 volume) { mVolume = volume; }
|
||||
void setPitch(f32 pitch) { mPitch = pitch; }
|
||||
void setPan(f32 pan) { mPan = pan; }
|
||||
|
||||
/* 0x00 */ f32 mVolume;
|
||||
/* 0x04 */ f32 mPitch;
|
||||
/* 0x08 */ f32 mPan;
|
||||
/* 0x0C */ u16 field_0xc;
|
||||
/* 0x0E */ u16 field_0xe;
|
||||
/* 0x10 */ f32 field_0x10;
|
||||
/* 0x14 */ f32 field_0x14;
|
||||
};
|
||||
|
||||
JASDrumSet();
|
||||
virtual ~JASDrumSet();
|
||||
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** mPercArray;
|
||||
/* 0x8 */ u8 mPercNumMax;
|
||||
};
|
||||
|
||||
#endif /* JASDRUMSET_H */
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef JASDVDTHREAD_H
|
||||
#define JASDVDTHREAD_H
|
||||
|
||||
#include <types.h>
|
||||
|
||||
class JASTaskThread;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JASDvd {
|
||||
public:
|
||||
static JASTaskThread* getThreadPointer();
|
||||
static bool createThread(s32 priority, int msgCount, u32 stackSize);
|
||||
|
||||
static JASTaskThread* sThread;
|
||||
};
|
||||
|
||||
#endif /* JASDVDTHREAD_H */
|
||||
@@ -0,0 +1,95 @@
|
||||
#ifndef JASGADGET_H
|
||||
#define JASGADGET_H
|
||||
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include <cstring>
|
||||
#include <string>
|
||||
|
||||
#ifdef __MWERKS__
|
||||
#define JAS_GLOBAL_INSTANCE_INIT
|
||||
#else
|
||||
#define JAS_GLOBAL_INSTANCE_INIT {}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
template<class T>
|
||||
class JASGlobalInstance {
|
||||
public:
|
||||
JASGlobalInstance(T* inst) {
|
||||
sInstance = inst;
|
||||
}
|
||||
|
||||
JASGlobalInstance(bool setInstance) {
|
||||
if (setInstance) {
|
||||
JUT_ASSERT(186, sInstance == NULL);
|
||||
sInstance = (T*)this;
|
||||
}
|
||||
}
|
||||
|
||||
~JASGlobalInstance() {
|
||||
if (sInstance == (T*)this) {
|
||||
sInstance = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static T* getInstance() { return sInstance; }
|
||||
|
||||
static T* sInstance;
|
||||
};
|
||||
|
||||
#ifndef __MWERKS__
|
||||
template<class T>
|
||||
T* JASGlobalInstance<T>::sInstance;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
template<class T>
|
||||
class JASPtrTable {
|
||||
public:
|
||||
JASPtrTable(T** param_0, u32 size) {
|
||||
mTable = param_0;
|
||||
mSize = size;
|
||||
memset(mTable, 0, size * 4);
|
||||
}
|
||||
T* get(u32 index) {
|
||||
if (index >= mSize) {
|
||||
return NULL;
|
||||
}
|
||||
return mTable[index];
|
||||
}
|
||||
T* get(u32 index) const {
|
||||
if (index >= mSize) {
|
||||
return NULL;
|
||||
}
|
||||
return mTable[index];
|
||||
}
|
||||
void set(u32 index, T* value) {
|
||||
JUT_ASSERT(229, index < mSize);
|
||||
mTable[index] = value;
|
||||
}
|
||||
|
||||
private:
|
||||
/* 0x00 */ T** mTable;
|
||||
/* 0x04 */ u32 mSize;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
template<class T, size_t N>
|
||||
class JASPtrArray : public JASPtrTable<T> {
|
||||
public:
|
||||
JASPtrArray() : JASPtrTable<T>(mArray, N) {}
|
||||
|
||||
private:
|
||||
/* 0x08 */ T* mArray[N];
|
||||
};
|
||||
|
||||
#endif /* JASGADGET_H */
|
||||
@@ -0,0 +1,431 @@
|
||||
#ifndef JASHEAPCTRL_H
|
||||
#define JASHEAPCTRL_H
|
||||
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
#include "JSystem/JSupport/JSUList.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include <os.h>
|
||||
#include <os.h>
|
||||
|
||||
struct JASDisposer;
|
||||
class JKRHeap;
|
||||
class JKRSolidHeap;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JASHeap {
|
||||
public:
|
||||
JASHeap(JASDisposer* param_0 = NULL);
|
||||
void initRootHeap(void*, u32);
|
||||
bool alloc(JASHeap*, u32);
|
||||
bool allocTail(JASHeap*, u32);
|
||||
bool free();
|
||||
u32 getTotalFreeSize() const;
|
||||
u32 getFreeSize() const;
|
||||
void insertChild(JASHeap*, JASHeap*, void*, u32, bool);
|
||||
JASHeap* getTailHeap();
|
||||
u32 getTailOffset();
|
||||
u32 getCurOffset();
|
||||
|
||||
void* getBase() { return mBase; }
|
||||
bool isAllocated() const { return mBase; }
|
||||
u32 getSize() const { return mSize; }
|
||||
|
||||
/* 0x00 */ JSUTree<JASHeap> mTree;
|
||||
/* 0x1C */ OSMutex mMutex;
|
||||
/* 0x34 */ JASDisposer* mDisposer;
|
||||
/* 0x38 */ u8* mBase;
|
||||
/* 0x3C */ u32 mSize;
|
||||
/* 0x40 */ JASHeap* field_0x40;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JASGenericMemPool {
|
||||
JASGenericMemPool();
|
||||
~JASGenericMemPool();
|
||||
void newMemPool(u32, int);
|
||||
void* alloc(u32);
|
||||
void free(void*, u32);
|
||||
|
||||
u32 getFreeMemCount() const {
|
||||
return freeMemCount;
|
||||
}
|
||||
|
||||
u32 getTotalMemCount() const {
|
||||
return totalMemCount;
|
||||
}
|
||||
|
||||
/* 0x00 */ void* field_0x0;
|
||||
/* 0x04 */ u32 freeMemCount;
|
||||
/* 0x08 */ u32 totalMemCount;
|
||||
/* 0x0C */ u32 usedMemCount;
|
||||
};
|
||||
|
||||
namespace JASThreadingModel {
|
||||
template <typename A0>
|
||||
struct InterruptsDisable {
|
||||
struct Lock {
|
||||
Lock(const A0& param_0) { field_0x0 = OSDisableInterrupts(); }
|
||||
~Lock() { OSRestoreInterrupts(field_0x0); }
|
||||
|
||||
BOOL field_0x0;
|
||||
};
|
||||
};
|
||||
|
||||
template <typename A0>
|
||||
struct ObjectLevelLockable : public OSMutex {
|
||||
ObjectLevelLockable() {
|
||||
OSInitMutex(this);
|
||||
}
|
||||
|
||||
struct Lock {
|
||||
Lock(A0 const& mutex) {
|
||||
mMutex = (A0*)&mutex;
|
||||
OSLockMutex(mMutex);
|
||||
}
|
||||
|
||||
~Lock() {
|
||||
OSUnlockMutex(mMutex);
|
||||
}
|
||||
|
||||
A0* mMutex;
|
||||
};
|
||||
};
|
||||
|
||||
template <typename A0>
|
||||
struct SingleThreaded {
|
||||
struct Lock {
|
||||
Lock(const A0& param_0) {}
|
||||
};
|
||||
};
|
||||
}; // namespace JASThreadingModel
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
template <typename T>
|
||||
class JASMemPool : public JASGenericMemPool {
|
||||
public:
|
||||
void newMemPool(int param_0) {
|
||||
typename JASThreadingModel::SingleThreaded<JASMemPool<T> >::Lock lock(*this);
|
||||
JASGenericMemPool::newMemPool(sizeof(T), param_0);
|
||||
}
|
||||
|
||||
void* alloc(u32 n) {
|
||||
JUT_ASSERT(182, n == sizeof(T));
|
||||
typename JASThreadingModel::SingleThreaded<JASMemPool<T> >::Lock lock(*this);
|
||||
return JASGenericMemPool::alloc(n);
|
||||
}
|
||||
|
||||
void free(void* ptr, u32 n) {
|
||||
JUT_ASSERT(187, n == sizeof(T));
|
||||
typename JASThreadingModel::SingleThreaded<JASMemPool<T> >::Lock lock(*this);
|
||||
JASGenericMemPool::free(ptr, n);
|
||||
}
|
||||
|
||||
u32 getFreeMemCount() const {
|
||||
typename JASThreadingModel::SingleThreaded<JASMemPool<T> >::Lock lock(*this);
|
||||
return JASGenericMemPool::getFreeMemCount();
|
||||
}
|
||||
|
||||
u32 getTotalMemCount() const {
|
||||
typename JASThreadingModel::SingleThreaded<JASMemPool<T> >::Lock lock(*this);
|
||||
return JASGenericMemPool::getTotalMemCount();
|
||||
}
|
||||
};
|
||||
|
||||
namespace JASKernel { JKRHeap* getSystemHeap(); };
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
template<u32 ChunkSize, template<typename> class T>
|
||||
class JASMemChunkPool : public T<JASMemChunkPool<ChunkSize, T> > {
|
||||
struct MemoryChunk {
|
||||
MemoryChunk(MemoryChunk* nextChunk) {
|
||||
mNextChunk = nextChunk;
|
||||
mUsedSize = 0;
|
||||
mChunks = 0;
|
||||
}
|
||||
|
||||
bool checkArea(const void* ptr) const {
|
||||
return (u8*)this + 0xc <= (u8*)ptr && (u8*)ptr < (u8*)this + (ChunkSize + 0xc);
|
||||
}
|
||||
|
||||
MemoryChunk* getNextChunk() {
|
||||
return mNextChunk;
|
||||
}
|
||||
|
||||
void* alloc(u32 size) {
|
||||
u8* rv = mBuffer + mUsedSize;
|
||||
mUsedSize += size;
|
||||
mChunks++;
|
||||
return rv;
|
||||
}
|
||||
|
||||
void free(void* mem) {
|
||||
mChunks--;
|
||||
}
|
||||
|
||||
bool isEmpty() const {
|
||||
return mChunks == 0;
|
||||
}
|
||||
|
||||
void setNextChunk(MemoryChunk* chunk) {
|
||||
mNextChunk = chunk;
|
||||
}
|
||||
|
||||
u32 getFreeSize() const {
|
||||
return ChunkSize - mUsedSize;
|
||||
}
|
||||
|
||||
void revive() {
|
||||
mUsedSize = 0;
|
||||
}
|
||||
|
||||
MemoryChunk* mNextChunk;
|
||||
u32 mUsedSize;
|
||||
u32 mChunks;
|
||||
u8 mBuffer[ChunkSize];
|
||||
};
|
||||
public:
|
||||
JASMemChunkPool() {
|
||||
field_0x18 = NULL;
|
||||
bool ret = createNewChunk();
|
||||
JUT_ASSERT(320, ret);
|
||||
}
|
||||
|
||||
bool createNewChunk() {
|
||||
bool r27 = 0;
|
||||
if (field_0x18 != NULL && field_0x18->isEmpty()) {
|
||||
field_0x18->revive();
|
||||
return true;
|
||||
}
|
||||
MemoryChunk* pMVar4 = field_0x18;
|
||||
field_0x18 = JKR_NEW_ARGS (JASKernel::getSystemHeap(), 0) MemoryChunk(pMVar4);
|
||||
if (field_0x18 != NULL) {
|
||||
return true;
|
||||
}
|
||||
JUT_WARN(428, "%s", "Not enough JASSystemHeap");
|
||||
field_0x18 = JKR_NEW_ARGS (JKRHeap::getSystemHeap(), 0) MemoryChunk(pMVar4);
|
||||
if (field_0x18 != NULL) {
|
||||
return true;
|
||||
}
|
||||
field_0x18 = pMVar4;
|
||||
return false;
|
||||
}
|
||||
|
||||
void* alloc(u32 size) {
|
||||
typename T<JASMemChunkPool<ChunkSize, T> >::Lock lock(*this);
|
||||
u32 freeSize = field_0x18->getFreeSize();
|
||||
if (freeSize < size) {
|
||||
if (ChunkSize < size) {
|
||||
return NULL;
|
||||
}
|
||||
if (createNewChunk() == 0) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return field_0x18->alloc(size);
|
||||
}
|
||||
|
||||
void free(void* ptr) {
|
||||
typename T<JASMemChunkPool<ChunkSize, T> >::Lock lock(*this);
|
||||
MemoryChunk* chunk = field_0x18;
|
||||
MemoryChunk* prevChunk = NULL;
|
||||
while (chunk != NULL) {
|
||||
if (chunk->checkArea(ptr)) {
|
||||
chunk->free(ptr);
|
||||
bool r26 = false;
|
||||
if (chunk != field_0x18 && chunk->isEmpty()) {
|
||||
MemoryChunk* nextChunk = chunk->getNextChunk();
|
||||
JKR_DELETE(chunk);
|
||||
prevChunk->setNextChunk(nextChunk);
|
||||
}
|
||||
return;
|
||||
}
|
||||
prevChunk = chunk;
|
||||
chunk = chunk->getNextChunk();
|
||||
}
|
||||
|
||||
JUT_PANIC(362, "Cannnot free for JASMemChunkPool");
|
||||
}
|
||||
|
||||
/* 0x18 */ MemoryChunk* field_0x18;
|
||||
};
|
||||
|
||||
namespace JASKernel {
|
||||
void setupRootHeap(JKRSolidHeap*, u32);
|
||||
JKRHeap* getSystemHeap();
|
||||
JASMemChunkPool<1024, JASThreadingModel::ObjectLevelLockable>* getCommandHeap();
|
||||
void setupAramHeap(uintptr_t, u32);
|
||||
JASHeap* getAramHeap();
|
||||
u32 getAramFreeSize();
|
||||
u32 getAramSize();
|
||||
|
||||
extern JASHeap audioAramHeap;
|
||||
extern uintptr_t sAramBase;
|
||||
extern JKRHeap* sSystemHeap;
|
||||
extern JASMemChunkPool<1024, JASThreadingModel::ObjectLevelLockable>* sCommandHeap;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
template <typename T>
|
||||
class JASPoolAllocObject {
|
||||
public:
|
||||
#if TARGET_PC
|
||||
static void* operator new(size_t n, JKRHeapToken) {
|
||||
return operator new(n);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void* operator new(size_t n) {
|
||||
#if PLATFORM_GCN
|
||||
JASMemPool<T>& memPool_ = getMemPool_();
|
||||
#endif
|
||||
return memPool_.alloc(n);
|
||||
}
|
||||
static void* operator new(size_t n, void* ptr) {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
static void operator delete(void* ptr, size_t n, JKRHeapToken) {
|
||||
operator delete(ptr, n);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void operator delete(void* ptr, size_t n) {
|
||||
#if PLATFORM_GCN
|
||||
JASMemPool<T>& memPool_ = getMemPool_();
|
||||
#endif
|
||||
memPool_.free(ptr, n);
|
||||
}
|
||||
static void newMemPool(int param_0) {
|
||||
#if PLATFORM_GCN
|
||||
JASMemPool<T>& memPool_ = getMemPool_();
|
||||
#endif
|
||||
memPool_.newMemPool(param_0);
|
||||
}
|
||||
static u32 getFreeMemCount() {
|
||||
#if PLATFORM_GCN
|
||||
JASMemPool<T>& memPool_ = getMemPool_();
|
||||
#endif
|
||||
return memPool_.getFreeMemCount();
|
||||
}
|
||||
static u32 getTotalMemCount() {
|
||||
#if PLATFORM_GCN
|
||||
JASMemPool<T>& memPool_ = getMemPool_();
|
||||
#endif
|
||||
return memPool_.getTotalMemCount();
|
||||
}
|
||||
|
||||
private:
|
||||
// Fakematch? Is memPool_ both an in-function static and an out-of-function static?
|
||||
static JASMemPool<T> memPool_;
|
||||
#if PLATFORM_GCN
|
||||
static JASMemPool<T>& getMemPool_() {
|
||||
static JASMemPool<T> memPool_;
|
||||
return memPool_;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
#if !PLATFORM_GCN
|
||||
template <typename T> JASMemPool<T> JASPoolAllocObject<T>::memPool_;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
template <typename T>
|
||||
class JASMemPool_MultiThreaded : public JASGenericMemPool {
|
||||
public:
|
||||
void newMemPool(int param_0) {
|
||||
typename JASThreadingModel::InterruptsDisable<JASMemPool_MultiThreaded<T> >::Lock lock(*this);
|
||||
JASGenericMemPool::newMemPool(sizeof(T), param_0);
|
||||
}
|
||||
|
||||
void* alloc(size_t count) {
|
||||
typename JASThreadingModel::InterruptsDisable<JASMemPool_MultiThreaded<T> >::Lock lock(*this);
|
||||
return JASGenericMemPool::alloc(count);
|
||||
}
|
||||
|
||||
void free(void* ptr, u32 param_1) {
|
||||
typename JASThreadingModel::InterruptsDisable<JASMemPool_MultiThreaded<T> >::Lock lock(*this);
|
||||
JASGenericMemPool::free(ptr, param_1);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
template <typename T>
|
||||
class JASPoolAllocObject_MultiThreaded {
|
||||
public:
|
||||
#if TARGET_PC
|
||||
static void* operator new(size_t n, JKRHeapToken) {
|
||||
return operator new(n);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void* operator new(size_t n) {
|
||||
#if PLATFORM_GCN
|
||||
JASMemPool_MultiThreaded<T>& memPool_ = getMemPool();
|
||||
#endif
|
||||
return memPool_.alloc(n);
|
||||
}
|
||||
static void* operator new(size_t n, void* ptr) {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
#if TARGET_PC
|
||||
static void operator delete(void* ptr, size_t n, JKRHeapToken) {
|
||||
return operator delete(ptr, n);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void operator delete(void* ptr, size_t n) {
|
||||
#if PLATFORM_GCN
|
||||
JASMemPool_MultiThreaded<T>& memPool_ = getMemPool();
|
||||
#endif
|
||||
memPool_.free(ptr, n);
|
||||
}
|
||||
|
||||
static void newMemPool(int n) {
|
||||
#if PLATFORM_GCN
|
||||
JASMemPool_MultiThreaded<T>& memPool_ = getMemPool();
|
||||
#endif
|
||||
memPool_.newMemPool(n);
|
||||
}
|
||||
|
||||
private:
|
||||
// Fakematch? Is memPool_ both an in-function static and an out-of-function static?
|
||||
static JASMemPool_MultiThreaded<T> memPool_;
|
||||
#if PLATFORM_GCN
|
||||
static JASMemPool_MultiThreaded<T>& getMemPool() {
|
||||
static JASMemPool_MultiThreaded<T> memPool_;
|
||||
return memPool_;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
#if !PLATFORM_GCN
|
||||
template <typename T> JASMemPool_MultiThreaded<T> JASPoolAllocObject_MultiThreaded<T>::memPool_;
|
||||
#endif
|
||||
|
||||
extern JKRSolidHeap* JASDram;
|
||||
|
||||
#endif /* JASHEAPCTRL_H */
|
||||
@@ -0,0 +1,33 @@
|
||||
#ifndef JASLFO_H
|
||||
#define JASLFO_H
|
||||
|
||||
#include <types.h>
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JASLfo {
|
||||
JASLfo();
|
||||
f32 getValue() const;
|
||||
void incCounter(f32);
|
||||
void resetCounter();
|
||||
|
||||
void setDepth(f32 param_0) { mDepth = param_0; }
|
||||
void setPitch(f32 param_0) { mPitch = param_0; }
|
||||
void setDelay(u16 param_0) { mDelay = param_0; }
|
||||
|
||||
static void updateFreeRun(f32 param_0) { sFreeRunLfo.incCounter(param_0); }
|
||||
|
||||
static JASLfo sFreeRunLfo;
|
||||
|
||||
/* 0x00 */ u32 field_0x0;
|
||||
/* 0x04 */ u32 field_0x4;
|
||||
/* 0x08 */ f32 field_0x8;
|
||||
/* 0x0C */ f32 mDepth;
|
||||
/* 0x10 */ f32 mPitch;
|
||||
/* 0x14 */ u16 mDelay;
|
||||
/* 0x16 */ u16 field_0x16;
|
||||
};
|
||||
|
||||
#endif /* JASLFO_H */
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef JASMUTEX_H
|
||||
#define JASMUTEX_H
|
||||
|
||||
#include <os.h>
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JASMutexLock {
|
||||
JASMutexLock(OSMutex* mutex) {
|
||||
mMutex = mutex;
|
||||
OSLockMutex(mutex);
|
||||
}
|
||||
~JASMutexLock() { OSUnlockMutex(mMutex); }
|
||||
|
||||
/* 0x0 */ OSMutex* mMutex;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,90 @@
|
||||
#ifndef JASOSCILLATOR_H
|
||||
#define JASOSCILLATOR_H
|
||||
|
||||
#include <types.h>
|
||||
#include "dusk/endian.h"
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JASOscillator {
|
||||
struct Point {
|
||||
/* 0x0 */ BE(s16) _0;
|
||||
/* 0x2 */ BE(s16) _2;
|
||||
/* 0x4 */ BE(s16) _4;
|
||||
};
|
||||
|
||||
struct EffectParams {
|
||||
EffectParams() {
|
||||
mVolume = 1.0f;
|
||||
mPitch = 1.0f;
|
||||
mPan = 0.5f;
|
||||
mFxMix = 0.0f;
|
||||
mDolby = 0.0f;
|
||||
_14 = 1.0f;
|
||||
_18 = 1.0f;
|
||||
}
|
||||
|
||||
/* 0x00 */ f32 mVolume;
|
||||
/* 0x04 */ f32 mPitch;
|
||||
/* 0x08 */ f32 mPan;
|
||||
/* 0x0C */ f32 mFxMix;
|
||||
/* 0x10 */ f32 mDolby;
|
||||
/* 0x14 */ f32 _14;
|
||||
/* 0x18 */ f32 _18;
|
||||
};
|
||||
|
||||
struct Data {
|
||||
/* 0x00 */ u32 mTarget;
|
||||
/* 0x04 */ f32 _04;
|
||||
/* 0x08 */ const Point* mTable;
|
||||
/* 0x0C */ const Point* rel_table;
|
||||
/* 0x10 */ f32 mScale;
|
||||
/* 0x14 */ f32 _14;
|
||||
};
|
||||
|
||||
enum Target {
|
||||
/* 0 */ TARGET_VOLUME,
|
||||
/* 1 */ TARGET_PITCH,
|
||||
/* 2 */ TARGET_PAN,
|
||||
/* 3 */ TARGET_FXMIX,
|
||||
/* 4 */ TARGET_DOLBY,
|
||||
/* 5 */ TARGET_5,
|
||||
/* 6 */ TARGET_6,
|
||||
};
|
||||
|
||||
JASOscillator();
|
||||
|
||||
void initStart(const Data*);
|
||||
void incCounter(f32 param_0);
|
||||
f32 getValue() const;
|
||||
void release();
|
||||
void update();
|
||||
void updateCurrentValue(f32 param_0);
|
||||
|
||||
void setDirectRelease(u16 param_0) { mDirectRelease = param_0; }
|
||||
void stop() { _1C = 0; }
|
||||
bool isValid() const { return mData != NULL; }
|
||||
bool isStop() const { return _1C == 0; }
|
||||
bool isRelease() const { return _1C == 3 || _1C == 4; }
|
||||
u32 getTarget() const { return mData->mTarget; }
|
||||
|
||||
/* 0x00 */ const Data* mData;
|
||||
/* 0x04 */ f32 _04;
|
||||
/* 0x08 */ f32 _08;
|
||||
/* 0x0C */ f32 _0C;
|
||||
/* 0x10 */ f32 _10;
|
||||
/* 0x14 */ u16 _14;
|
||||
/* 0x16 */ u16 mDirectRelease;
|
||||
/* 0x18 */ u8 _18;
|
||||
/* 0x1A */ u16 _1A;
|
||||
/* 0x1C */ int _1C;
|
||||
|
||||
static const f32 sCurveTableLinear[17];
|
||||
static const f32 sCurveTableSampleCell[17];
|
||||
static const f32 sCurveTableSqRoot[17];
|
||||
static const f32 sCurveTableSquare[17];
|
||||
};
|
||||
|
||||
#endif /* JASOSCILLATOR_H */
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef JASPROBE_H
|
||||
#define JASPROBE_H
|
||||
|
||||
#include <types.h>
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JASProbe {
|
||||
static void start(s32, char const*);
|
||||
void start(char const*);
|
||||
void stop();
|
||||
static void stop(s32);
|
||||
|
||||
static JASProbe* sProbeTable[16];
|
||||
|
||||
/* 0x000 */ char const* mName;
|
||||
/* 0x004 */ s32 mStartTime;
|
||||
/* 0x008 */ f32 _08;
|
||||
/* 0x00C */ f32 _0C;
|
||||
/* 0x010 */ f32 _10;
|
||||
/* 0x014 */ f32 _14;
|
||||
/* 0x018 */ f32 _18[100];
|
||||
/* 0x1A8 */ u32 _1A8;
|
||||
};
|
||||
|
||||
#endif /* JASPROBE_H */
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef JASREGISTERPARAM_H
|
||||
#define JASREGISTERPARAM_H
|
||||
|
||||
#include <types.h>
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JASRegisterParam {
|
||||
public:
|
||||
enum RegID {
|
||||
REG0,
|
||||
REG1,
|
||||
REG2,
|
||||
REG3,
|
||||
};
|
||||
|
||||
JASRegisterParam();
|
||||
void init();
|
||||
void write(JASRegisterParam::RegID, u32);
|
||||
u32 read(JASRegisterParam::RegID);
|
||||
|
||||
u16 field_0x0[14];
|
||||
};
|
||||
|
||||
#endif /* JASREGISTERPARAM_H */
|
||||
@@ -0,0 +1,11 @@
|
||||
#ifndef JASREPORT_H
|
||||
#define JASREPORT_H
|
||||
|
||||
class JKRHeap;
|
||||
|
||||
void JASReportInit(JKRHeap*, int);
|
||||
int JASReportGetLineMax();
|
||||
int JASReportCopyBuffer(char *, int);
|
||||
void JASReport(const char* message, ...);
|
||||
|
||||
#endif /* JASREPORT_H */
|
||||
@@ -0,0 +1,47 @@
|
||||
#ifndef JASRESARCLOADER_H
|
||||
#define JASRESARCLOADER_H
|
||||
|
||||
#include "JSystem/JKernel/JKRArchive.h"
|
||||
#include <os.h>
|
||||
|
||||
namespace JASResArcLoader {
|
||||
size_t getResSize(JKRArchive const*, u16);
|
||||
size_t getResMaxSize(JKRArchive const*);
|
||||
static void loadResourceCallback(void*);
|
||||
int loadResourceAsync(JKRArchive*, u16, u8*, u32, void (*)(u32, uintptr_t), uintptr_t);
|
||||
|
||||
// from pikmin2
|
||||
typedef void (*LoadCallback)(u32, uintptr_t);
|
||||
|
||||
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
|
||||
uintptr_t mCallbackArg; // _14, arg to pass to mCallback along with readResource result
|
||||
OSMessageQueue* mQueue; // _18
|
||||
};
|
||||
};
|
||||
|
||||
class JKRArchive;
|
||||
|
||||
enum ResArcMessage {
|
||||
RESARCMSG_Error = -1,
|
||||
RESARCMSG_Success = 0,
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* JASRESARCLOADER_H */
|
||||
@@ -0,0 +1,79 @@
|
||||
#ifndef JASSEQCTRL_H
|
||||
#define JASSEQCTRL_H
|
||||
|
||||
#include "JSystem/JAudio2/JASSeqReader.h"
|
||||
|
||||
struct JASTrack;
|
||||
class JASSeqParser;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JASSeqCtrl {
|
||||
public:
|
||||
enum IntrType {
|
||||
INTRTYPE_VALUE_0,
|
||||
INTRTYPE_VALUE_1,
|
||||
INTRTYPE_VALUE_2,
|
||||
INTRTYPE_VALUE_3,
|
||||
INTRTYPE_VALUE_4,
|
||||
INTRTYPE_VALUE_5,
|
||||
INTRTYPE_VALUE_6,
|
||||
};
|
||||
|
||||
JASSeqCtrl();
|
||||
void init();
|
||||
void start(void*, u32);
|
||||
int tickProc(JASTrack*);
|
||||
void interrupt(JASSeqCtrl::IntrType);
|
||||
void setIntrMask(u32);
|
||||
void clrIntrMask(u32);
|
||||
int retIntr();
|
||||
int findIntr();
|
||||
void checkIntr();
|
||||
void timerProcess();
|
||||
|
||||
const JASSeqReader* getSeqReader() const { return &mReader; }
|
||||
void* getBase() { return mReader.getBase(); }
|
||||
void* getAddr(u32 param_0) { return mReader.getAddr(param_0); }
|
||||
u8 getByte(u32 param_0) const { return mReader.getByte(param_0); }
|
||||
u16 get16(u32 param_0) const { return mReader.get16(param_0); }
|
||||
u32 get24(u32 param_0) const { return mReader.get24(param_0); }
|
||||
u32 get32(u32 param_0) const { return mReader.get32(param_0); }
|
||||
void* getCur() { return mReader.getCur(); }
|
||||
u32 readByte() { return mReader.readByte(); }
|
||||
u32 read16() { return mReader.read16(); }
|
||||
u32 read24() { return mReader.read24(); }
|
||||
bool call(u32 param_0) { return mReader.call(param_0); }
|
||||
bool ret() { return mReader.ret(); }
|
||||
void jump(u32 param_0) { mReader.jump(param_0); }
|
||||
bool loopStart(u32 param_0) { return mReader.loopStart(param_0); }
|
||||
bool loopEnd() { return mReader.loopEnd(); }
|
||||
int readMidiValue() { return mReader.readMidiValue(); }
|
||||
void wait(s32 param_0) { field_0x40 = param_0; }
|
||||
void clrIntr() { field_0x44 = NULL; }
|
||||
void setIntrTable(u32 param_0) { field_0x48 = param_0; }
|
||||
void setIntrTimer(u32 param_0, u32 param_1) {
|
||||
field_0x50 = param_0;
|
||||
field_0x54 = param_1;
|
||||
field_0x58 = param_1;
|
||||
}
|
||||
void waitNoteFinish() { field_0x51 = 1; }
|
||||
|
||||
/* 0x00 */ JASSeqReader mReader;
|
||||
/* 0x3c */ JASSeqParser* field_0x3c;
|
||||
/* 0x40 */ s32 field_0x40;
|
||||
/* 0x44 */ void* field_0x44;
|
||||
/* 0x48 */ u32 field_0x48;
|
||||
/* 0x4c */ u16 field_0x4c;
|
||||
/* 0x4e */ u16 field_0x4e;
|
||||
/* 0x50 */ u8 field_0x50;
|
||||
/* 0x51 */ u8 field_0x51;
|
||||
/* 0x52 */ u16 field_0x52;
|
||||
/* 0x54 */ u32 field_0x54;
|
||||
/* 0x58 */ u32 field_0x58;
|
||||
static JASSeqParser sDefaultParser;
|
||||
};
|
||||
|
||||
#endif /* JASSEQCTRL_H */
|
||||
@@ -0,0 +1,100 @@
|
||||
#ifndef JASSEQPARSER_H
|
||||
#define JASSEQPARSER_H
|
||||
|
||||
#include <types.h>
|
||||
|
||||
struct JASTrack;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JASSeqParser {
|
||||
public:
|
||||
enum BranchCondition {};
|
||||
|
||||
struct CmdInfo {
|
||||
s32 (JASSeqParser::*field_0x0)(JASTrack*, u32*);
|
||||
u16 field_0xc;
|
||||
u16 field_0xe;
|
||||
};
|
||||
|
||||
virtual ~JASSeqParser() {}
|
||||
virtual s32 parse(JASTrack*);
|
||||
virtual s32 execNoteOnMidi(JASTrack*, u32, u32, u32);
|
||||
virtual s32 execNoteOnGate(JASTrack*, u32, u32, u32, u32);
|
||||
virtual s32 execNoteOff(JASTrack*, u32);
|
||||
virtual s32 execCommand(JASTrack*, s32 (JASSeqParser::*)(JASTrack*, u32*), u32, u32*);
|
||||
|
||||
bool conditionCheck(JASTrack*, JASSeqParser::BranchCondition);
|
||||
void writeReg(JASTrack*, u32, u32);
|
||||
u32 readReg(JASTrack*, u32) const;
|
||||
s32 cmdOpenTrack(JASTrack*, u32*);
|
||||
s32 cmdCloseTrack(JASTrack*, u32*);
|
||||
s32 cmdCall(JASTrack*, u32*);
|
||||
s32 cmdCallF(JASTrack*, u32*);
|
||||
s32 cmdRet(JASTrack*, u32*);
|
||||
s32 cmdRetF(JASTrack*, u32*);
|
||||
s32 cmdJmp(JASTrack*, u32*);
|
||||
s32 cmdJmpF(JASTrack*, u32*);
|
||||
s32 cmdJmpTable(JASTrack*, u32*);
|
||||
s32 cmdCallTable(JASTrack*, u32*);
|
||||
s32 cmdLoopS(JASTrack*, u32*);
|
||||
s32 cmdLoopE(JASTrack*, u32*);
|
||||
s32 cmdNote(JASTrack*, u32*);
|
||||
s32 cmdNoteOn(JASTrack*, u32*);
|
||||
s32 cmdNoteOff(JASTrack*, u32*);
|
||||
s32 cmdReadPort(JASTrack*, u32*);
|
||||
s32 cmdWritePort(JASTrack*, u32*);
|
||||
s32 cmdParentWritePort(JASTrack*, u32*);
|
||||
s32 cmdChildWritePort(JASTrack*, u32*);
|
||||
s32 cmdParentReadPort(JASTrack*, u32*);
|
||||
s32 cmdChildReadPort(JASTrack*, u32*);
|
||||
s32 cmdCheckPortImport(JASTrack*, u32*);
|
||||
s32 cmdCheckPortExport(JASTrack*, u32*);
|
||||
s32 cmdWait(JASTrack*, u32*);
|
||||
s32 cmdWaitByte(JASTrack*, u32*);
|
||||
s32 cmdSetLastNote(JASTrack*, u32*);
|
||||
s32 cmdEnvScaleSet(JASTrack*, u32*);
|
||||
s32 cmdEnvSet(JASTrack*, u32*);
|
||||
s32 cmdSimpleADSR(JASTrack*, u32*);
|
||||
s32 cmdBusConnect(JASTrack*, u32*);
|
||||
s32 cmdSetIntTable(JASTrack*, u32*);
|
||||
s32 cmdSetInterrupt(JASTrack*, u32*);
|
||||
s32 cmdDisInterrupt(JASTrack*, u32*);
|
||||
s32 cmdClrI(JASTrack*, u32*);
|
||||
s32 cmdRetI(JASTrack*, u32*);
|
||||
s32 cmdIntTimer(JASTrack*, u32*);
|
||||
s32 cmdSyncCPU(JASTrack*, u32*);
|
||||
s32 cmdTempo(JASTrack*, u32*);
|
||||
s32 cmdFinish(JASTrack*, u32*);
|
||||
s32 cmdNop(JASTrack*, u32*);
|
||||
s32 cmdFIRSet(JASTrack*, u32*);
|
||||
s32 cmdIIRSet(JASTrack*, u32*);
|
||||
s32 cmdIIRCutOff(JASTrack*, u32*);
|
||||
s32 cmdBankPrg(JASTrack*, u32*);
|
||||
s32 cmdBank(JASTrack*, u32*);
|
||||
s32 cmdPrg(JASTrack*, u32*);
|
||||
s32 cmdParamI(JASTrack*, u32*);
|
||||
s32 cmdParamII(JASTrack*, u32*);
|
||||
s32 cmdParamE(JASTrack*, u32*);
|
||||
s32 cmdParamEI(JASTrack*, u32*);
|
||||
s32 cmdReg(JASTrack*, u32*);
|
||||
s32 cmdRegLoad(JASTrack*, u32*);
|
||||
s32 cmdRegUni(JASTrack*, u32*);
|
||||
s32 cmdRegTblLoad(JASTrack*, u32*);
|
||||
s32 cmdDump(JASTrack*, u32*);
|
||||
s32 cmdPrintf(JASTrack*, u32*);
|
||||
s32 parseNoteOff(JASTrack*, u8);
|
||||
s32 parseNoteOn(JASTrack*, u8);
|
||||
s32 parseCommand(JASTrack*, u8, u16);
|
||||
s32 parseRegCommand(JASTrack*, int);
|
||||
|
||||
static void registerSeqCallback(u16 (*param_0)(JASTrack*, u16)) { sCallBackFunc = param_0; }
|
||||
|
||||
static CmdInfo sCmdInfo[96];
|
||||
static CmdInfo sExtCmdInfo[255];
|
||||
static u16 (*sCallBackFunc)(JASTrack*, u16);
|
||||
};
|
||||
|
||||
#endif /* JASSEQPARSER_H */
|
||||
@@ -0,0 +1,73 @@
|
||||
#ifndef JASSEQREADER_H
|
||||
#define JASSEQREADER_H
|
||||
|
||||
#include <types.h>
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JASSeqReader {
|
||||
public:
|
||||
JASSeqReader() { init(); }
|
||||
void init();
|
||||
void init(void*);
|
||||
bool call(u32);
|
||||
bool loopStart(u32);
|
||||
bool loopEnd();
|
||||
bool ret();
|
||||
int readMidiValue();
|
||||
|
||||
void jump(u32 param_1) {
|
||||
field_0x04 = field_0x00 + param_1;
|
||||
}
|
||||
|
||||
void jump(void* param_1) {
|
||||
field_0x04 = (u8*)param_1;
|
||||
}
|
||||
|
||||
u32 get24(u32 param_0) const {
|
||||
return (*(u32*)(field_0x00 + param_0 - 1)) & 0xffffff;
|
||||
}
|
||||
|
||||
u32* getBase() { return (u32*)field_0x00; }
|
||||
void* getAddr(u32 param_0) { return field_0x00 + param_0; }
|
||||
u8 getByte(u32 param_0) const { return *(field_0x00 + param_0); }
|
||||
u16 get16(u32 param_0) const { return *(u16*)(field_0x00 + param_0); }
|
||||
u32 get32(u32 param_0) const { return *(u32*)(field_0x00 + param_0); }
|
||||
u8* getCur() { return field_0x04; }
|
||||
u32 readByte() { return *field_0x04++; }
|
||||
u32 read16() {
|
||||
#ifdef __MWERKS__
|
||||
return *((u16*)field_0x04)++;
|
||||
#else
|
||||
u16* value = (u16*)field_0x04;
|
||||
field_0x04 += 2;
|
||||
return *value;
|
||||
#endif
|
||||
}
|
||||
u32 read24() {
|
||||
field_0x04--;
|
||||
#ifdef __MWERKS__
|
||||
return (*((u32*)field_0x04)++) & 0x00ffffff;
|
||||
#else
|
||||
u32* value = (u32*)field_0x04;
|
||||
field_0x04 += 4;
|
||||
return (*value) & 0x00ffffff;
|
||||
#endif
|
||||
}
|
||||
u16 getLoopCount() const {
|
||||
if (field_0x08 == 0) {
|
||||
return 0;
|
||||
}
|
||||
return field_0x2c[field_0x08 - 1];
|
||||
}
|
||||
|
||||
/* 0x00 */ u8* field_0x00;
|
||||
/* 0x04 */ u8* field_0x04;
|
||||
/* 0x08 */ u32 field_0x08;
|
||||
/* 0x0C */ u16* field_0x0c[8];
|
||||
/* 0x2C */ u16 field_0x2c[8];
|
||||
};
|
||||
|
||||
#endif /* JASSEQREADER_H */
|
||||
@@ -0,0 +1,30 @@
|
||||
#ifndef JASSIMPLEWAVEBANK_H
|
||||
#define JASSIMPLEWAVEBANK_H
|
||||
|
||||
#include "JSystem/JAudio2/JASBasicWaveBank.h"
|
||||
#include "JSystem/JAudio2/JASWaveInfo.h"
|
||||
#include "JSystem/JKernel/JKRHeap.h"
|
||||
|
||||
struct JASSimpleWaveBank : JASWaveBank, JASWaveArc {
|
||||
struct TWaveHandle : JASWaveHandle {
|
||||
intptr_t getWavePtr() const;
|
||||
TWaveHandle();
|
||||
const JASWaveInfo* getWaveInfo() const;
|
||||
|
||||
/* 0x04 */ JASWaveInfo mWaveInfo;
|
||||
/* 0x28 */ JASHeap* mHeap;
|
||||
};
|
||||
|
||||
JASSimpleWaveBank();
|
||||
~JASSimpleWaveBank();
|
||||
void setWaveTableSize(u32, JKRHeap*);
|
||||
JASWaveHandle* getWaveHandle(u32) const;
|
||||
void setWaveInfo(u32, JASWaveInfo const&);
|
||||
JASWaveArc* getWaveArc(u32);
|
||||
u32 getArcCount() const;
|
||||
|
||||
/* 0x78 */ TWaveHandle* mWaveTable;
|
||||
/* 0x7C */ u32 mWaveTableSize;
|
||||
};
|
||||
|
||||
#endif /* JASSIMPLEWAVEBANK_H */
|
||||
@@ -0,0 +1,71 @@
|
||||
#ifndef JASSOUNDPARAMS_H
|
||||
#define JASSOUNDPARAMS_H
|
||||
|
||||
#include <types.h>
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JASSoundParams {
|
||||
void clamp();
|
||||
void combine(JASSoundParams const&, JASSoundParams const&);
|
||||
|
||||
void initVolume() { mVolume = 1.0f; }
|
||||
void initFxMix() { mFxMix = 0.0f; }
|
||||
void initPitch() { mPitch = 1.0f; }
|
||||
void initPan() { mPan = 0.5f; }
|
||||
void initDolby() { mDolby = 0.0f; }
|
||||
void init() {
|
||||
initVolume();
|
||||
initPitch();
|
||||
initFxMix();
|
||||
initPan();
|
||||
initDolby();
|
||||
}
|
||||
|
||||
JASSoundParams() { init(); }
|
||||
|
||||
void clampVolume() {
|
||||
if (mVolume < 0.0f)
|
||||
mVolume = 0.0f;
|
||||
else if (mVolume > 1.0f)
|
||||
mVolume = 1.0f;
|
||||
}
|
||||
|
||||
void clampFxMix(void) {
|
||||
if (mFxMix < 0.0f)
|
||||
mFxMix = 0.0f;
|
||||
else if (mFxMix > 1.0f)
|
||||
mFxMix = 1.0f;
|
||||
}
|
||||
|
||||
void clampPitch() {
|
||||
if (mPitch < 0.0f)
|
||||
mPitch = 0.0f;
|
||||
else if (mPitch > 8.0f)
|
||||
mPitch = 8.0f;
|
||||
}
|
||||
|
||||
void clampPan() {
|
||||
if (mPan < 0.0f)
|
||||
mPan = 0.0f;
|
||||
else if (mPan > 1.0f)
|
||||
mPan = 1.0f;
|
||||
}
|
||||
|
||||
void clampDolby() {
|
||||
if (mDolby < 0.0f)
|
||||
mDolby = 0.0f;
|
||||
else if (mDolby > 1.0f)
|
||||
mDolby = 1.0f;
|
||||
}
|
||||
|
||||
/* 0x00 */ f32 mVolume;
|
||||
/* 0x04 */ f32 mFxMix;
|
||||
/* 0x08 */ f32 mPitch;
|
||||
/* 0x0C */ f32 mPan;
|
||||
/* 0x10 */ f32 mDolby;
|
||||
}; // Size: 0x14
|
||||
|
||||
#endif /* JASSOUNDPARAMS_H */
|
||||
@@ -0,0 +1,40 @@
|
||||
#ifndef JASTASKTHREAD_H
|
||||
#define JASTASKTHREAD_H
|
||||
|
||||
#include "JSystem/JKernel/JKRThread.h"
|
||||
#include "JSystem/JAudio2/JASHeapCtrl.h"
|
||||
|
||||
typedef void (*JASThreadCallback)(void*);
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JASTaskThread : public JKRThread {
|
||||
private:
|
||||
struct JASThreadCallStack {
|
||||
/* 0x00 */ JASThreadCallback callback_;
|
||||
/* 0x04 */ u32 msgType_;
|
||||
/* 0x08 */ union {
|
||||
u8 buffer[0x400];
|
||||
void* bufferPtr;
|
||||
} msg;
|
||||
};
|
||||
public:
|
||||
typedef JASMemChunkPool<1024, JASThreadingModel::ObjectLevelLockable> ThreadMemPool;
|
||||
|
||||
JASTaskThread(int priority, int msgCount, u32 stackSize);
|
||||
void* allocCallStack(JASThreadCallback callback, void* msg);
|
||||
void* allocCallStack(JASThreadCallback callback, const void* msg, u32 msgSize);
|
||||
int sendCmdMsg(JASThreadCallback callback, void* msg);
|
||||
int sendCmdMsg(JASThreadCallback callback, const void* msg, u32 msgSize);
|
||||
void pause(bool);
|
||||
|
||||
virtual ~JASTaskThread();
|
||||
virtual void* run();
|
||||
|
||||
/* 0x7C */ OSThreadQueue threadQueue_;
|
||||
/* 0x84 */ bool field_0x84;
|
||||
};
|
||||
|
||||
#endif /* JASTASKTHREAD_H */
|
||||
@@ -0,0 +1,278 @@
|
||||
#ifndef JASTRACK_H
|
||||
#define JASTRACK_H
|
||||
|
||||
#include "JSystem/JAudio2/JASBankTable.h"
|
||||
#include "JSystem/JAudio2/JASChannel.h"
|
||||
#include "JSystem/JAudio2/JASRegisterParam.h"
|
||||
#include "JSystem/JAudio2/JASSeqCtrl.h"
|
||||
#include "JSystem/JAudio2/JASTrackPort.h"
|
||||
#include "JSystem/JGadget/linklist.h"
|
||||
#include "global.h"
|
||||
|
||||
struct JASSoundParams;
|
||||
|
||||
namespace JASDsp {
|
||||
struct TChannel;
|
||||
|
||||
extern const u32 FILTER_MODE_IIR;
|
||||
};
|
||||
|
||||
#if !BIT_64
|
||||
const int JASTrackNodeOffset = 0x240;
|
||||
#else
|
||||
const int JASTrackNodeOffset = 0x310;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
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_STOPPED,
|
||||
};
|
||||
|
||||
struct TChannelMgr : public JASPoolAllocObject_MultiThreaded<TChannelMgr> {
|
||||
TChannelMgr(JASTrack*);
|
||||
void init();
|
||||
void releaseAll();
|
||||
bool noteOff(u32, u16);
|
||||
void setPauseFlag(bool);
|
||||
|
||||
static const int CHANNEL_MAX = 8;
|
||||
|
||||
/* 0x00 */ JASChannel* mChannels[CHANNEL_MAX];
|
||||
/* 0x20 */ JASChannelParams mParams;
|
||||
/* 0x38 */ s16 field_0x38[CHANNEL_MAX];
|
||||
/* 0x48 */ JASSoundParams* mSoundParams;
|
||||
/* 0x4c */ JASTrack* mTrack;
|
||||
};
|
||||
|
||||
struct TList : JGadget::TLinkList<JASTrack, JASTrackNodeOffset> {
|
||||
TList() : mCallbackRegistered(false) {}
|
||||
void append(JASTrack*);
|
||||
void seqMain();
|
||||
~TList() {}
|
||||
|
||||
static s32 cbSeqMain(void*);
|
||||
|
||||
/* 0xC */ bool mCallbackRegistered;
|
||||
};
|
||||
|
||||
struct MoveParam_ {
|
||||
// TODO: fix this on debug
|
||||
#if VERSION != VERSION_SHIELD_DEBUG
|
||||
MoveParam_() : mValue(0.0f), mTarget(0.0f), mCount(0) {}
|
||||
#endif
|
||||
|
||||
/* 0x00 */ f32 mValue;
|
||||
/* 0x04 */ f32 mTarget;
|
||||
/* 0x08 */ u32 mCount;
|
||||
};
|
||||
|
||||
JASTrack();
|
||||
~JASTrack();
|
||||
void setChannelMgrCount(u32);
|
||||
void init();
|
||||
void initTimed();
|
||||
void inherit(JASTrack const&);
|
||||
void assignExtBuffer(u32, JASSoundParams*);
|
||||
void setSeqData(void*, u32);
|
||||
void startSeq();
|
||||
void stopSeq();
|
||||
void start();
|
||||
void close();
|
||||
bool connectChild(u32, 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);
|
||||
int gateOn(u32, u32, f32, u32);
|
||||
int noteOff(u32, u16);
|
||||
bool checkNoteStop(u32) const;
|
||||
void overwriteOsc(JASChannel*);
|
||||
void updateTimedParam();
|
||||
void updateTrack(f32);
|
||||
void updateTempo();
|
||||
void updateSeq(bool, f32);
|
||||
u32 seqTimeToDspTime(f32);
|
||||
void setParam(u32, f32, u32);
|
||||
void noteOffAll(u16);
|
||||
void mute(bool);
|
||||
void setOscScale(u32, f32);
|
||||
void setOscTable(u32, JASOscillator::Point const*);
|
||||
void setOscAdsr(s16, s16, s16, s16, u16);
|
||||
void setFIR(s16 const*);
|
||||
void setIIR(s16 const*);
|
||||
u16 readPortSelf(u32);
|
||||
void writePortSelf(u32, u16);
|
||||
void writePort(u32, u16);
|
||||
u16 readPort(u32);
|
||||
void setChannelPauseFlag(bool);
|
||||
void pause(bool);
|
||||
int getTransposeTotal() const;
|
||||
bool isMute() const;
|
||||
void setTempo(u16);
|
||||
void setTempoRate(f32);
|
||||
void setTimebase(u16);
|
||||
void updateChannel(JASChannel*, JASDsp::TChannel*);
|
||||
JASTrack* getRootTrack();
|
||||
int getChannelCount() const;
|
||||
int tickProc();
|
||||
int seqMain();
|
||||
|
||||
static void channelUpdateCallback(u32, JASChannel*, JASDsp::TChannel*, void*);
|
||||
|
||||
static JASOscillator::Point const sAdsTable[4];
|
||||
static JASOscillator::Data const sEnvOsc;
|
||||
static JASOscillator::Data const sPitchEnvOsc;
|
||||
|
||||
static JASDefaultBankTable sDefaultBankTable;
|
||||
static TList sTrackList;
|
||||
|
||||
static const int MAX_CHILDREN = 16;
|
||||
|
||||
JASSeqCtrl* getSeqCtrl() { return &mSeqCtrl; }
|
||||
u16 getPort(u32 param_0) const { return mTrackPort.get(param_0); }
|
||||
void setPort(u32 param_0, u16 param_1) { mTrackPort.set(param_0, param_1); }
|
||||
u32 checkPortIn(u32 param_0) const { return mTrackPort.checkImport(param_0); }
|
||||
u32 checkPort(u32 param_0) const { return mTrackPort.checkExport(param_0); }
|
||||
u32 readReg(JASRegisterParam::RegID param_0) { return mRegisterParam.read(param_0); }
|
||||
void writeReg(JASRegisterParam::RegID param_0, u32 param_1) { mRegisterParam.write(param_0, param_1); }
|
||||
JASTrack* getParent() { return mParent; }
|
||||
JASTrack* getChild(u32 index) {
|
||||
JUT_ASSERT(115, index < MAX_CHILDREN)
|
||||
return mChildren[index];
|
||||
}
|
||||
int getChannelMgrCount() const { return mChannelMgrCount; }
|
||||
f32 getVibDepth() const { return mVibDepth; }
|
||||
void setVibDepth(f32 param_0) { mVibDepth = param_0; }
|
||||
f32 getVibPitch() const { return mVibPitch; }
|
||||
void setVibPitch(f32 param_0) { mVibPitch = param_0; }
|
||||
f32 getTremDepth() const { return mTremDepth; }
|
||||
void setTremDepth(f32 param_0) { mTremDepth = param_0; }
|
||||
f32 getTremPitch() const { return mTremPitch; }
|
||||
void setTremPitch(f32 param_0) { mTremPitch = param_0; }
|
||||
u32 getVibDelay() const { return mVibDelay; }
|
||||
void setVibDelay(u32 param_0) { mVibDelay = param_0; }
|
||||
u32 getTremDelay() const { return mTremDelay; }
|
||||
void setTremDelay(u32 param_0) { mTremDelay = param_0; }
|
||||
u8 getStatus() const { return mStatus; }
|
||||
void setAutoDelete(bool param_0) { mFlags.autoDelete = param_0; }
|
||||
f32 getPanPower() const { return mPanPower; }
|
||||
void setPanPower(f32 param_0) { mPanPower = param_0; }
|
||||
u32 getSkipSample() const { return mSkipSample; }
|
||||
void setSkipSample(u32 param_0) { mSkipSample = param_0; }
|
||||
u16 getDirectRelease() const { return mDirectRelease; }
|
||||
void setDirectRelease(u16 param_0) {mDirectRelease = param_0; }
|
||||
u16 getTimebase() const { return mTimebase; }
|
||||
int getTranspose() const { return mTranspose; }
|
||||
void setTranspose(s32 param_0) { mTranspose = param_0; }
|
||||
u16 getBankNumber() const { return mBankNumber; }
|
||||
void setBankNumber(u16 param_0) { mBankNumber = param_0; }
|
||||
u16 getProgNumber() const { return mProgNumber; }
|
||||
void setProgNumber(u16 param_0) { mProgNumber = param_0; }
|
||||
u8 getBendSense() const { return mBendSense; }
|
||||
void setBendSense(u8 param_0) { mBendSense = param_0; }
|
||||
u8 getNoteOnPrio() const { return mNoteOnPrio; }
|
||||
void setNoteOnPrio(u8 param_0) { mNoteOnPrio = param_0; }
|
||||
u8 getReleasePrio() const { return mReleasePrio; }
|
||||
void setReleasePrio(u8 param_0) { mReleasePrio = param_0; }
|
||||
u8 getGateRate() const { return mGateRate; }
|
||||
void setGateRate(u8 param_0) { mGateRate = param_0; }
|
||||
|
||||
/* 0x000 */ JASSeqCtrl mSeqCtrl;
|
||||
/* 0x05C */ JASTrackPort mTrackPort;
|
||||
/* 0x080 */ JASRegisterParam mRegisterParam;
|
||||
#ifdef __MWERKS__
|
||||
/* 0x09C */ union {
|
||||
struct {
|
||||
MoveParam_ volume;
|
||||
MoveParam_ pitch;
|
||||
MoveParam_ fxmix;
|
||||
MoveParam_ pan;
|
||||
MoveParam_ dolby;
|
||||
MoveParam_ distFilter;
|
||||
} params;
|
||||
MoveParam_ array[TIMED_PARAMS];
|
||||
} mMoveParam;
|
||||
#else
|
||||
/* 0x09C */ union MoveParam_u {
|
||||
struct {
|
||||
MoveParam_ volume;
|
||||
MoveParam_ pitch;
|
||||
MoveParam_ fxmix;
|
||||
MoveParam_ pan;
|
||||
MoveParam_ dolby;
|
||||
MoveParam_ distFilter;
|
||||
} params;
|
||||
MoveParam_ array[TIMED_PARAMS];
|
||||
MoveParam_u() {}
|
||||
} mMoveParam;
|
||||
#endif
|
||||
/* 0x0e4 */ JASOscillator::Data mOscParam[OSC_NUM];
|
||||
/* 0x114 */ JASOscillator::Point mOscPoint[4];
|
||||
/* 0x12C */ JASTrack* mParent;
|
||||
/* 0x130 */ JASTrack* mChildren[MAX_CHILDREN];
|
||||
/* 0x170 */ TChannelMgr* mChannelMgrs[CHANNEL_MGR_MAX];
|
||||
/* 0x180 */ TChannelMgr mDefaultChannelMgr;
|
||||
/* 0x1D0 */ u32 mChannelMgrCount;
|
||||
/* 0x1D4 */ const JASDefaultBankTable* mBankTable;
|
||||
/* 0x1D8 */ f32 field_0x1d8;
|
||||
/* 0x1DC */ f32 field_0x1dc;
|
||||
/* 0x1E0 */ f32 mVibDepth;
|
||||
/* 0x1E4 */ f32 mVibPitch;
|
||||
/* 0x1E8 */ f32 mTremDepth;
|
||||
/* 0x1EC */ f32 mTremPitch;
|
||||
/* 0x1F0 */ u16 mVibDelay;
|
||||
/* 0x1F2 */ u16 mTremDelay;
|
||||
/* 0x1F4 */ short mFIR[8];
|
||||
/* 0x204 */ short mIIR[8];
|
||||
/* 0x214 */ u8 mFilterMode;
|
||||
/* 0x215 */ volatile u8 mStatus;
|
||||
/* 0x216 */ struct {
|
||||
bool pause : 1;
|
||||
bool mute : 1;
|
||||
bool flag2 : 1;
|
||||
bool autoDelete : 1;
|
||||
bool flag4 : 1;
|
||||
bool flag5 : 1;
|
||||
bool flag6 : 1;
|
||||
bool flag7 : 1;
|
||||
} mFlags;
|
||||
/* 0x218 */ f32 mPanPower;
|
||||
/* 0x21C */ f32 mTempoRate;
|
||||
/* 0x220 */ u32 mSkipSample;
|
||||
/* 0x224 */ u16 mDirectRelease;
|
||||
/* 0x226 */ u16 mTempo;
|
||||
/* 0x228 */ u16 mTimebase;
|
||||
/* 0x22A */ s8 mTranspose;
|
||||
/* 0x22B */ u8 field_0x22b;
|
||||
/* 0x22C */ u16 mBankNumber;
|
||||
/* 0x22E */ u16 mProgNumber;
|
||||
/* 0x230 */ u8 mBendSense;
|
||||
/* 0x231 */ u8 mNoteOnPrio;
|
||||
/* 0x232 */ u8 mReleasePrio;
|
||||
/* 0x233 */ u8 mGateRate;
|
||||
/* 0x234 */ u16 mMixConfig[6];
|
||||
/* 0x240 */ JGadget::TLinkListNode field_0x240;
|
||||
};
|
||||
|
||||
#if TARGET_PC
|
||||
static_assert(offsetof(JASTrack, field_0x240) == JASTrackNodeOffset);
|
||||
#endif
|
||||
|
||||
#endif /* JASTRACK_H */
|
||||
@@ -0,0 +1,30 @@
|
||||
#ifndef JASTRACKPORT_H
|
||||
#define JASTRACKPORT_H
|
||||
|
||||
#include <types.h>
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JASTrackPort {
|
||||
public:
|
||||
static const int MAX_PORTS = 16;
|
||||
|
||||
void init();
|
||||
u16 readImport(u32);
|
||||
u16 readExport(u32);
|
||||
void writeImport(u32, u16);
|
||||
void writeExport(u32, u16);
|
||||
u32 checkImport(u32) const;
|
||||
u32 checkExport(u32) const;
|
||||
|
||||
u16 get(u32 param_0) const { return field_0x4[param_0]; }
|
||||
void set(u32 param_0, u16 param_1) { field_0x4[param_0] = param_1; }
|
||||
|
||||
u16 field_0x0;
|
||||
u16 field_0x2;
|
||||
u16 field_0x4[MAX_PORTS];
|
||||
};
|
||||
|
||||
#endif /* JASTRACKPORT_H */
|
||||
@@ -0,0 +1,21 @@
|
||||
#ifndef JASVOICEBANK_H
|
||||
#define JASVOICEBANK_H
|
||||
|
||||
#include "JSystem/JAudio2/JASBank.h"
|
||||
#include "JSystem/JAudio2/JASOscillator.h"
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JASVoiceBank : public JASBank {
|
||||
public:
|
||||
virtual bool getInstParam(int, int, int, JASInstParam*) const;
|
||||
virtual ~JASVoiceBank();
|
||||
virtual u32 getType() const;
|
||||
|
||||
static const JASOscillator::Data sOscData;
|
||||
static JASOscillator::Data* sOscTable;
|
||||
};
|
||||
|
||||
#endif /* JASVOICEBANK_H */
|
||||
@@ -0,0 +1,90 @@
|
||||
#ifndef JASWSPARSER_H
|
||||
#define JASWSPARSER_H
|
||||
|
||||
#include "JSystem/JSupport/JSupport.h"
|
||||
|
||||
class JKRHeap;
|
||||
class JASWaveBank;
|
||||
struct JASBasicWaveBank;
|
||||
struct JASSimpleWaveBank;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JASWSParser {
|
||||
public:
|
||||
template<class T>
|
||||
class TOffset {
|
||||
public:
|
||||
T* ptr(void const* param_0) const {
|
||||
return JSUConvertOffsetToPtr<T>(param_0, mOffset);
|
||||
}
|
||||
|
||||
private:
|
||||
/* 0x0 */ BE(u32) mOffset;
|
||||
};
|
||||
|
||||
struct TCtrlWave {
|
||||
/* 0x0 */ BE(u32) _00;
|
||||
};
|
||||
|
||||
struct TWave {
|
||||
/* 0x00 */ u8 _00;
|
||||
/* 0x01 */ u8 _01;
|
||||
/* 0x02 */ u8 _02;
|
||||
/* 0x04 */ BE(f32) _04;
|
||||
/* 0x08 */ BE(u32) mOffset;
|
||||
/* 0x0C */ BE(u32) _0C;
|
||||
/* 0x10 */ BE(u32) _10;
|
||||
/* 0x14 */ BE(u32) _14;
|
||||
/* 0x18 */ BE(u32) _18;
|
||||
/* 0x1C */ BE(u32) _1C;
|
||||
/* 0x20 */ BE(s16) _20;
|
||||
/* 0x22 */ BE(s16) _22;
|
||||
};
|
||||
|
||||
struct TWaveArchive {
|
||||
/* 0x00 */ char mFileName[0x74]; // unknown length
|
||||
/* 0x74 */ TOffset<TWave> mWaveOffsets[0];
|
||||
};
|
||||
|
||||
struct TWaveArchiveBank {
|
||||
/* 0x0 */ u8 _00[8];
|
||||
/* 0x8 */ TOffset<TWaveArchive> mArchiveOffsets[0];
|
||||
};
|
||||
|
||||
struct TCtrl {
|
||||
/* 0x0 */ u8 _00[4];
|
||||
/* 0x4 */ BE(u32) mWaveCount;
|
||||
/* 0x8 */ TOffset<TCtrlWave> mCtrlWaveOffsets[0];
|
||||
};
|
||||
|
||||
struct TCtrlScene {
|
||||
/* 0x0 */ u8 _00[0xC];
|
||||
/* 0xC */ TOffset<TCtrl> mCtrlOffset;
|
||||
};
|
||||
|
||||
struct TCtrlGroup {
|
||||
/* 0x0 */ u8 _00[8];
|
||||
/* 0x8 */ BE(u32) mGroupCount;
|
||||
/* 0xC */ TOffset<TCtrlScene> mCtrlSceneOffsets[0];
|
||||
};
|
||||
|
||||
/** @fabricated */
|
||||
struct THeader {
|
||||
/* 0x00 */ u8 _00[0xC];
|
||||
/* 0x0C */ BE(u32) mWaveTableSize;
|
||||
/* 0x10 */ TOffset<TWaveArchiveBank> mArchiveBankOffset;
|
||||
/* 0x14 */ TOffset<TCtrlGroup> mCtrlGroupOffset;
|
||||
};
|
||||
|
||||
static u32 getGroupCount(void const*);
|
||||
static JASWaveBank* createWaveBank(void const*, JKRHeap*);
|
||||
static JASBasicWaveBank* createBasicWaveBank(void const*, JKRHeap*);
|
||||
static JASSimpleWaveBank* createSimpleWaveBank(void const*, JKRHeap*);
|
||||
|
||||
static u32 sUsedHeapSize;
|
||||
};
|
||||
|
||||
#endif /* JASWSPARSER_H */
|
||||
@@ -0,0 +1,76 @@
|
||||
#ifndef JASWAVEARCLOADER_H
|
||||
#define JASWAVEARCLOADER_H
|
||||
|
||||
#include "JSystem/JAudio2/JASHeapCtrl.h"
|
||||
#include <os.h>
|
||||
|
||||
class JKRHeap;
|
||||
class JKRSolidHeap;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JASDisposer {
|
||||
JASDisposer() {}
|
||||
virtual ~JASDisposer() {}
|
||||
virtual void onDispose() {}
|
||||
};
|
||||
|
||||
#define DIR_MAX 64
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JASWaveArcLoader {
|
||||
static JASHeap* getRootHeap();
|
||||
static void setCurrentDir(char const*);
|
||||
static char* getCurrentDir();
|
||||
|
||||
static char sCurrentDir[DIR_MAX];
|
||||
static JASHeap* sAramHeap;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JASWaveArc : JASDisposer {
|
||||
JASWaveArc();
|
||||
bool loadSetup(u32);
|
||||
bool eraseSetup();
|
||||
static void loadToAramCallback(void*);
|
||||
bool sendLoadCmd();
|
||||
bool load(JASHeap*);
|
||||
bool loadTail(JASHeap*);
|
||||
bool erase();
|
||||
void setEntryNum(s32);
|
||||
void setFileName(char const*);
|
||||
|
||||
virtual ~JASWaveArc();
|
||||
virtual void onDispose();
|
||||
virtual void onLoadDone() {}
|
||||
virtual void onEraseDone() {}
|
||||
|
||||
s32 getStatus() const { return mStatus; }
|
||||
|
||||
struct loadToAramCallbackParams {
|
||||
// not official struct name
|
||||
/* 0x0 */ JASWaveArc* mWavArc;
|
||||
/* 0x4 */ s32 mEntryNum;
|
||||
/* 0x8 */ u32 mBase;
|
||||
/* 0xC */ u32 _c;
|
||||
};
|
||||
|
||||
/* 0x04 */ mutable JASHeap mHeap;
|
||||
/* 0x48 */ u32 _48;
|
||||
/* 0x4C */ volatile s32 mStatus;
|
||||
/* 0x50 */ int mEntryNum;
|
||||
/* 0x54 */ u32 mFileLength;
|
||||
/* 0x58 */ u16 _58;
|
||||
/* 0x5A */ u16 _5a;
|
||||
/* 0x5C */ OSMutex mMutex;
|
||||
};
|
||||
|
||||
#endif /* JASWAVEARCLOADER_H */
|
||||
@@ -0,0 +1,57 @@
|
||||
#ifndef JASWAVEINFO_H
|
||||
#define JASWAVEINFO_H
|
||||
|
||||
#include <types.h>
|
||||
|
||||
class JASWaveArc;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JASWaveInfo {
|
||||
JASWaveInfo() {
|
||||
field_0x01 = 0x3c;
|
||||
field_0x20 = &one;
|
||||
}
|
||||
|
||||
/* 0x00 */ u8 field_0x00;
|
||||
/* 0x01 */ u8 field_0x01;
|
||||
/* 0x02 */ u8 field_0x02;
|
||||
/* 0x04 */ f32 field_0x04;
|
||||
/* 0x08 */ int field_0x08;
|
||||
/* 0x0C */ int field_0x0c;
|
||||
/* 0x10 */ u32 field_0x10;
|
||||
/* 0x14 */ int field_0x14;
|
||||
/* 0x18 */ int field_0x18;
|
||||
/* 0x1C */ s16 field_0x1c;
|
||||
/* 0x1E */ s16 field_0x1e;
|
||||
/* 0x20 */ const u32* field_0x20;
|
||||
|
||||
static u32 one;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JASWaveHandle {
|
||||
public:
|
||||
virtual ~JASWaveHandle() {}
|
||||
virtual const JASWaveInfo* getWaveInfo() const = 0;
|
||||
virtual intptr_t getWavePtr() const = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JASWaveBank {
|
||||
public:
|
||||
virtual ~JASWaveBank() {}
|
||||
virtual JASWaveHandle* getWaveHandle(u32) const = 0;
|
||||
virtual JASWaveArc* getWaveArc(u32) = 0;
|
||||
virtual u32 getArcCount() const = 0;
|
||||
};
|
||||
|
||||
#endif /* JASWAVEINFO_H */
|
||||
@@ -0,0 +1,36 @@
|
||||
#ifndef JAUAUDIBLEPARAM_H
|
||||
#define JAUAUDIBLEPARAM_H
|
||||
|
||||
#include <types.h>
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAUAudibleParam {
|
||||
f32 getDopplerPower() const {
|
||||
return (u32)((*(u8*)&field_0x0.raw >> 4) & 0xf) * (1.0f / 15.0f);
|
||||
}
|
||||
|
||||
union {
|
||||
struct {
|
||||
u16 f0;
|
||||
u16 f1;
|
||||
} half;
|
||||
struct {
|
||||
u8 b0_0 : 4;
|
||||
u8 b0_4 : 1;
|
||||
u8 b0_5 : 1;
|
||||
u8 b0_6 : 1;
|
||||
u8 b0_7 : 1;
|
||||
u8 b1_0 : 1;
|
||||
u8 b1_1 : 1;
|
||||
u8 b1_2_7 : 6;
|
||||
u8 b2;
|
||||
u8 b3;
|
||||
} bytes;
|
||||
u32 raw;
|
||||
} field_0x0;
|
||||
};
|
||||
|
||||
#endif /* JAUAUDIBLEPARAM_H */
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef JAUAUDIENCE_H
|
||||
#define JAUAUDIENCE_H
|
||||
|
||||
// NONMATCHING
|
||||
|
||||
#endif /* JAUAUDIENCE_H */
|
||||
@@ -0,0 +1,48 @@
|
||||
#ifndef JAUAUDIOARCINTERPRETER_H
|
||||
#define JAUAUDIOARCINTERPRETER_H
|
||||
|
||||
#include <types.h>
|
||||
#include "dusk/endian.h"
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAUAudioArcInterpreter {
|
||||
public:
|
||||
JAUAudioArcInterpreter();
|
||||
virtual ~JAUAudioArcInterpreter();
|
||||
virtual void readWS(u32, void const*, u32) = 0;
|
||||
virtual void readBNK(u32, void const*) = 0;
|
||||
virtual void readBSC(void const*, u32) = 0;
|
||||
virtual void readBST(void const*, u32) = 0;
|
||||
virtual void readBSTN(void const*, u32) = 0;
|
||||
virtual void readBMS(u32, void const*, u32) = 0;
|
||||
virtual void readBMS_fromArchive(u32) = 0;
|
||||
virtual void newVoiceBank(u32, u32) = 0;
|
||||
virtual void newDynamicSeqBlock(u32) = 0;
|
||||
virtual void readBSFT(void const*) = 0;
|
||||
virtual void readMaxSeCategory(int, int, int) = 0;
|
||||
virtual void beginBNKList(u32, u32) = 0;
|
||||
virtual void endBNKList() = 0;
|
||||
bool parse(void const*);
|
||||
virtual bool readCommandMore(u32);
|
||||
bool readCommand_();
|
||||
|
||||
u8 readU8_() {
|
||||
return *mReadPtr++;
|
||||
}
|
||||
|
||||
u32 readU32_() {
|
||||
u32 temp = *(BE(u32)*)mReadPtr;
|
||||
mReadPtr += 4;
|
||||
return temp;
|
||||
}
|
||||
const void* getContent_(u32 param_0) const { return mBase + param_0; }
|
||||
|
||||
|
||||
/* 0x04 */ const u8* mReadPtr;
|
||||
/* 0x08 */ const u8* mBase;
|
||||
};
|
||||
|
||||
#endif /* JAUAUDIOARCINTERPRETER_H */
|
||||
@@ -0,0 +1,53 @@
|
||||
#ifndef JAUAUDIOARCLOADER_H
|
||||
#define JAUAUDIOARCLOADER_H
|
||||
|
||||
#include "JSystem/JAudio2/JAUAudioArcInterpreter.h"
|
||||
|
||||
struct JAUSection;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAUAudioArcLoader : public JAUAudioArcInterpreter {
|
||||
public:
|
||||
JAUAudioArcLoader(JAUSection*);
|
||||
bool load(void const*);
|
||||
virtual void readWS(u32, void const*, u32);
|
||||
virtual void readBNK(u32, void const*);
|
||||
virtual void readBSC(void const*, u32);
|
||||
virtual void readBST(void const*, u32);
|
||||
virtual void readBSTN(void const*, u32);
|
||||
virtual void readBMS(u32, void const*, u32);
|
||||
virtual void readBMS_fromArchive(u32);
|
||||
virtual void newVoiceBank(u32, u32);
|
||||
virtual void newDynamicSeqBlock(u32);
|
||||
virtual void readBSFT(void const*);
|
||||
virtual void beginBNKList(u32, u32);
|
||||
virtual void endBNKList();
|
||||
virtual void readMaxSeCategory(int, int, int);
|
||||
virtual ~JAUAudioArcLoader() {}
|
||||
|
||||
/* 0x0C */ JAUSection* mSection;
|
||||
};
|
||||
|
||||
class JAUAudioArcLoader_withoutCopy : public JAUAudioArcInterpreter {
|
||||
virtual void readWS(u32, void const*, u32);
|
||||
virtual void readBNK(u32, void const*);
|
||||
virtual void readBSC(void const*, u32);
|
||||
virtual void readBST(void const*, u32);
|
||||
virtual void readBSTN(void const*, u32);
|
||||
virtual void readBMS(u32, void const*, u32);
|
||||
virtual void readBMS_fromArchive(u32);
|
||||
virtual void newVoiceBank(u32, u32);
|
||||
virtual void newDynamicSeqBlock(u32);
|
||||
virtual void readBSFT(void const*);
|
||||
virtual void beginBNKList(u32, u32);
|
||||
virtual void endBNKList();
|
||||
virtual void readMaxSeCategory(int, int, int);
|
||||
virtual ~JAUAudioArcLoader_withoutCopy() {}
|
||||
|
||||
/* 0x0C */ JAUSection* mSection;
|
||||
};
|
||||
|
||||
#endif /* JAUAUDIOARCLOADER_H */
|
||||
@@ -0,0 +1,4 @@
|
||||
#ifndef JAUAUDIOMGR_H
|
||||
#define JAUAUDIOMGR_H
|
||||
|
||||
#endif /* JAUAUDIOMGR_H */
|
||||
@@ -0,0 +1,58 @@
|
||||
#ifndef JAUBANKTABLE_H
|
||||
#define JAUBANKTABLE_H
|
||||
|
||||
#include "JSystem/JAudio2/JASBankList.h"
|
||||
#include "JSystem/JAudio2/JASGadget.h"
|
||||
#include "JSystem/JSupport/JSUList.h"
|
||||
|
||||
class JASBank;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAUBankTable : public JASBankList {
|
||||
public:
|
||||
JAUBankTable(u32 param_0, JASBank** param_1, u32 param_2) : mBankPtrTable(param_1, param_2) {
|
||||
field_0xc = param_0;
|
||||
}
|
||||
const JASBank* getBank(u32 bank) const { return mBankPtrTable.get(bank); }
|
||||
JASBank* getBank(u32 bank) { return mBankPtrTable.get(bank); }
|
||||
|
||||
void registBank(u32 param_0, JASBank* param_1) { mBankPtrTable.set(param_0, param_1); }
|
||||
|
||||
/* 0x4 */ JASPtrTable<JASBank> mBankPtrTable;
|
||||
/* 0xC */ u32 field_0xc;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAUBankTableLink : public JSULink<JAUBankTable>, public JAUBankTable {
|
||||
public:
|
||||
JAUBankTableLink(u32 param_0, JASBank** param_1, u32 param_2) : JSULink<JAUBankTable>(this), JAUBankTable(param_0, param_1, param_2) {}
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAUBankTableDictionary : JSUList<JAUBankTable> {
|
||||
void appendBankTable(JSULink<JAUBankTable>*);
|
||||
};
|
||||
|
||||
class JASWaveBank;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAUWaveBankTable : private JASPtrArray<JASWaveBank,255> {
|
||||
public:
|
||||
JASWaveBank* getWaveBank(u32 index) { return get(index); }
|
||||
JASWaveBank* getWaveBank(u32 index) const { return get(index); }
|
||||
void registWaveBank(u32 index, JASWaveBank* bank) { set(index, bank); }
|
||||
};
|
||||
|
||||
#endif /* JAUBANKTABLE_H */
|
||||
@@ -0,0 +1,4 @@
|
||||
#ifndef JAUCLUSTERSOUND_H
|
||||
#define JAUCLUSTERSOUND_H
|
||||
|
||||
#endif /* JAUCLUSTERSOUND_H */
|
||||
@@ -0,0 +1,47 @@
|
||||
#ifndef JAUINITIALIZER_H
|
||||
#define JAUINITIALIZER_H
|
||||
|
||||
#include <types.h>
|
||||
|
||||
class JKRSolidHeap;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAU_JASInitializer {
|
||||
public:
|
||||
JAU_JASInitializer();
|
||||
void initJASystem(JKRSolidHeap* heap);
|
||||
|
||||
/* 0x00 */ u32 audioMemory_;
|
||||
/* 0x04 */ u32 audioMemSize_;
|
||||
/* 0x08 */ int heapSize_;
|
||||
/* 0x0C */ int dvdThreadPriority_;
|
||||
/* 0x10 */ int audioThreadPriority_;
|
||||
/* 0x14 */ int dvdThreadId_;
|
||||
/* 0x18 */ int audioThreadId_;
|
||||
/* 0x1C */ int field_0x1c;
|
||||
/* 0x20 */ int field_0x20;
|
||||
/* 0x24 */ int aramBlockSize_;
|
||||
/* 0x28 */ int aramChannelNum_;
|
||||
/* 0x2C */ f32 dspLevel_;
|
||||
/* 0x30 */ char* waveArcDir_;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAU_JAIInitializer {
|
||||
public:
|
||||
JAU_JAIInitializer();
|
||||
void initJAInterface();
|
||||
|
||||
int field_0x0;
|
||||
int field_0x4;
|
||||
int field_0x8;
|
||||
int field_0xc;
|
||||
};
|
||||
|
||||
#endif /* JAUINITIALIZER_H */
|
||||
@@ -0,0 +1,136 @@
|
||||
#ifndef JAUSECTIONHEAP_H
|
||||
#define JAUSECTIONHEAP_H
|
||||
|
||||
#include "JSystem/JAudio2/JAUBankTable.h"
|
||||
#include "JSystem/JAudio2/JAUSeqDataBlockMgr.h"
|
||||
#include "JSystem/JKernel/JKRDisposer.h"
|
||||
#include <bitset>
|
||||
|
||||
struct JAISeqData;
|
||||
struct JAISeqDataMgr;
|
||||
struct JAISeqDataUser;
|
||||
struct JAIStreamDataMgr;
|
||||
class JASVoiceBank;
|
||||
class JAUBankTableLink;
|
||||
class JAUDisposer_;
|
||||
class JAUSectionHeap;
|
||||
struct JAUSoundTable;
|
||||
struct JAUSoundNameTable;
|
||||
class JKRArchive;
|
||||
class JKRSolidHeap;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAUSection : public JKRDisposer, protected JSULink<JAUSection> {
|
||||
public:
|
||||
struct TSectionData {
|
||||
TSectionData();
|
||||
void resetRegisteredBankTables();
|
||||
void resetRegisteredWaveBankTables();
|
||||
|
||||
/* 0x00 */ JAUDynamicSeqDataBlocks field_0x00;
|
||||
/* 0x28 */ JSUList<JAUSeqDataBlock> field_0x28;
|
||||
/* 0x34 */ std::bitset<255> registeredWaveBankTables;
|
||||
/* 0x54 */ std::bitset<255> registeredBankTables;
|
||||
/* 0x74 */ JAUBankTableDictionary field_0x74;
|
||||
/* 0x80 */ JAISeqDataMgr* field_0x80;
|
||||
/* 0x84 */ const void* mBstDst;
|
||||
/* 0x88 */ const void* mBstnDst;
|
||||
/* 0x8C */ JSUList<JAUDisposer_> field_0x8c;
|
||||
/* 0x98 */ s32 field_0x98;
|
||||
/* 0x9C */ int mBankMemoryUsage;
|
||||
/* 0xA0 */ int mWaveBankMemoryUsage;
|
||||
};
|
||||
|
||||
JAUSection(JAUSectionHeap*, u32, s32);
|
||||
void finishBuild();
|
||||
virtual void dispose();
|
||||
JAUSoundTable* newSoundTable(void const*, u32, bool);
|
||||
JAUSoundNameTable* newSoundNameTable(void const*, u32, bool);
|
||||
JAIStreamDataMgr* newStreamFileTable(void const*, bool);
|
||||
JAISeqDataMgr* newSeSeqCollection(void const*, u32);
|
||||
u8* newStaticSeqDataBlock_(JAISoundID, u32);
|
||||
bool newStaticSeqData(JAISoundID, void const*, u32);
|
||||
bool newStaticSeqData(JAISoundID);
|
||||
void* newCopy(void const*, u32, s32);
|
||||
JASWaveBank* newWaveBank(u32, void const*);
|
||||
bool loadWaveArc(u32, u32);
|
||||
JASBank* newBank(void const*, u32);
|
||||
JASVoiceBank* newVoiceBank(u32, u32);
|
||||
bool beginNewBankTable(u32, u32);
|
||||
JAUBankTable* endNewBankTable();
|
||||
|
||||
bool isBuilding() const { return field_0x2c; }
|
||||
bool isOpen() const;
|
||||
JAUSectionHeap* asSectionHeap() {
|
||||
if ((JAUSection*)sectionHeap_ == this) {
|
||||
return sectionHeap_;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
const TSectionData& getSectionData() const { return data_; }
|
||||
|
||||
JKRHeap* getHeap_();
|
||||
|
||||
/* 0x28 */ u32 field_0x28;
|
||||
/* 0x2C */ bool field_0x2c;
|
||||
/* 0x30 */ JAUSectionHeap* sectionHeap_;
|
||||
/* 0x34 */ JAUBankTableLink* buildingBankTable_;
|
||||
/* 0x38 */ TSectionData data_;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAUSectionHeap : public JAUSection, public JASGlobalInstance<JAUSectionHeap>, public JAISeqDataMgr {
|
||||
public:
|
||||
struct TSectionHeapData {
|
||||
TSectionHeapData();
|
||||
|
||||
/* 0x000 */ JAUWaveBankTable waveBankTable;
|
||||
/* 0x404 */ JAISeqDataUser* seqDataUser;
|
||||
/* 0x408 */ JAUDynamicSeqDataBlocks seqDataBlocks;
|
||||
/* 0x430 */ JAISeqDataMgr* seSeqDataMgr_;
|
||||
/* 0x434 */ JAIStreamDataMgr* streamDataMgr_;
|
||||
/* 0x438 */ JAUSoundTable* soundTable;
|
||||
/* 0x43C */ JAUSoundNameTable* soundNameTable;
|
||||
};
|
||||
|
||||
void setSeqDataArchive(JKRArchive*);
|
||||
bool loadDynamicSeq(JAISoundID, bool);
|
||||
u32 releaseIdleDynamicSeqDataBlock();
|
||||
JAUSectionHeap(JKRSolidHeap*, bool, s32);
|
||||
JAUSection* getOpenSection();
|
||||
JAUSection* getSection(int);
|
||||
bool setSeqDataUser(JAISeqDataUser*);
|
||||
bool newDynamicSeqBlock(u32);
|
||||
SeqDataReturnValue getSeqData(JAISoundID, JAISeqData*);
|
||||
int releaseSeqData();
|
||||
|
||||
JAISeqDataMgr* getSeqSeqDataMgr() { return this; }
|
||||
JAISeqDataMgr* getSeSeqDataMgr() { return sectionHeapData_.seSeqDataMgr_; }
|
||||
JAIStreamDataMgr* getStreamDataMgr() { return sectionHeapData_.streamDataMgr_; }
|
||||
TSectionHeapData const& getSectionHeapData() const { return sectionHeapData_; }
|
||||
JAUWaveBankTable& getWaveBankTable() { return sectionHeapData_.waveBankTable; }
|
||||
JKRHeap* getHeap() {
|
||||
if (getOpenSection()->isBuilding() != 0) {
|
||||
return mHeap;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* 0xE0 */ JKRHeap* mHeap;
|
||||
/* 0xE4 */ int field_0xe4;
|
||||
/* 0xE8 */ JSUList<JAUSection> mSectionList;
|
||||
/* 0xF4 */ TSectionHeapData sectionHeapData_;
|
||||
};
|
||||
|
||||
inline JKRHeap* JAUSection::getHeap_() { return sectionHeap_->mHeap; }
|
||||
inline bool JAUSection::isOpen() const { return sectionHeap_->getOpenSection() == this; }
|
||||
|
||||
JAUSectionHeap* JAUNewSectionHeap(bool);
|
||||
|
||||
#endif /* JAUSECTIONHEAP_H */
|
||||
@@ -0,0 +1,58 @@
|
||||
#ifndef JAUSEQCOLLECTION_H
|
||||
#define JAUSEQCOLLECTION_H
|
||||
|
||||
#include "JSystem/JAudio2/JAISeqDataMgr.h"
|
||||
|
||||
struct JAISeqData;
|
||||
struct JAISeqDataRegion;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAUSeqCollectionData {
|
||||
s8 field_0x0;
|
||||
s8 field_0x1;
|
||||
BE(u16) field_0x2;
|
||||
BE(u32) field_0x4;
|
||||
BE(u32) field_0x8;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAUSeqCollection {
|
||||
public:
|
||||
JAUSeqCollection();
|
||||
void init(void const*);
|
||||
bool getSeqData(int, int, JAISeqData*);
|
||||
bool getSeqDataRegion(JAISeqDataRegion*);
|
||||
|
||||
bool isValid() const { return field_0x8; }
|
||||
|
||||
/* 0x00 */ u16 field_0x0;
|
||||
/* 0x04 */ const BE(u32)* field_0x4;
|
||||
/* 0x08 */ const JAUSeqCollectionData* field_0x8;
|
||||
/* 0x0C */ int field_0xc;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAUSeqDataMgr_SeqCollection : public JAISeqDataMgr, public JAUSeqCollection {
|
||||
public:
|
||||
JAUSeqDataMgr_SeqCollection();
|
||||
bool setSeqDataUser(JAISeqDataUser*);
|
||||
int releaseSeqData();
|
||||
SeqDataReturnValue getSeqData(JAISoundID, JAISeqData*);
|
||||
~JAUSeqDataMgr_SeqCollection();
|
||||
|
||||
const void* getResource() const { return field_0x4; }
|
||||
void init(const void* param_1) { JAUSeqCollection::init(param_1); }
|
||||
|
||||
/* 0x14 */ JAISeqDataUser* user_;
|
||||
};
|
||||
|
||||
#endif /* JAUSEQCOLLECTION_H */
|
||||
@@ -0,0 +1,62 @@
|
||||
#ifndef JAUSEQDATABLOCKMGR_H
|
||||
#define JAUSEQDATABLOCKMGR_H
|
||||
|
||||
#include "JSystem/JAudio2/JAISeqDataMgr.h"
|
||||
#include "JSystem/JSupport/JSUList.h"
|
||||
|
||||
struct JAISeqData;
|
||||
struct JAISeqDataUser;
|
||||
class JKRArchive;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAUSeqDataBlock {
|
||||
JAUSeqDataBlock();
|
||||
|
||||
/* 0x00 */ JSULink<JAUSeqDataBlock> field_0x0;
|
||||
/* 0x10 */ JAISoundID field_0x10;
|
||||
/* 0x14 */ JAISeqDataRegion region;
|
||||
/* 0x1C */ int field_0x1c;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAUSeqDataBlocks : public JSUList<JAUSeqDataBlock> {
|
||||
public:
|
||||
u8* getSeqData(JAISoundID);
|
||||
JSULink<JAUSeqDataBlock>* seekFreeBlock(u32);
|
||||
bool append(JSULink<JAUSeqDataBlock>*);
|
||||
bool remove(JSULink<JAUSeqDataBlock>*);
|
||||
bool hasFailedBlock(JAISoundID);
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAUDynamicSeqDataBlocks {
|
||||
public:
|
||||
JAUDynamicSeqDataBlocks();
|
||||
void setSeqDataArchive(JKRArchive*);
|
||||
s32 getSeqData(JAISoundID, JAISeqDataUser*, JAISeqData*, bool);
|
||||
bool appendDynamicSeqDataBlock(JAUSeqDataBlock*);
|
||||
bool loadDynamicSeq(JAISoundID, bool, JAISeqDataUser*);
|
||||
u32 releaseIdleDynamicSeqDataBlock(JAISeqDataUser*);
|
||||
JAUSeqDataBlock* releaseIdleDynamicSeqDataBlock_(JAISeqDataUser*, u32);
|
||||
void rearrangeLoadingSeqs_();
|
||||
|
||||
JAUSeqDataBlocks const& getFreeBlocks() const { return mFreeBlocks; }
|
||||
JAUSeqDataBlocks const& getLoadedBlocks() const { return mLoadedBlocks; }
|
||||
JKRArchive* getSeqDataArchive() { return seqDataArchive_; }
|
||||
|
||||
/* 0x00 */ JAUSeqDataBlocks mFreeBlocks;
|
||||
/* 0x0C */ JAUSeqDataBlocks field_0xc;
|
||||
/* 0x18 */ JAUSeqDataBlocks mLoadedBlocks;
|
||||
/* 0x24 */ JKRArchive* seqDataArchive_;
|
||||
};
|
||||
|
||||
#endif /* JAUSEQDATABLOCKMGR_H */
|
||||
@@ -0,0 +1,120 @@
|
||||
#ifndef JAUSOUNDANIMATOR_H
|
||||
#define JAUSOUNDANIMATOR_H
|
||||
|
||||
#include "JSystem/JAudio2/JAISound.h"
|
||||
|
||||
class JAUSoundAnimation;
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAUSoundAnimationSound {
|
||||
public:
|
||||
bool playsOnlyForward() const { return (mFlags & 1) != 0; }
|
||||
bool playsOnlyReverse() const { return (mFlags & 2) != 0; }
|
||||
bool stopsWhenAnimationChanges() const { return (mFlags & 4) != 0; }
|
||||
bool playsOnlyOnce() const { return (mFlags & 8) != 0; }
|
||||
bool stopsWhenNoteOff() const { return (mFlags & 0x10) != 0; }
|
||||
bool stopsWhenSpeedIsZero() const { return (mFlags & 0x20) != 0; }
|
||||
bool setsLifeTime() const { return (mFlags & 0x40) != 0; }
|
||||
bool playsAtIntervals() const { return (mFlags & 0x80) != 0; }
|
||||
|
||||
bool isNoting(f32 param_0) const {
|
||||
if (field_0x04 == field_0x08) {
|
||||
return true;
|
||||
}
|
||||
if (field_0x04 > field_0x08) {
|
||||
if (field_0x08 <= param_0 && param_0 < field_0x04) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (field_0x04 <= param_0 && param_0 < field_0x08) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isNotingOn(f32 param_0, bool param_1) const {
|
||||
if (setsLifeTime()) {
|
||||
return isNoting(param_0);
|
||||
}
|
||||
if (param_1) {
|
||||
return param_0 <= field_0x04;
|
||||
} else {
|
||||
return param_0 >= field_0x04;
|
||||
}
|
||||
}
|
||||
|
||||
bool isNotingOff(f32 param_0, bool param_1) const {
|
||||
if (setsLifeTime()) {
|
||||
return !isNoting(param_0);
|
||||
}
|
||||
if (field_0x04 == field_0x08) {
|
||||
return false;
|
||||
}
|
||||
if (param_1) {
|
||||
return param_0 <= field_0x08;
|
||||
} else {
|
||||
return param_0 >= field_0x08;
|
||||
}
|
||||
}
|
||||
|
||||
/* 0x00 */ JAISoundID mSoundId;
|
||||
/* 0x04 */ f32 field_0x04;
|
||||
/* 0x08 */ f32 field_0x08;
|
||||
/* 0x0C */ f32 field_0x0c;
|
||||
/* 0x10 */ u32 mFlags;
|
||||
/* 0x14 */ u8 field_0x14;
|
||||
/* 0x15 */ u8 field_0x15;
|
||||
/* 0x16 */ u8 field_0x16;
|
||||
/* 0x17 */ u8 field_0x17;
|
||||
/* 0x18 */ u8 field_0x18;
|
||||
/* 0x19 */ u8 field_0x19;
|
||||
/* 0x1A */ s8 field_0x1a;
|
||||
/* 0x1B */ u8 unk_0x1b[5];
|
||||
}; /* size 0x20 */
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAUSoundAnimationControl {
|
||||
public:
|
||||
virtual ~JAUSoundAnimationControl() = 0;
|
||||
virtual JAUSoundAnimationSound* getSound(const JAUSoundAnimation*, int) = 0;
|
||||
virtual u16 getNumSounds(const JAUSoundAnimation*) = 0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAUSoundAnimation {
|
||||
public:
|
||||
int getStartSoundIndex(f32) const;
|
||||
int getEndSoundIndex(f32) const;
|
||||
|
||||
u16 getNumSounds() const {
|
||||
if (mControl != NULL) {
|
||||
return mControl->getNumSounds(this);
|
||||
} else {
|
||||
return mNumSounds;
|
||||
}
|
||||
}
|
||||
|
||||
const JAUSoundAnimationSound* getSound(int i_index) const {
|
||||
if (mControl != NULL) {
|
||||
return mControl->getSound(this, i_index);
|
||||
} else {
|
||||
return &mSounds + i_index;
|
||||
}
|
||||
}
|
||||
|
||||
/* 0x0 */ u16 mNumSounds;
|
||||
/* 0x4 */ JAUSoundAnimationControl* mControl;
|
||||
/* 0x8 */ JAUSoundAnimationSound mSounds; // actually an array
|
||||
};
|
||||
|
||||
#endif /* JAUSOUNDANIMATOR_H */
|
||||
@@ -0,0 +1,18 @@
|
||||
#ifndef JAUSOUNDINFO_H
|
||||
#define JAUSOUNDINFO_H
|
||||
|
||||
#include "JSystem/JAudio2/JASGadget.h"
|
||||
#include "JSystem/JAudio2/JAUAudibleParam.h"
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
class JAUSoundInfo : public JASGlobalInstance<JAUSoundInfo> {
|
||||
public:
|
||||
JAUSoundInfo(bool param_0) : JASGlobalInstance<JAUSoundInfo>(param_0) {}
|
||||
virtual u16 getAudibleSw(JAISoundID) const = 0;
|
||||
virtual u16 getBgmSeqResourceID(JAISoundID) const = 0;
|
||||
};
|
||||
|
||||
#endif /* JAUSOUNDINFO_H */
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef JAUSOUNDOBJECT_H
|
||||
#define JAUSOUNDOBJECT_H
|
||||
|
||||
// NONMATCHING
|
||||
|
||||
#endif /* JAUSOUNDOBJECT_H */
|
||||
@@ -0,0 +1,201 @@
|
||||
#ifndef JAUSOUNDTABLE_H
|
||||
#define JAUSOUNDTABLE_H
|
||||
|
||||
#include "JSystem/JAudio2/JAISound.h"
|
||||
#include "JSystem/JAudio2/JASGadget.h"
|
||||
#include "dusk/endian.h"
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAUSoundTableItem {
|
||||
u8 mPriority;
|
||||
u8 field_0x1;
|
||||
u16 mResourceId;
|
||||
u32 field_0x4;
|
||||
f32 field_0x8;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
template<typename Root, typename Section, typename Group, typename Typename_0>
|
||||
struct JAUSoundTable_ {
|
||||
JAUSoundTable_() {
|
||||
field_0x0 = NULL;
|
||||
field_0x4 = 0;
|
||||
}
|
||||
|
||||
void reset() {
|
||||
field_0x0 = NULL;
|
||||
field_0x4 = NULL;
|
||||
}
|
||||
|
||||
void init(const void* param_0) {
|
||||
field_0x0 = param_0;
|
||||
// magic number is not in debug rom. I'm not sure what this comparison is (maybe some sort of '' number?)
|
||||
// I also do not know how it is different between JAUSoundTable and JAUSoundNameTable
|
||||
if (*(BE(u32)*)field_0x0 + 0xbdad0000 != Root::magicNumber()) {
|
||||
field_0x0 = NULL;
|
||||
} else {
|
||||
field_0x4 = (Root*)((u8*)field_0x0 + *((BE(u32)*)field_0x0 + 3));
|
||||
}
|
||||
}
|
||||
|
||||
Section* getSection(int index) const {
|
||||
if (index < 0) {
|
||||
return NULL;
|
||||
}
|
||||
if ((u32)index >= field_0x4->mSectionNumber) {
|
||||
return NULL;
|
||||
}
|
||||
u32 offset = field_0x4->mSectionOffsets[index];
|
||||
if (offset == 0) {
|
||||
return NULL;
|
||||
}
|
||||
return (Section*)((u8*)field_0x0 + offset);
|
||||
}
|
||||
|
||||
Group* getGroup(Section* param_1, int index) const {
|
||||
int iVar1;
|
||||
|
||||
if (index < 0) {
|
||||
return NULL;
|
||||
}
|
||||
if ((u32)index >= param_1->mNumGroups) {
|
||||
return NULL;
|
||||
}
|
||||
u32 offset = param_1->getGroupOffset(index);
|
||||
if (offset == 0) {
|
||||
return NULL;
|
||||
}
|
||||
return (Group*)((u8*)field_0x0 + offset);
|
||||
}
|
||||
|
||||
const void* field_0x0;
|
||||
Root* field_0x4;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAUSoundTableRoot {
|
||||
static inline u32 magicNumber() { return 0x5420; }
|
||||
BE(u32) mSectionNumber;
|
||||
BE(u32) mSectionOffsets[0];
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAUSoundTableSection {
|
||||
int getGroupOffset(int index) const {
|
||||
if (index < 0) {
|
||||
return 0;
|
||||
}
|
||||
if (index >= mNumGroups) {
|
||||
return 0;
|
||||
}
|
||||
return mGroupOffsets[index];
|
||||
}
|
||||
|
||||
BE(u32) mNumGroups;
|
||||
BE(u32) mGroupOffsets[0];
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAUSoundTableGroup {
|
||||
u8 getTypeID(int index) const {
|
||||
if (index < 0) {
|
||||
return 0;
|
||||
}
|
||||
if (index >= mNumItems) {
|
||||
return 0xff;
|
||||
}
|
||||
return mTypeIds[index * 4];
|
||||
}
|
||||
|
||||
u32 getItemOffset(int index) const {
|
||||
if (index < 0) {
|
||||
return 0;
|
||||
}
|
||||
if (index >= mNumItems) {
|
||||
return 0;
|
||||
}
|
||||
return *(BE(u32)*)(mTypeIds + index * 4) & 0xffffff;
|
||||
}
|
||||
|
||||
BE(u32) mNumItems;
|
||||
BE(u32) field_0x4;
|
||||
u8 mTypeIds[0];
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAUSoundTable : public JASGlobalInstance<JAUSoundTable> {
|
||||
JAUSoundTable(bool param_0) : JASGlobalInstance<JAUSoundTable>(param_0) {
|
||||
}
|
||||
~JAUSoundTable() {}
|
||||
|
||||
void init(void const*);
|
||||
u8 getTypeID(JAISoundID) const;
|
||||
JAUSoundTableItem* getData(JAISoundID) const;
|
||||
|
||||
JAUSoundTableItem* getItem(JAUSoundTableGroup* group, int index) const {
|
||||
u32 offset = group->getItemOffset(index);
|
||||
if (offset == 0) {
|
||||
return NULL;
|
||||
}
|
||||
return (JAUSoundTableItem*)((u8*)field_0x0.field_0x0 + offset);
|
||||
}
|
||||
|
||||
const void* getResource() const { return field_0x0.field_0x0; }
|
||||
bool isValid() const { return field_0x0.field_0x0 != NULL; }
|
||||
|
||||
JAUSoundTable_<JAUSoundTableRoot,JAUSoundTableSection,JAUSoundTableGroup,void> field_0x0;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAUSoundNameTableRoot {
|
||||
static inline u32 magicNumber() { return 0x544e; }
|
||||
BE(u32) mSectionNumber;
|
||||
BE(u32) mSectionOffsets[0];
|
||||
};
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAUSoundNameTableSection {};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAUSoundNameTableGroup {};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAUSoundNameTable : public JASGlobalInstance<JAUSoundNameTable> {
|
||||
JAUSoundNameTable(bool param_0) : JASGlobalInstance<JAUSoundNameTable>(param_0) {
|
||||
}
|
||||
~JAUSoundNameTable() {}
|
||||
void init(void const*);
|
||||
|
||||
JAUSoundTable_<JAUSoundNameTableRoot,JAUSoundNameTableSection,JAUSoundNameTableGroup,void> field_0x0;
|
||||
};
|
||||
|
||||
#endif /* JAUSOUNDTABLE_H */
|
||||
@@ -0,0 +1,101 @@
|
||||
#ifndef JAUSTREAMSTATICARAMMGR_H
|
||||
#define JAUSTREAMSTATICARAMMGR_H
|
||||
|
||||
#include "JSystem/JAudio2/JAIStreamDataMgr.h"
|
||||
#include "JSystem/JAudio2/JASAramStream.h"
|
||||
#include "JSystem/JAudio2/JASHeapCtrl.h"
|
||||
#include "JSystem/JUtility/JUTAssert.h"
|
||||
#include <bitset>
|
||||
#include <stdint.h>
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
template <size_t A0>
|
||||
class JAUStreamAramMgrBase_ : public JAIStreamAramMgr {
|
||||
public:
|
||||
JAUStreamAramMgrBase_() {
|
||||
for (int i = 0; i < A0; i++) {
|
||||
field_0x4.reset(i);
|
||||
}
|
||||
}
|
||||
~JAUStreamAramMgrBase_() { releaseAram_JAUStreamAramMgrBase_(); }
|
||||
bool isStreamUsingAram() { return field_0x4.any(); }
|
||||
void releaseAram_JAUStreamAramMgrBase_() {
|
||||
JUT_ASSERT(38, ! isStreamUsingAram());
|
||||
for (int i = 0; i < A0; i++) {
|
||||
if (mHeaps[i].isAllocated()) {
|
||||
JASHeap* heap = &mHeaps[0]; // should probably be mHeaps[i] but that doesn't match
|
||||
heap->free();
|
||||
if (!heap) {
|
||||
JUT_ASSERT(47, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
std::bitset<A0> field_0x4;
|
||||
JASHeap mHeaps[A0];
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
template <size_t MAX_CHUNKS_>
|
||||
class JAUStreamStaticAramMgr_ : public JAUStreamAramMgrBase_<MAX_CHUNKS_> {
|
||||
public:
|
||||
JAUStreamStaticAramMgr_() { field_0x4c = 0; }
|
||||
virtual void* newStreamAram(u32* param_0) {
|
||||
for (u32 i = 0; i < field_0x4c; i++) {
|
||||
if (this->field_0x4.test(i)) {
|
||||
continue;
|
||||
}
|
||||
this->field_0x4.set(i, true);
|
||||
*param_0 = this->mHeaps[i].getSize();
|
||||
return this->mHeaps[i].getBase();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
virtual bool deleteStreamAram(u32 param_0) {
|
||||
for (u32 i = 0; i < field_0x4c; i++) {
|
||||
if (!this->field_0x4.test(i)) {
|
||||
continue;
|
||||
}
|
||||
if ((uintptr_t)this->mHeaps[i].getBase() != param_0) {
|
||||
continue;
|
||||
}
|
||||
this->field_0x4.reset(i);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
bool isAramReserved() const { return field_0x4c; }
|
||||
void reserveAram(JASHeap* heap, int numReserve, u32 param_2) {
|
||||
JUT_ASSERT(72, ! isAramReserved());
|
||||
JUT_ASSERT(73, ! JAUStreamAramMgrBase_ < MAX_CHUNKS_ >::isStreamUsingAram());
|
||||
if (!heap) {
|
||||
heap = JASKernel::getAramHeap();
|
||||
}
|
||||
if (numReserve <= 0) {
|
||||
numReserve = 1;
|
||||
}
|
||||
JUT_ASSERT(83, numReserve <= MAX_CHUNKS);
|
||||
int r27 = param_2 * JASAramStream::getBlockSize();
|
||||
for (int i = 0; i < numReserve; i++) {
|
||||
if (!this->mHeaps[i].alloc(heap, r27)) {
|
||||
break;
|
||||
}
|
||||
field_0x4c = i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
static const size_t MAX_CHUNKS = MAX_CHUNKS_;
|
||||
|
||||
int field_0x4c;
|
||||
};
|
||||
|
||||
#endif /* JAUSTREAMSTATICARAMMGR_H */
|
||||
@@ -0,0 +1,36 @@
|
||||
#ifndef JAUSTREAMFILETABLE_H
|
||||
#define JAUSTREAMFILETABLE_H
|
||||
|
||||
#include "JSystem/JAudio2/JAIStreamDataMgr.h"
|
||||
|
||||
struct BinaryStreamFileTable {
|
||||
/* 0x0 */ u8 mIdentifier[4];
|
||||
/* 0x4 */ BE(u32) mNumFiles;
|
||||
/* 0x8 */ BE(int) mFilePathOffsets[];
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAUStreamFileTable {
|
||||
JAUStreamFileTable();
|
||||
void init(void const*);
|
||||
u32 getNumFiles() const;
|
||||
const char* getFilePath(int) const;
|
||||
|
||||
bool isValid() { return mData; }
|
||||
|
||||
/* 0x0 */ const BinaryStreamFileTable* mData;
|
||||
};
|
||||
|
||||
/**
|
||||
* @ingroup jsystem-jaudio
|
||||
*
|
||||
*/
|
||||
struct JAUStreamDataMgr_StreamFileTable : public JAIStreamDataMgr, JAUStreamFileTable {
|
||||
virtual s32 getStreamFileEntry(JAISoundID);
|
||||
virtual ~JAUStreamDataMgr_StreamFileTable() {}
|
||||
};
|
||||
|
||||
#endif /* JAUSTREAMFILETABLE_H */
|
||||
@@ -0,0 +1,12 @@
|
||||
#ifndef DSPPROC_H
|
||||
#define DSPPROC_H
|
||||
|
||||
#include <types.h>
|
||||
|
||||
void DSPReleaseHalt2(u32 msg);
|
||||
void DsetupTable(u32 param_0, u32 param_1, u32 param_2, u32 param_3, u32 param_4);
|
||||
void DsetMixerLevel(f32 level);
|
||||
void DsyncFrame2ch(u32 param_0, u32 param_1, u32 param_2);
|
||||
void DsyncFrame4ch(u32 param_0, u32 param_1, u32 param_2, u32 param_3, u32 param_4);
|
||||
|
||||
#endif /* DSPPROC_H */
|
||||
@@ -0,0 +1,10 @@
|
||||
#ifndef DSPTASK_H
|
||||
#define DSPTASK_H
|
||||
|
||||
#include <types.h>
|
||||
|
||||
void DspBoot(void (*)(void*));
|
||||
void DspFinishWork(u16 param_0);
|
||||
int DSPSendCommands2(u32* msgs, u32 param_1, void (*param_2)(u16));
|
||||
|
||||
#endif /* DSPTASK_H */
|
||||
@@ -0,0 +1,9 @@
|
||||
#ifndef OSDSP_H
|
||||
#define OSDSP_H
|
||||
|
||||
#include <dsp.h>
|
||||
|
||||
extern "C" DSPTaskInfo* DSPAddTask(DSPTaskInfo*);
|
||||
void DSPAddPriorTask(STRUCT_DSP_TASK*);
|
||||
|
||||
#endif /* OSDSP_H */
|
||||
@@ -0,0 +1,10 @@
|
||||
#ifndef OSDSP_TASK_H
|
||||
#define OSDSP_TASK_H
|
||||
|
||||
#include <dsp.h>
|
||||
|
||||
extern DSPTaskInfo* DSP_prior_task;
|
||||
|
||||
void DsyncFrame2(u32 param_0, u32 param_1, u32 param_2);
|
||||
|
||||
#endif /* OSDSP_TASK_H */
|
||||
Reference in New Issue
Block a user