2212
|
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 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 General Public License for more details.
|
|
13 |
*
|
|
14 |
* You should have received a copy of the GNU 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 |
|
2213
|
19 |
#ifndef _OALB_GLOBALS_H
|
|
20 |
#define _OALB_GLOBALS_H
|
2212
|
21 |
|
|
22 |
#include <stdio.h>
|
|
23 |
#include <stdlib.h>
|
|
24 |
|
|
25 |
#ifndef _WIN32
|
|
26 |
#include <pthread.h>
|
|
27 |
#else
|
|
28 |
#include <process.h>
|
|
29 |
#endif
|
|
30 |
|
2213
|
31 |
#include "al.h"
|
|
32 |
|
2212
|
33 |
#ifndef _SLEEP_H
|
|
34 |
#define _SLEEP_H
|
|
35 |
/** 1.0 02/03/10 - Defines cross-platform sleep, usleep, etc. * By Wu Yongwei **/
|
|
36 |
#ifdef _WIN32
|
|
37 |
# if defined(_NEED_SLEEP_ONLY) && (defined(_MSC_VER) || defined(__MINGW32__))
|
|
38 |
# include <stdlib.h>
|
|
39 |
# define sleep(t) _sleep((t) * 1000)
|
|
40 |
# else
|
2213
|
41 |
# define WIN32_LEAN_AND_MEAN
|
2212
|
42 |
# include <windows.h>
|
|
43 |
# define sleep(t) Sleep((t) * 1000)
|
|
44 |
# endif
|
|
45 |
# ifndef _NEED_SLEEP_ONLY
|
|
46 |
# define msleep(t) Sleep(t)
|
|
47 |
# define usleep(t) Sleep((t) / 1000)
|
|
48 |
# endif
|
|
49 |
#else
|
|
50 |
# include <unistd.h>
|
|
51 |
# ifndef _NEED_SLEEP_ONLY
|
|
52 |
# define msleep(t) usleep((t) * 1000)
|
|
53 |
# endif
|
|
54 |
#endif
|
|
55 |
#endif /* _SLEEP_H */
|
|
56 |
|
|
57 |
#ifdef HAVE_BYTESWAP_H
|
|
58 |
/* use byteswap macros from the host system, hopefully optimized ones ;-) */
|
|
59 |
#include <byteswap.h>
|
|
60 |
#else
|
|
61 |
/* define our own version, simple, stupid, straight-forward... */
|
|
62 |
|
|
63 |
#define bswap_16(x) ((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8))
|
|
64 |
|
|
65 |
#define bswap_32(x) ((((x) & 0xFF000000) >> 24) | \
|
|
66 |
(((x) & 0x00FF0000) >> 8) | \
|
|
67 |
(((x) & 0x0000FF00) << 8) | \
|
|
68 |
(((x) & 0x000000FF) << 24) )
|
|
69 |
|
|
70 |
#endif /* HAVE_BYTESWAP_H */
|
|
71 |
|
|
72 |
#ifdef __CPLUSPLUS
|
|
73 |
extern "C" {
|
|
74 |
#endif
|
|
75 |
|
|
76 |
/*data type for WAV header*/
|
|
77 |
#pragma pack(1)
|
|
78 |
typedef struct _WAV_header_t {
|
2214
|
79 |
int ChunkID;
|
|
80 |
int ChunkSize;
|
|
81 |
int Format;
|
|
82 |
int Subchunk1ID;
|
|
83 |
int Subchunk1Size;
|
|
84 |
short int AudioFormat;
|
|
85 |
short int NumChannels;
|
|
86 |
int SampleRate;
|
|
87 |
int ByteRate;
|
|
88 |
short int BlockAlign;
|
|
89 |
short int BitsPerSample;
|
|
90 |
int Subchunk2ID;
|
|
91 |
int Subchunk2Size;
|
2212
|
92 |
} WAV_header_t;
|
|
93 |
#pragma pack()
|
|
94 |
|
|
95 |
/*data type for passing data between threads*/
|
|
96 |
typedef struct _fade_t {
|
|
97 |
int index;
|
|
98 |
unsigned int quantity;
|
|
99 |
} fade_t;
|
|
100 |
|
|
101 |
/*other defines*/
|
|
102 |
#define FADE_IN 11
|
|
103 |
#define FADE_OUT 12
|
|
104 |
|
|
105 |
#ifdef __CPLUSPLUS
|
|
106 |
}
|
|
107 |
#endif
|
|
108 |
|
2213
|
109 |
#endif /*_OALB_GLOBALS_H*/
|