forked from Phobos-developers/YRpp
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Audio.h
157 lines (123 loc) · 2.96 KB
/
Audio.h
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#pragma once
#include <GeneralDefinitions.h>
#include <Helpers/CompileTime.h>
class RawFileClass;
class CCFileClass;
class VocClass;
struct AudioIDXHeader {
unsigned int Magic;
unsigned int Version;
unsigned int numSamples;
};
struct AudioIDXEntry { // assert (IDXHeader.version != 1);
char Name[16];
int Offset;
int Size;
unsigned int SampleRate;
unsigned int Flags;
unsigned int ChunkSize;
bool operator < (const AudioIDXEntry& rhs) const {
return _strcmpi(this->Name, rhs.Name) < 0;
}
};
struct AudioSampleData {
AudioSampleData() :
Data(0),
Format(0),
SampleRate(0),
NumChannels(0),
BytesPerSample(0),
ByteRate(0),
BlockAlign(0),
Flags(0)
{ }
unsigned int Data;
unsigned int Format;
unsigned int SampleRate;
unsigned int NumChannels;
unsigned int BytesPerSample;
unsigned int ByteRate;
unsigned int BlockAlign;
unsigned int Flags;
};
class AudioIDXData {
public:
static constexpr reference<AudioIDXData*, 0x87E294u> const Instance{};
static AudioIDXData* __fastcall Create(const char* pFilename, const char* pPath)
{ JMP_STD(0x4011C0); };
AudioIDXData() {
memset(this, 0, sizeof(*this));
}
~AudioIDXData()
{ JMP_THIS(0x401580); }
void ClearCurrentSample()
{ JMP_THIS(0x401910); }
int __fastcall FindSampleIndex(const char* pName) const
{ JMP_STD(0x4015C0); }
const char* __fastcall GetSampleName(int index) const
{ JMP_STD(0x401600); }
int __fastcall GetSampleSize(int index) const
{ JMP_STD(0x401620); }
AudioSampleData* __fastcall GetSampleInformation(int index, AudioSampleData* pBuffer) const
{ JMP_STD(0x401640); }
AudioIDXEntry* Samples;
int SampleCount;
char Path[MAX_PATH];
CCFileClass* BagFile;
RawFileClass* ExternalFile;
BOOL PathFound;
RawFileClass* CurrentSampleFile;
int CurrentSampleSize;
DWORD unknown_120;
};
class Audio {
public:
static bool __fastcall ReadWAVFile(RawFileClass* pFile, AudioSampleData* pAudioSample, int* pDataSize)
{ JMP_STD(0x408610); }
};
class AudioStream {
public:
static constexpr reference<AudioStream*, 0xB1D4D8u> const Instance{};
bool __fastcall PlayWAV(const char* pFilename, bool bUnk)
{ JMP_STD(0x407B60); }
};
struct TauntDataStruct {
DWORD tauntIdx : 4;
DWORD countryIdx : 4;
};
struct AudioController
{
void* f_0;
DWORD f_4;
VocClass* Voice;
AudioIDXData** AudioIndex;
DWORD f_10;
AudioController() :
f_0(nullptr),
f_4(0),
Voice(nullptr),
AudioIndex(&AudioIDXData::Instance),
f_10(0)
{ }
~AudioController()
{ JMP_THIS(0x405C00); }
// no idea how these differ really
void DTOR_1()
{ JMP_THIS(0x405D40); }
void DTOR_2()
{ JMP_THIS(0x405FD0); }
void ShutUp()
{ JMP_THIS(0x406060); }
void __fastcall sub_4060F0(int a1, int a2)
{ JMP_STD(0x4060F0); }
void sub_406130()
{ JMP_THIS(0x406130); }
void sub_406170()
{ JMP_THIS(0x406170); }
void __fastcall sub_4061D0(unsigned int arg)
{ JMP_STD(0x4061D0); }
void __fastcall sub_406270(unsigned int arg)
{ JMP_THIS(0x406270); }
void sub_406310()
{ JMP_THIS(0x406310); }
};