-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathao.h
212 lines (172 loc) · 3.68 KB
/
ao.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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
//
// Audio Overload SDK
//
// Fake ao.h to set up the general Audio Overload style environment
//
#ifndef __AO_H
#define __AO_H
#include <stdio.h>
#define AO_SUCCESS 1
#define AO_FAIL 0
#define AO_FAIL_DECOMPRESSION -1
#define AUDIO_RATE (44100)
enum
{
COMMAND_NONE = 0,
COMMAND_PREV,
COMMAND_NEXT,
COMMAND_RESTART,
COMMAND_HAS_PREV,
COMMAND_HAS_NEXT,
COMMAND_GET_MIN,
COMMAND_GET_MAX,
COMMAND_JUMP
};
/* Compiler defines for Xcode */
#ifdef __BIG_ENDIAN__
#undef LSB_FIRST
#endif
#ifdef __LITTLE_ENDIAN__
#define LSB_FIRST 1
#endif
typedef unsigned char ao_bool;
#ifdef __GNUC__
#include <stddef.h> // get NULL
#include <stdbool.h>
#ifndef TRUE
#define TRUE (1)
#endif
#ifndef FALSE
#define FALSE (0)
#endif
#endif
#ifdef _MSC_VER
#include <stddef.h> // get NULL
#ifndef TRUE
#define TRUE (1)
#endif
#ifndef FALSE
#define FALSE (0)
#endif
#define true (1)
#define false (0)
#define strcasecmp _strcmpi
#endif
#define countof(arr) (sizeof(arr) / sizeof(arr[0]))
#ifndef PATH_MAX
#define PATH_MAX 2048
#endif
typedef struct
{
const char *title[9];
const char *info[9];
} ao_display_info;
typedef unsigned char uint8;
typedef unsigned char UINT8;
typedef signed char int8;
typedef signed char INT8;
typedef unsigned short uint16;
typedef unsigned short UINT16;
typedef signed short int16;
typedef signed short INT16;
typedef signed int int32;
typedef unsigned int uint32;
#ifdef LONG_IS_64BIT
typedef signed long int64;
typedef unsigned long uint64;
#else
typedef signed long long int64;
typedef unsigned long long uint64;
#endif
#ifdef WIN32
#include "win32_utf8/src/entry.h"
#ifndef _BASETSD_H
typedef signed int INT32;
typedef unsigned int UINT32;
typedef signed long long INT64;
typedef unsigned long long UINT64;
#endif
#else
typedef signed int INT32;
typedef unsigned int UINT32;
#ifdef LONG_IS_64BIT
typedef signed long INT64;
typedef unsigned long UINT64;
#else
typedef signed long long INT64;
typedef unsigned long long UINT64;
#endif
#endif
#ifndef INLINE
#if defined(_MSC_VER)
#define INLINE static __forceinline
#elif defined(__GNUC__)
#define INLINE static __inline__
#elif defined(_MWERKS_)
#define INLINE static inline
#elif defined(__powerc)
#define INLINE static inline
#else
#define INLINE
#endif
#endif
INLINE uint16 SWAP16(uint16 x)
{
return (
((x & 0xFF00) >> 8) |
((x & 0x00FF) << 8)
);
}
INLINE uint32 SWAP24(uint32 x)
{
return (
((x & 0xFF0000) >> 16) |
((x & 0x00FF00) << 0) |
((x & 0x0000FF) << 16)
);
}
INLINE uint32 SWAP32(uint32 x)
{
return (
((x & 0xFF000000) >> 24) |
((x & 0x00FF0000) >> 8) |
((x & 0x0000FF00) << 8) |
((x & 0x000000FF) << 24)
);
}
#if LSB_FIRST
#define BE16(x) (SWAP16(x))
#define BE24(x) (SWAP24(x))
#define BE32(x) (SWAP32(x))
#define LE16(x) (x)
#define LE24(x) (x)
#define LE32(x) (x)
#ifndef __ENDIAN__ /* Mac OS X Endian header has this function in it */
#define Endian32_Swap(x) (SWAP32(res))
#endif
#else
#define BE16(x) (x)
#define BE24(x) (x)
#define BE32(x) (x)
#define LE16(x) (SWAP16(x))
#define LE24(x) (SWAP24(x))
#define LE32(x) (SWAP32(x))
#endif
typedef struct {
int16 l;
int16 r;
} stereo_sample_t;
int ao_get_lib(const char *filename, uint8 **buffer, uint64 *length);
#endif // AO_H
extern volatile ao_bool ao_song_done;
/// Portability functions defined in ao.c
/// -------------------------------------
FILE* ao_fopen(const char *fn, const char *mode);
// We don't care about permissions, even on Linux
int ao_mkdir(const char *dirname);
void ao_sleep(unsigned int seconds);
#define fopen ERROR_use_ao_fopen_instead!
#define mkdir ERROR_Use_ao_mkdir_instead!
/// -------------------------------------
#include "wavedump.h"
#include "sampledump.h"