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>
|
2215
|
24 |
#include <stdint.h>
|
2212
|
25 |
|
|
26 |
#ifndef _WIN32
|
|
27 |
#include <pthread.h>
|
|
28 |
#else
|
|
29 |
#include <process.h>
|
|
30 |
#endif
|
|
31 |
|
2213
|
32 |
#include "al.h"
|
|
33 |
|
2212
|
34 |
#ifndef _SLEEP_H
|
|
35 |
#define _SLEEP_H
|
|
36 |
/** 1.0 02/03/10 - Defines cross-platform sleep, usleep, etc. * By Wu Yongwei **/
|
|
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
|
2213
|
42 |
# define WIN32_LEAN_AND_MEAN
|
2212
|
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
|
|
56 |
#endif /* _SLEEP_H */
|
|
57 |
|
|
58 |
#ifdef HAVE_BYTESWAP_H
|
|
59 |
/* use byteswap macros from the host system, hopefully optimized ones ;-) */
|
|
60 |
#include <byteswap.h>
|
|
61 |
#else
|
|
62 |
/* define our own version, simple, stupid, straight-forward... */
|
|
63 |
|
|
64 |
#define bswap_16(x) ((((x) & 0xFF00) >> 8) | (((x) & 0x00FF) << 8))
|
|
65 |
|
|
66 |
#define bswap_32(x) ((((x) & 0xFF000000) >> 24) | \
|
|
67 |
(((x) & 0x00FF0000) >> 8) | \
|
|
68 |
(((x) & 0x0000FF00) << 8) | \
|
|
69 |
(((x) & 0x000000FF) << 24) )
|
|
70 |
|
|
71 |
#endif /* HAVE_BYTESWAP_H */
|
|
72 |
|
|
73 |
#ifdef __CPLUSPLUS
|
|
74 |
extern "C" {
|
|
75 |
#endif
|
|
76 |
|
|
77 |
/*data type for WAV header*/
|
|
78 |
#pragma pack(1)
|
|
79 |
typedef struct _WAV_header_t {
|
2215
|
80 |
uint32_t ChunkID;
|
|
81 |
uint32_t ChunkSize;
|
|
82 |
uint32_t Format;
|
|
83 |
uint32_t Subchunk1ID;
|
|
84 |
uint32_t Subchunk1Size;
|
|
85 |
uint16_t AudioFormat;
|
|
86 |
uint16_t NumChannels;
|
|
87 |
uint32_t SampleRate;
|
|
88 |
uint32_t ByteRate;
|
|
89 |
uint16_t BlockAlign;
|
|
90 |
uint16_t BitsPerSample;
|
|
91 |
uint32_t Subchunk2ID;
|
|
92 |
uint32_t Subchunk2Size;
|
2212
|
93 |
} WAV_header_t;
|
|
94 |
#pragma pack()
|
|
95 |
|
|
96 |
/*data type for passing data between threads*/
|
|
97 |
typedef struct _fade_t {
|
|
98 |
int index;
|
|
99 |
unsigned int quantity;
|
|
100 |
} fade_t;
|
|
101 |
|
|
102 |
/*other defines*/
|
|
103 |
#define FADE_IN 11
|
|
104 |
#define FADE_OUT 12
|
|
105 |
|
|
106 |
#ifdef __CPLUSPLUS
|
|
107 |
}
|
|
108 |
#endif
|
|
109 |
|
2213
|
110 |
#endif /*_OALB_GLOBALS_H*/
|