Skip to content

Commit

Permalink
couple JASSeqParser matches
Browse files Browse the repository at this point in the history
  • Loading branch information
LagoLunatic committed Sep 6, 2024
1 parent 22e4c67 commit 2740966
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 29 deletions.
27 changes: 22 additions & 5 deletions include/JSystem/JAudio/JASTrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,13 @@ namespace JASystem {

class MoveParam_ {
public:
MoveParam_();
MoveParam_()
: mCurrentValue(0.0f)
, mTargetValue(0.0f)
, mMoveTime(0.0f)
, mMoveAmount(0.0f)
{
}

/* 0x00 */ f32 mCurrentValue;
/* 0x04 */ f32 mTargetValue;
Expand All @@ -108,10 +114,21 @@ namespace JASystem {
public:
AInnerParam_();

/* 0x000 */ MoveParam_ mIIRs[4];
/* 0x010 */ f32 field_0x10[32];
/* 0x0C0 */ MoveParam_ field_0xc0[4];
/* 0x100 */ f32 field_0x100[8];
/* 0x000 */ MoveParam_ mVolume;
/* 0x010 */ MoveParam_ mPitch;
/* 0x020 */ MoveParam_ mFxmix;
/* 0x030 */ MoveParam_ mPan;
/* 0x040 */ MoveParam_ mDolby;
/* 0x050 */ MoveParam_ _50;
/* 0x060 */ MoveParam_ mOsc0Width;
/* 0x070 */ MoveParam_ mOsc0Rate;
/* 0x080 */ MoveParam_ mOsc0Vertex;
/* 0x090 */ MoveParam_ mOsc1Width;
/* 0x0A0 */ MoveParam_ mOsc1Rate;
/* 0x0B0 */ MoveParam_ mOsc1Vertex;
/* 0x0C0 */ MoveParam_ mIIRs[4];
/* 0x100 */ MoveParam_ _100;
/* 0x110 */ MoveParam_ _110;
};

class TimedParam_ {
Expand Down
33 changes: 20 additions & 13 deletions src/JSystem/JAudio/JASSeqParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,25 +581,32 @@ int JASystem::TSeqParser::cmdVibPitch(TTrack* track, u32* args) {

/* 8027F544-8027F5C8 .text cmdIIRSet__Q28JASystem10TSeqParserFPQ28JASystem6TTrackPUl */
int JASystem::TSeqParser::cmdIIRSet(TTrack* track, u32* args) {
/* Nonmatching */
for (int i = 0; i < 4; i++) {
track->mTimedParam.mInnerParam.mIIRs[i].mTargetValue = (s16)args[i] / 32768.0f;
track->mTimedParam.mInnerParam.mIIRs[i].mCurrentValue = track->mTimedParam.mInnerParam.mIIRs[i].mTargetValue;
track->mTimedParam.mInnerParam.mIIRs[i].mMoveAmount = 0.0f;
track->mTimedParam.mInnerParam.mIIRs[i].mMoveTime = 1.0f;
for (u8 i = 0; i < 4; i++) {
// TTrack::MoveParam_* iir = &track->mTimedParam.mInnerParam.mIIRs[i];
// Fakematch? Accessing mIIRs directly results in fewer instructions than indexing into
// mVolume as if it was an array.
TTrack::MoveParam_* iir = (&track->mTimedParam.mInnerParam.mVolume) + (u8)(i + 0xC);
iir->mTargetValue = (s16)args[i] / 32768.0f;
iir->mCurrentValue = iir->mTargetValue;
iir->mMoveAmount = 0.0f;
iir->mMoveTime = 1.0f;
}
return 0;
}

/* 8027F5C8-8027F65C .text cmdIIRCutOff__Q28JASystem10TSeqParserFPQ28JASystem6TTrackPUl */
int JASystem::TSeqParser::cmdIIRCutOff(TTrack* track, u32* args) {
/* Nonmatching */
s16* table = &JASystem::Player::CUTOFF_TO_IIR_TABLE[u8(args[0]) * 4];
for (int i = 0; i < 4; i++) {
track->mTimedParam.mInnerParam.mIIRs[i].mTargetValue = table[i] / (32768.0f - 1.0f);
track->mTimedParam.mInnerParam.mIIRs[i].mCurrentValue = track->mTimedParam.mInnerParam.mIIRs[i].mTargetValue;
track->mTimedParam.mInnerParam.mIIRs[i].mMoveAmount = 0.0f;
track->mTimedParam.mInnerParam.mIIRs[i].mMoveTime = 1.0f;
u8 iirTableIdx = args[0];
for (u8 i = 0; i < 4; i++) {
s16* table = &JASystem::Player::CUTOFF_TO_IIR_TABLE[iirTableIdx * 4];
// TTrack::MoveParam_* iir = &track->mTimedParam.mInnerParam.mIIRs[i];
// Fakematch? Accessing mIIRs directly results in fewer instructions than indexing into
// mVolume as if it was an array.
TTrack::MoveParam_* iir = (&track->mTimedParam.mInnerParam.mVolume) + (u8)(i + 0xC);
iir->mTargetValue = table[i] / (32768.0f - 1.0f);
iir->mCurrentValue = iir->mTargetValue;
iir->mMoveAmount = 0.0f;
iir->mMoveTime = 1.0f;
}
return 0;
}
Expand Down
28 changes: 17 additions & 11 deletions src/JSystem/JAudio/JASTrack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -724,16 +724,22 @@ f32 JASystem::TVibrate::getValue() const {
/* Nonmatching */
}

/* 80283FD0-80283FE8 .text __ct__Q38JASystem6TTrack10MoveParam_Fv */
JASystem::TTrack::MoveParam_::MoveParam_() {
/* Nonmatching */
mCurrentValue = 0.0f;
mTargetValue = 0.0f;
mMoveTime = 0.0f;
mMoveAmount = 0.0f;
}

/* 80283FE8-80284118 .text __ct__Q38JASystem6TTrack12AInnerParam_Fv */
JASystem::TTrack::AInnerParam_::AInnerParam_() {
/* Nonmatching */
JASystem::TTrack::AInnerParam_::AInnerParam_()
: mVolume()
, mPitch()
, mFxmix()
, mPan()
, mDolby()
, _50()
, mOsc0Width()
, mOsc0Rate()
, mOsc0Vertex()
, mOsc1Width()
, mOsc1Rate()
, mOsc1Vertex()
, mIIRs()
, _100()
, _110()
{
}

0 comments on commit 2740966

Please sign in to comment.