summaryrefslogtreecommitdiff
path: root/libs/revolution/src/homebuttonLib/nw4hbm/snd/StrmChannel.h
blob: ae184aeab70139cbad0882245265feed55994d02 (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
#ifndef NW4HBM_SND_STRM_CHANNEL_H
#define NW4HBM_SND_STRM_CHANNEL_H

#include "snd_types.h"

namespace nw4hbm {
    namespace snd {
        namespace detail {

            typedef struct StrmChannel {
                /* 0x00 */ void* mBuffer;
                /* 0x04 */ u32 mBufferSize;
                /* 0x08 */ AdpcmInfo mAdpcmInfo;
            } StrmChannel;

            class StrmBufferPool {
            public:
                void Setup(void* base, u32 size, int count);
                void Shutdown();

                void* Alloc();
                void Free(void* buffer);

                u32 GetBlockSize() const { return mBlockSize; }

            private:
                static const int BLOCK_MAX = 32;
                static const int BITS_PER_BYTE = 8;

                /* 0x00 */ void* mBuffer;
                /* 0x04 */ u32 mBufferSize;
                /* 0x08 */ u32 mBlockSize;
                /* 0x0C */ int mBlockCount;
                /* 0x10 */ int mAllocCount;
                /* 0x14 */ u8 mAllocFlags[BLOCK_MAX / BITS_PER_BYTE];
            };

        }  // namespace detail
    }  // namespace snd
}  // namespace nw4hbm

#endif