Skip to content

Commit

Permalink
JASSeqParser
Browse files Browse the repository at this point in the history
  • Loading branch information
LagoLunatic committed Sep 8, 2024
1 parent 292bb15 commit fa53fcd
Show file tree
Hide file tree
Showing 7 changed files with 313 additions and 1,380 deletions.
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@
Object(Matching, "JSystem/JAudio/JAS/JASPlayer_impl.cpp"),
Object(Matching, "JSystem/JAudio/JAS/JASRegisterParam.cpp"),
Object(Matching, "JSystem/JAudio/JAS/JASSeqCtrl.cpp"),
Object(NonMatching, "JSystem/JAudio/JAS/JASSeqParser.cpp"),
Object(Matching, "JSystem/JAudio/JAS/JASSeqParser.cpp"),
Object(NonMatching, "JSystem/JAudio/JAS/JASTrack.cpp"),
Object(Matching, "JSystem/JAudio/JAS/JASTrackInterrupt.cpp"),
Object(Matching, "JSystem/JAudio/JAS/JASOscillator.cpp"),
Expand Down
6 changes: 5 additions & 1 deletion include/JSystem/JAudio/JAS/JASSeqCtrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@ struct JASSeqCtrl {
u16 get16(u32 offset) const;
u32 get24(u32 offset) const;
u32 get32(u32 offset) const;
u32 read16();
u16 read16();
u32 read24();

// unused/inlined
u32 read32();

u8 readByte() { return *mCurrentFilePtr++; }
u8* getAddr(u32 offset) { return mRawFilePtr + offset; }
void jump(u32 offset) { mCurrentFilePtr = mRawFilePtr + offset; }

u8* mRawFilePtr; // _00
u8* mCurrentFilePtr; // _04
int mWaitTimer; // _08
Expand Down
20 changes: 13 additions & 7 deletions include/JSystem/JAudio/JAS/JASSeqParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@

#include "types.h"

struct JASTrack;

struct JASSeqParser {
int parseSeq(struct JASTrack*);
typedef int (JASSeqParser::*CmdFunc)(JASTrack*, u32*);

int parseSeq(JASTrack*);
int cmdOpenTrack(JASTrack*, u32*);
int cmdOpenTrackBros(JASTrack*, u32*);
int cmdCall(JASTrack*, u32*);
Expand Down Expand Up @@ -38,12 +42,12 @@ struct JASSeqParser {
int cmdRetI(JASTrack*, u32*);
int cmdIntTimer(JASTrack*, u32*);
int cmdSyncCPU(JASTrack*, u32*);
u32 cmdFlushAll(JASTrack*, u32*);
u32 cmdFlushRelease(JASTrack*, u32*);
int cmdFlushAll(JASTrack*, u32*);
int cmdFlushRelease(JASTrack*, u32*);
int cmdTimeBase(JASTrack*, u32*);
int cmdTempo(JASTrack*, u32*);
u32 cmdFinish(JASTrack*, u32*);
u32 cmdNop(JASTrack*, u32*);
int cmdFinish(JASTrack*, u32*);
int cmdNop(JASTrack*, u32*);
int cmdPanPowSet(JASTrack*, u32*);
int cmdFIRSet(JASTrack*, u32*);
int cmdEXTSet(JASTrack*, u32*);
Expand All @@ -64,8 +68,10 @@ struct JASSeqParser {

bool conditionCheck(JASTrack*, u8);

void Cmd_Process(JASTrack*, u8, u16);
void RegCmd_Process(JASTrack*, int, int);
int Cmd_Process(JASTrack*, u8, u16);
int RegCmd_Process(JASTrack*, int, int);

static CmdFunc sCmdPList[];
};

#endif
4 changes: 2 additions & 2 deletions include/JSystem/JAudio/JAS/JASTrack.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ struct JASTrack : public JSUList<JASChannel> {
};

union TimedParam_ {
TimedParam_() { }
TimedParam_() {}

AInnerParam_ mInnerParam; // get individual params by member name
MoveParam_ mMoveParams[TIMED_Count]; // get individual params by index
Expand Down Expand Up @@ -319,7 +319,7 @@ struct JASTrack : public JSUList<JASChannel> {
int getChannelCount() const;
int getReleaseChannelCount() const;

inline JASSeqCtrl* getCtrl() { return &mSeqCtrl; }
inline JASSeqCtrl* getSeq() { return &mSeqCtrl; }
inline JASOuterParam* getExtBuffer() const { return mExtBuffer; }

inline void initOscillators()
Expand Down
4 changes: 2 additions & 2 deletions src/JSystem/JAudio/JAS/JASSeqCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,9 @@ u32 JASSeqCtrl::get32(u32 offset) const
* @note Address: 0x8009CA4C
* @note Size: 0x28
*/
u32 JASSeqCtrl::read16()
u16 JASSeqCtrl::read16()
{
u32 result = *(mCurrentFilePtr++) << 8;
u16 result = *(mCurrentFilePtr++) << 8;
result |= *(mCurrentFilePtr++);
return result;
}
Expand Down
Loading

0 comments on commit fa53fcd

Please sign in to comment.