summaryrefslogtreecommitdiff
path: root/include/Z2AudioLib/Z2SoundObject.h
blob: 1e51f6c77454eee264894207494cb33ed94a059d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#ifndef Z2SOUNDOBJECT_H
#define Z2SOUNDOBJECT_H

#include "Z2AudioLib/Z2SoundHandles.h"
#include "JSystem/JAudio2/JAUSoundAnimator.h"

class Z2SoundStarter;

class Z2SoundObjBase : public Z2SoundHandles {
public:
    Z2SoundObjBase();
    ~Z2SoundObjBase();

    void deleteObject();
    Z2SoundHandlePool* startCollisionSE(u32, u32, Z2SoundObjBase*);

    bool isAlive() const { return mIsInitialized; }
    void setSoundStarter(Z2SoundStarter* i_soundStarter) { mSoundStarter = i_soundStarter; }

    virtual void framework(u32, s8);
    virtual void dispose();
    virtual bool stopOK(Z2SoundHandlePool& pool);
    virtual void init(Vec* pSoundPos, u8 pNumHandles);
    virtual Z2SoundHandlePool* startSound(JAISoundID, u32, s8);
    virtual Z2SoundHandlePool* startLevelSound(JAISoundID, u32, s8);

    /* 0x14 */ Z2SoundStarter* mSoundStarter;
    /* 0x18 */ JGeometry::TVec3<f32>* mSoundPos;
    /* 0x1C */ u16 field_0x1c;
    /* 0x1E */ s8 field_0x1e;
    /* 0x1F */ bool mIsInitialized;
};

class Z2SoundObjSimple : public Z2SoundObjBase {
public:
    Z2SoundObjSimple();
    ~Z2SoundObjSimple() {}

    virtual void init(Vec* pSoundPos, u8 pNumHandles);
    virtual Z2SoundHandlePool* startSound(JAISoundID, u32, s8);
    virtual Z2SoundHandlePool* startLevelSound(JAISoundID, u32, s8);
};

class Z2SoundObjAnime : public Z2SoundObjBase {
public:
    /* 802BEB94 */ Z2SoundObjAnime();
    /* 802BEBFC */ void initAnime(void*, bool, f32, f32);
    /* 802BED68 */ void ageSounds_();
    /* 802BEED4 */ void updateAnime(f32, f32);
    /* 802BF304 */ void updateSoundLifeTime_(f32, f32);
    /* 802BF660 */ void startSoundInner(JGeometry::TVec3<f32> const&, f32, Z2SoundStarter*, u32,
                                        s8);
    /* 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() { 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 */ f32 mCurSoundFrame;
    /* 0x2C */ f32 mStartSoundFrame;
    /* 0x30 */ f32 mEndSoundFrame;
    /* 0x34 */ int mStartSoundIndex;
    /* 0x38 */ int mEndSoundIndex;
    /* 0x3C */ int field_0x3c;
    /* 0x40 */ int mCurSoundIndex;
    /* 0x44 */ bool mReverse;
};

class Z2DopplerSoundObjBase : public Z2SoundObjBase {
public:
    Z2DopplerSoundObjBase();
    ~Z2DopplerSoundObjBase();

    virtual void framework(u32, s8);
    virtual void init(Vec*, u8);
    virtual Z2SoundHandlePool* startSound(JAISoundID, u32, s8);
    virtual Z2SoundHandlePool* startLevelSound(JAISoundID, u32, s8);

    /* 0x20 */ JGeometry::TVec3<f32> field_0x20;
    /* 0x2C */ JGeometry::TVec3<f32> field_0x2c;
};

class Z2SoundObjArrow : public Z2DopplerSoundObjBase {
public:
    /* 802BEB38 */ Z2SoundObjArrow();
    /* 802BEB74 */ virtual void init(Vec*, u8);
};

#endif /* Z2SOUNDOBJECT_H */