summaryrefslogtreecommitdiff
path: root/include/JSystem/JAudio/JASBasicWaveBank.h
blob: 9cddfcfe10b8c8f6619856629ba86e839db00fed (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
#ifndef JASBASICWAVEBANK_H
#define JASBASICWAVEBANK_H

#include "JSystem/JAudio/JASWaveArcLoader.h"
#include "JSystem/JAudio/JASWaveBank.h"
#include "JSystem/JUtility/JUTAssert.h"
#include "dolphin/os/OSMutex.h"

namespace JASystem {
    class TBasicWaveBank : public TWaveBank {
    public:
        class TWaveHandle : public JASystem::TWaveHandle {
        public:
            ~TWaveHandle() {}
            const JASystem::TWaveInfo* getWaveInfo() const {
                return &mWaveInfo;
            }
            const void* getWavePtr() const {
                JUT_ASSERT(77, mHeap);
                if (!mHeap->mBase) {
                    return NULL;
                }
                return (u8*)mHeap->mBase + mWaveInfo.mWavePtrOffs;
            }

            /* 0x04 */ JASystem::TWaveInfo mWaveInfo;
            /* 0x30 */ Kernel::THeap* mHeap;
        };

        class TWaveInfo {
        public:
            TWaveInfo() {
                mWaveHandle.mHeap = NULL;
                mWaveID = 0;
                mPrev = NULL;
                mNext = NULL;
            }
            ~TWaveInfo();

            /* 0x00 */ TWaveHandle mWaveHandle;
            /* 0x34 */ u32 mWaveID;
            /* 0x38 */ TWaveInfo* mPrev;
            /* 0x3C */ TWaveInfo* mNext;
        };

        class TWaveGroup : public TWaveArc {
        public:
            TWaveGroup(TBasicWaveBank*);
            ~TWaveGroup();
            void setWaveCount(u32);
            void setWaveInfo(int, u32, const JASystem::TWaveInfo&);
            void onLoadDone();
            void onEraseDone();
            u32 getWaveID(int) const;

            /* 0x78 */ TBasicWaveBank* mBank;
            /* 0x7C */ TWaveInfo* mCtrlWaveArray;
            /* 0x80 */ u32 mWaveCount;
        };

        TBasicWaveBank();
        ~TBasicWaveBank();
        TWaveGroup* getWaveGroup(int);
        void setGroupCount(u32);
        void setWaveTableSize(u32);
        void incWaveTable(const TWaveGroup*);
        void decWaveTable(const TWaveGroup*);
        JASystem::TWaveHandle* getWaveHandle(u32) const;
        TWaveArc* getWaveArc(int param_1) { return getWaveGroup(param_1); }

        /* 0x04 */ OSMutex mMutex;
        /* 0x1C */ TWaveInfo** mWaveTable;
        /* 0x20 */ int mWaveCount;
        /* 0x24 */ TWaveGroup** mWaveGroupArray;
        /* 0x28 */ u32 mWaveGroupCount;
    };
}

#endif /* JASBASICWAVEBANK_H */