diff --git a/include/JSystem/JAudio/JASTrack.h b/include/JSystem/JAudio/JASTrack.h index 08e5daef..076bbf59 100644 --- a/include/JSystem/JAudio/JASTrack.h +++ b/include/JSystem/JAudio/JASTrack.h @@ -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; @@ -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_ { diff --git a/src/JSystem/JAudio/JASSeqParser.cpp b/src/JSystem/JAudio/JASSeqParser.cpp index e7fe2c97..943de525 100644 --- a/src/JSystem/JAudio/JASSeqParser.cpp +++ b/src/JSystem/JAudio/JASSeqParser.cpp @@ -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; } diff --git a/src/JSystem/JAudio/JASTrack.cpp b/src/JSystem/JAudio/JASTrack.cpp index 78b323b8..4b65d6e5 100644 --- a/src/JSystem/JAudio/JASTrack.cpp +++ b/src/JSystem/JAudio/JASTrack.cpp @@ -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() +{ }