author | dag10 |
Wed, 23 Jan 2013 16:35:26 -0500 | |
changeset 8430 | 5a5c34a75e1a |
parent 3514 | 59dbd31e9953 |
permissions | -rw-r--r-- |
3353 | 1 |
/* |
2 |
* OpenAL Bridge - a simple portable library for OpenAL interface |
|
3 |
* Copyright (c) 2009 Vittorio Giovara <vittorio.giovara@gmail.com> |
|
4 |
* |
|
5 |
* This program is free software; you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU Lesser General Public License as published by |
|
7 |
* the Free Software Foundation; version 2 of the License |
|
8 |
* |
|
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU Lesser General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU Lesser General Public License |
|
15 |
* along with this program; if not, write to the Free Software |
|
16 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA |
|
17 |
*/ |
|
18 |
||
19 |
#ifndef _OALB_GLOBALS_H |
|
20 |
#define _OALB_GLOBALS_H |
|
21 |
||
22 |
#include <stdio.h> |
|
23 |
#include <stdlib.h> |
|
3364 | 24 |
#include "al.h" |
3353 | 25 |
|
26 |
#ifndef _WIN32 |
|
27 |
#include <pthread.h> |
|
28 |
#include <syslog.h> |
|
29 |
#else |
|
30 |
#include <process.h> |
|
31 |
#endif |
|
32 |
||
33 |
||
3362
8d3b4d19ce27
in reprocessing openalbridge, a lot of code cleanup and simplification
koda
parents:
3360
diff
changeset
|
34 |
// 1.0 02/03/10 - Defines cross-platform sleep, usleep, etc. [Wu Yongwei] |
3353 | 35 |
#ifndef _SLEEP_H |
36 |
#define _SLEEP_H |
|
37 |
#ifdef _WIN32 |
|
38 |
# if defined(_NEED_SLEEP_ONLY) && (defined(_MSC_VER) || defined(__MINGW32__)) |
|
39 |
# include <stdlib.h> |
|
40 |
# define sleep(t) _sleep((t) * 1000) |
|
41 |
# else |
|
42 |
# define WIN32_LEAN_AND_MEAN |
|
43 |
# include <windows.h> |
|
44 |
# define sleep(t) Sleep((t) * 1000) |
|
45 |
# endif |
|
46 |
# ifndef _NEED_SLEEP_ONLY |
|
47 |
# define msleep(t) Sleep(t) |
|
48 |
# define usleep(t) Sleep((t) / 1000) |
|
49 |
# endif |
|
50 |
#else |
|
51 |
# include <unistd.h> |
|
52 |
# ifndef _NEED_SLEEP_ONLY |
|
53 |
# define msleep(t) usleep((t) * 1000) |
|
54 |
# endif |
|
55 |
#endif |
|
3362
8d3b4d19ce27
in reprocessing openalbridge, a lot of code cleanup and simplification
koda
parents:
3360
diff
changeset
|
56 |
#endif // _SLEEP_H |
3353 | 57 |
|
58 |
||
3362
8d3b4d19ce27
in reprocessing openalbridge, a lot of code cleanup and simplification
koda
parents:
3360
diff
changeset
|
59 |
// check compiler requirements |
3353 | 60 |
#if !defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) |
61 |
#warning __BIG_ENDIAN__ or __LITTLE_ENDIAN__ not found, going to set __LITTLE_ENDIAN__ as default |
|
62 |
#define __LITTLE_ENDIAN__ 1 |
|
63 |
#endif |
|
64 |
||
3362
8d3b4d19ce27
in reprocessing openalbridge, a lot of code cleanup and simplification
koda
parents:
3360
diff
changeset
|
65 |
/* use byteswap macros from the host system, hopefully optimized ones ;-) |
3353 | 66 |
* or define our own version, simple, stupid, straight-forward... */ |
67 |
#ifdef HAVE_BYTESWAP_H |
|
68 |
#include <byteswap.h> |
|
3362
8d3b4d19ce27
in reprocessing openalbridge, a lot of code cleanup and simplification
koda
parents:
3360
diff
changeset
|
69 |
#else |
3364 | 70 |
#define bswap_16(x) (((x & 0xFF00) >> 8) | ((x & 0x00FF) << 8)) |
71 |
#define bswap_32(x) (((x & 0xFF000000) >> 24) | (((x) & 0x00FF0000) >> 8) | \ |
|
72 |
((x & 0x0000FF00) << 8) | (((x) & 0x000000FF) << 24) ) |
|
3353 | 73 |
#endif /* HAVE_BYTESWAP_H */ |
74 |
||
75 |
/* swap numbers accordingly to architecture automatically */ |
|
76 |
#ifdef __LITTLE_ENDIAN__ |
|
77 |
#define ENDIAN_LITTLE_32(x) x |
|
78 |
#define ENDIAN_BIG_32(x) bswap_32(x) |
|
79 |
#define ENDIAN_LITTLE_16(x) x |
|
80 |
#define ENDIAN_BIG_16(x) bswap_16(x) |
|
81 |
#elif __BIG_ENDIAN__ |
|
82 |
#define ENDIAN_LITTLE_32(x) bswap_32(x) |
|
83 |
#define ENDIAN_BIG_32(x) x |
|
84 |
#define ENDIAN_LITTLE_16(x) bswap_16(x) |
|
3362
8d3b4d19ce27
in reprocessing openalbridge, a lot of code cleanup and simplification
koda
parents:
3360
diff
changeset
|
85 |
#define ENDIAN_BIG_16(x) x |
3353 | 86 |
#endif |
87 |
||
3513
f589230fa21b
now it's possible to select the scheme file in the ifrontendfix a type about loading an image (iphone file system IS case senstive)
koda
parents:
3364
diff
changeset
|
88 |
/* file format defines */ |
3364 | 89 |
#define OGG_FILE_FORMAT 0x4F676753 |
90 |
#define WAV_FILE_FORMAT 0x52494646 |
|
91 |
#define WAV_HEADER_SUBCHUNK2ID 0x64617461 |
|
3362
8d3b4d19ce27
in reprocessing openalbridge, a lot of code cleanup and simplification
koda
parents:
3360
diff
changeset
|
92 |
|
3353 | 93 |
|
94 |
#endif /*_OALB_GLOBALS_H*/ |