NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
snd_SoundArchiveLoader.h
1#ifndef NW4R_SND_SOUND_ARCHIVE_LOADER_H
2#define NW4R_SND_SOUND_ARCHIVE_LOADER_H
3#include "nw4r/types_nw4r.h"
4#include "nw4r/ut.h" // IWYU pragma: export
5#include <revolution/OS.h> // IWYU pragma: export
6
7namespace nw4r {
8namespace snd {
9
10// Forward declarations
12
13namespace detail {
14
15class FileStreamHandle {
16public:
17 FileStreamHandle(ut::FileStream *pFileStream) : mStream(pFileStream) {}
18
19 ~FileStreamHandle() {
20 if (mStream != NULL) {
21 mStream->Close();
22 }
23 }
24
25 ut::FileStream *GetFileStream() {
26 return mStream;
27 }
28
29 ut::FileStream *operator->() {
30 return mStream;
31 }
32
33 operator bool() const {
34 return mStream;
35 }
36
37private:
38 ut::FileStream *mStream; // at 0x0
39};
40
41class SoundArchiveLoader {
42public:
43 explicit SoundArchiveLoader(const SoundArchive &rArchive);
44 ~SoundArchiveLoader();
45
46 void *LoadGroup(ulong id, SoundMemoryAllocatable *pAllocatable, void **ppWaveBuffer, ulong blockSize);
47 s32 ReadFile(ulong, void *, s32, s32);
48 void *LoadFile(ulong id, SoundMemoryAllocatable* pAllocatable);
49
50private:
51 mutable OSMutex mMutex; // at 0x0
52 const SoundArchive &mArc; // at 0x18
53 u8 mStreamArea[512]; // at 0x1C
54 ut::FileStream *mStream; // at 0x21C
55};
56
57} // namespace detail
58} // namespace snd
59} // namespace nw4r
60
61#endif