summaryrefslogtreecommitdiff
path: root/include/Z2AudioLib/Z2SoundObject.h
diff options
context:
space:
mode:
authorrandomsalience <69010899+randomsalience@users.noreply.github.com>2023-10-26 08:41:03 -0400
committerGitHub <noreply@github.com>2023-10-26 15:41:03 +0300
commitb13ff9e3d0046fd27d918215557affce4020143d (patch)
tree469bc85e61853c4c1ce919ce1212363d6427195e /include/Z2AudioLib/Z2SoundObject.h
parente2d51bf9564c60435cfd5ee3fc05adddc8db04c7 (diff)
Z2SoundObject, JAUSoundAnimator OK, work on Z2SoundHandles (#1968)
* d_a_tag_evtarea mostly done, work on d_a_npc * work on d_a_npc_ash * work on Z2SoundHandles * Z2SoundObject, JAUSoundAnimator OK * Update Progress.md --------- Co-authored-by: randomsalience <randomsalience@gmail.com>
Diffstat (limited to 'include/Z2AudioLib/Z2SoundObject.h')
-rw-r--r--include/Z2AudioLib/Z2SoundObject.h69
1 files changed, 37 insertions, 32 deletions
diff --git a/include/Z2AudioLib/Z2SoundObject.h b/include/Z2AudioLib/Z2SoundObject.h
index 26f2829bcc..a022ba4abc 100644
--- a/include/Z2AudioLib/Z2SoundObject.h
+++ b/include/Z2AudioLib/Z2SoundObject.h
@@ -2,11 +2,10 @@
#define Z2SOUNDOBJECT_H
#include "Z2AudioLib/Z2SoundHandles.h"
+#include "JSystem/JAudio2/JAUSoundAnimator.h"
#include "dolphin/types.h"
-struct Z2SoundStarter;
-
-struct JAUSoundAnimationSound {};
+class Z2SoundStarter;
class Z2SoundObjBase : protected Z2SoundHandles {
public:
@@ -14,7 +13,7 @@ public:
~Z2SoundObjBase();
void deleteObject();
- void startCollisionSE(u32, u32, Z2SoundObjBase*);
+ JAISoundHandle* startCollisionSE(u32, u32, Z2SoundObjBase*);
bool isAlive() const { return mIsInitialized; }
void setSoundStarter(Z2SoundStarter* i_soundStarter) { mSoundStarter = i_soundStarter; }
@@ -23,13 +22,13 @@ public:
virtual void dispose();
virtual bool stopOK(Z2SoundHandlePool& pool);
virtual void init(Vec* pSoundPos, u8 pNumHandles);
- virtual void startSound(JAISoundID, u32, s8);
- virtual void startLevelSound(JAISoundID, u32, s8);
+ virtual JAISoundHandle* startSound(JAISoundID, u32, s8);
+ virtual JAISoundHandle* startLevelSound(JAISoundID, u32, s8);
/* 0x14 */ Z2SoundStarter* mSoundStarter;
- /* 0x18 */ Vec* mSoundPos;
+ /* 0x18 */ JGeometry::TVec3<f32>* mSoundPos;
/* 0x1C */ u16 field_0x1c;
- /* 0x1E */ u8 field_0x1e;
+ /* 0x1E */ s8 field_0x1e;
/* 0x1F */ bool mIsInitialized;
};
@@ -38,10 +37,9 @@ public:
Z2SoundObjSimple();
~Z2SoundObjSimple();
- virtual void temp(); // temp to build OK, remove later
virtual void init(Vec* pSoundPos, u8 pNumHandles);
- virtual void startSound(JAISoundID, u32, s8);
- virtual void startLevelSound(JAISoundID, u32, s8);
+ virtual JAISoundHandle* startSound(JAISoundID, u32, s8);
+ virtual JAISoundHandle* startLevelSound(JAISoundID, u32, s8);
};
class Z2SoundObjAnime : public Z2SoundObjBase {
@@ -53,42 +51,49 @@ public:
/* 802BF304 */ void updateSoundLifeTime_(f32, f32);
/* 802BF660 */ void startSoundInner(JGeometry::TVec3<f32> const&, f32, Z2SoundStarter*, u32,
s8);
- /* 802BF890 */ void getSoundID(JAUSoundAnimationSound const*, JGeometry::TVec3<f32> const&,
- f32);
- /* 802BF898 */ void playsSound(JAUSoundAnimationSound const*, JGeometry::TVec3<f32> const&,
+ /* 802BF890 */ u32 getSoundID(JAUSoundAnimationSound const*,
+ JGeometry::TVec3<f32> const&, f32);
+ /* 802BF898 */ bool playsSound(JAUSoundAnimationSound const*, JGeometry::TVec3<f32> const&,
f32);
/* 802BEBDC */ virtual void init(Vec*, u8);
- void stopAnime() { animation_ = NULL; }
-
- /* 0x20 */ void* animation_; // JAUSoundAnimation*
+ void stopAnime() { mpAnimation = NULL; }
+ void setLoopStartFrame(f32 i_frame) {
+ mStartSoundFrame = i_frame;
+ mStartSoundIndex = mpAnimation->getStartSoundIndex(i_frame);
+ }
+ void setLoopEndFrame(f32 i_frame) {
+ mEndSoundFrame = i_frame;
+ mEndSoundIndex = mpAnimation->getEndSoundIndex(i_frame);
+ }
+ void setLoopFrame(f32 i_startFrame, f32 i_endFrame) {
+ setLoopStartFrame(i_startFrame);
+ setLoopEndFrame(i_endFrame);
+ }
+
+ /* 0x20 */ JAUSoundAnimation* mpAnimation;
/* 0x24 */ int field_0x24;
- /* 0x28 */ float field_0x28;
- /* 0x2C */ float field_0x2c;
- /* 0x30 */ float field_0x30;
- /* 0x34 */ int field_0x34;
- /* 0x38 */ int field_0x38;
+ /* 0x28 */ f32 mCurSoundFrame;
+ /* 0x2C */ f32 mStartSoundFrame;
+ /* 0x30 */ f32 mEndSoundFrame;
+ /* 0x34 */ int mStartSoundIndex;
+ /* 0x38 */ int mEndSoundIndex;
/* 0x3C */ int field_0x3c;
- /* 0x40 */ int curSoundIndex_;
- /* 0x44 */ bool field_0x44;
+ /* 0x40 */ int mCurSoundIndex;
+ /* 0x44 */ bool mReverse;
};
-class Z2DopplerSoundObjBase : public Z2SoundHandles {
+class Z2DopplerSoundObjBase : public Z2SoundObjBase {
public:
Z2DopplerSoundObjBase();
~Z2DopplerSoundObjBase();
virtual void framework(u32, s8);
virtual void init(Vec*, u8);
- virtual void startSound(JAISoundID, u32, s8);
- virtual void startLevelSound(JAISoundID, u32, s8);
+ virtual JAISoundHandle* startSound(JAISoundID, u32, s8);
+ virtual JAISoundHandle* startLevelSound(JAISoundID, u32, s8);
- /* 0x14 */ Z2SoundStarter* field_0x14;
- /* 0x18 */ JGeometry::TVec3<f32>* field_0x18;
- /* 0x1C */ u16 field_0x1c;
- /* 0x1E */ u8 field_0x1e;
- /* 0x1F */ bool field_0x1f;
/* 0x20 */ JGeometry::TVec3<f32> field_0x20;
/* 0x2C */ JGeometry::TVec3<f32> field_0x2c;
};