summaryrefslogtreecommitdiff
path: root/plugins/ao/ao.h
blob: a737efa6e131c35b49818e6cb0dd034f6ab341a4 (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
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
//
// Audio Overload SDK
//
// Fake ao.h to set up the general Audio Overload style environment
//

#ifndef __AO_H
#define __AO_H

#ifdef HAVE_CONFIG_H
#include "../../config.h"
#endif

#define AO_SUCCESS					1
#define AO_FAIL						0
#define AO_FAIL_DECOMPRESSION		-1

#define MAX_DISP_INFO_LENGTH		256
#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
};

#if 0
/* Compiler defines for Xcode */
#ifdef __BIG_ENDIAN__
	#undef LSB_FIRST
#endif

#ifdef __LITTLE_ENDIAN__
	#define LSB_FIRST	1
#endif
#endif

#ifdef WORDS_BIGENDIAN
	#undef LSB_FIRST
#else
	#define LSB_FIRST	1
#endif

typedef unsigned char ao_bool;

#ifdef __GNUC__
#include <stddef.h>	// get NULL
#include <stdbool.h>

#ifndef nil
#define nil NULL
#endif

#ifndef TRUE
#define TRUE  (1)
#endif
#ifndef FALSE
#define FALSE (0)
#endif

#define xmalloc(a) malloc(a)

#endif

#ifdef _MSC_VER
#include <stddef.h>	// get NULL
#include <wchar.h> // for off_t

#ifndef nil
#define nil NULL
#endif

#ifndef TRUE
#define TRUE  (1)
#endif
#ifndef FALSE
#define FALSE (0)
#endif

#define true (1)
#define false (0)

#define xmalloc(a) malloc(a)

#define strcasecmp _strcmpi

#endif

#ifndef PATH_MAX
#define PATH_MAX	2048
#endif

typedef struct
{
	char title[9][MAX_DISP_INFO_LENGTH];
	char info[9][MAX_DISP_INFO_LENGTH];
} 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

typedef int8 s8;
typedef int16 s16;
typedef int32 s32;
typedef int64 s64;

typedef uint8 u8;
typedef uint16 u16;
typedef uint32 u32;
typedef uint64 u64;

#ifndef INLINE
#if defined(_MSC_VER)
#define INLINE __forceinline
#elif defined(__GNUC__)
#define INLINE __inline__
#elif defined(_MWERKS_)
#define INLINE inline
#elif defined(__powerc)
#define INLINE inline
#else
#define INLINE
#endif
#endif

#if LSB_FIRST
static INLINE u16 BFLIP16(u16 x)
{
 return x;
}
#else
static INLINE u16 BFLIP16(u16 x)
{
 return( ((x>>8)&0xFF)| ((x&0xFF)<<8) );
}
#endif

#ifdef WIN32
#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

#if LSB_FIRST
#define LE16(x) (x)
#define LE32(x) (x)

#ifndef __ENDIAN__ /* Mac OS X Endian header has this function in it */
static unsigned long INLINE Endian32_Swap(unsigned long addr)
{
	unsigned long res = (((addr&0xff000000)>>24) |
		 ((addr&0x00ff0000)>>8) |
		 ((addr&0x0000ff00)<<8) |
		 ((addr&0x000000ff)<<24));

	return res;
}
#endif

#else

static unsigned short INLINE LE16(unsigned short x)
{
	unsigned short res = (((x & 0xFF00) >> 8) | ((x & 0xFF) << 8));
	return res;
}

static unsigned long INLINE LE32(unsigned long addr)
{
	unsigned long res = (((addr&0xff000000)>>24) |
		 ((addr&0x00ff0000)>>8) |
		 ((addr&0x0000ff00)<<8) |
		 ((addr&0x000000ff)<<24));

	return res;
}

#endif

int ao_get_lib(char *filename, uint8 **buffer, uint64 *length);

int ao_identify (char *buffer);

void *ao_start (uint32 type, const char *name, uint8 *buffer, uint32 size);

int ao_stop (uint32 type, void *handle);

int ao_get_info (uint32 type, void *handle, ao_display_info *info);

int ao_decode (uint32 type, void *handle, int16 *buffer, uint32 size);

int ao_command (uint32 type, void *handle, int32 command, int32 param);

void ao_getlibpath (const char *path, const char *libname, char *libpath, int size);

#endif // AO_H