source: roaraudio/include/roaraudio.h @ 5951:b0e1eff45456

Last change on this file since 5951:b0e1eff45456 was 5951:b0e1eff45456, checked in by phi, 10 years ago

more header cleanup: cleanup of #includes

File size: 8.3 KB
Line 
1//roaraudio.h:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2013
5 *
6 *  This file is part of RoarAudio,
7 *  a cross-platform sound system for both, home and professional use.
8 *  See README for details.
9 *
10 *  This file is free software; you can redistribute it and/or modify
11 *  it under the terms of the GNU Lesser General Public License version 3
12 *  as published by the Free Software Foundation.
13 *
14 *  RoarAudio is distributed in the hope that it will be useful,
15 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 *  GNU Lesser General Public License for more details.
18 *
19 *  You should have received a copy of the GNU Lesser General Public License
20 *  along with this software; see the file COPYING.  If not, write to
21 *  the Free Software Foundation, 51 Franklin Street, Fifth Floor,
22 *  Boston, MA 02110-1301, USA.
23 *
24 *  NOTE: Even though this file is LGPLed it (may) include GPLed files
25 *  so the license of this file is/may therefore downgraded to GPL.
26 *  See HACKING for details.
27 */
28
29#ifndef _ROARAUDIO_H_
30#define _ROARAUDIO_H_
31
32#define  _ROAR_MKVERSION(a,b,c) (((uint32_t)(a) << 16) + ((uint32_t)(b) << 8) + (uint32_t)(c))
33
34#include <roaraudio/config.h>
35#include <roaraudio/compilerhacks.h>
36#include <roaraudio/targethacks.h>
37#include <roaraudio/muconthacks.h>
38#include <roaraudio/win32hacks.h> // we include this at the beginning of the file
39                                  // so we can define well known standard types known to everyone
40                                  // and everywhere but win32 here
41
42#define ROAR_VERSION _ROAR_MKVERSION(ROAR_VERSION_MAJOR, ROAR_VERSION_MINOR, ROAR_VERSION_REV)
43
44#if defined(DEBUG) && !defined(ROAR_SUPPORT_TRAP)
45#define ROAR_SUPPORT_TRAP
46#endif
47
48// consts we need to set depending on the OS and features:
49#if defined(ROAR_NEED_GNU_SOURCE) && !defined(_GNU_SOURCE)
50#define _GNU_SOURCE
51#endif
52
53#if defined(ROAR_NEED_BSD_VISIBLE) && !defined(__BSD_VISIBLE)
54#define __BSD_VISIBLE 1
55#endif
56
57#ifdef ROAR_HAVE_H_STDINT
58#include <stdint.h>
59#endif
60
61#include <stdlib.h>
62
63#ifdef ROAR_HAVE_H_UNISTD
64#include <unistd.h>
65#endif
66
67#include <stdio.h>
68#include <string.h>
69#include <errno.h>
70
71#ifdef ROAR_HAVE_H_SYS_TYPES
72#include <sys/types.h>
73#endif
74
75#include <limits.h>
76#if !defined(ROAR_TARGET_WIN32) && !defined(ROAR_TARGET_MICROCONTROLLER)
77#include <sys/mman.h>
78#endif
79
80#ifdef ROAR_HAVE_H_SYS_STAT
81#include <sys/stat.h>
82#endif
83
84// NOTE: we need this macro in some of our header files.
85// TODO: This is oubslute, we will remove it soon.
86#if INT_MAX >= 32767
87#define roar_intm16  int
88#define roar_uintm16 unsigned int
89#else
90#define roar_intm16  int16_t
91#define roar_uintm16 uint16_t
92#endif
93
94// this is to avoid warning messages on platforms
95// where sizeof(void*) == 8 and szeof(int) == 4
96#ifdef __LP64__
97#define ROAR_INSTINT long int
98#else
99#define ROAR_INSTINT int
100#endif
101
102#ifndef __BEGIN_DECLS
103#ifdef __cplusplus
104# define __BEGIN_DECLS extern "C" {
105# define __END_DECLS }
106#else
107# define __BEGIN_DECLS
108# define __END_DECLS
109#endif
110#endif
111
112__BEGIN_DECLS
113
114#include <roaraudio/license.h>
115#include <roaraudio/vendors.h>
116#include <roaraudio/proto.h>
117#include <roaraudio/caps.h>
118#include <roaraudio/error.h>
119#include <roaraudio/audio.h>
120#include <roaraudio/stream.h>
121#include <roaraudio/client.h>
122#include <roaraudio/sample.h>
123#include <roaraudio/beep.h>
124#include <roaraudio/meta.h>
125#include <roaraudio/genre.h>
126#include <roaraudio/acl.h>
127#include <roaraudio/misc.h>
128#include <roaraudio/byteorder.h>
129#include <roaraudio/socket.h>
130#include <roaraudio/ltm.h>
131#include <roaraudio/notify.h>
132
133#include <libroar/libroar.h>
134
135// Some settings for roard:
136#ifndef ROAR_ROARD_BITS
137#define ROAR_ROARD_BITS 32
138#endif
139
140// Some glocal network defaults:
141#ifndef ROAR_NET_INET4_LOCALHOST
142#define ROAR_NET_INET4_LOCALHOST "localhost"
143#endif
144#ifndef ROAR_NET_INET4_ANYHOST
145#define ROAR_NET_INET4_ANYHOST   "0.0.0.0"
146#endif
147
148#ifndef ROAR_NET_INET6_LOCALHOST
149#define ROAR_NET_INET6_LOCALHOST "ipv6-localhost"
150#endif
151#ifndef ROAR_NET_INET6_ANYHOST
152#define ROAR_NET_INET6_ANYHOST   "::"
153#endif
154
155// IP:
156#define ROAR_DEFAULT_PORT        16002
157
158// IPv4
159#define ROAR_DEFAULT_INET4_PORT  ROAR_DEFAULT_PORT
160#define ROAR_DEFAULT_INET4_HOST  ROAR_NET_INET4_LOCALHOST
161// aliases:
162#define ROAR_DEFAULT_HOST        ROAR_DEFAULT_INET4_HOST
163#define ROAR_DEFAULT_HOSTPORT    ROAR_DEFAULT_HOST ":16002"
164
165// IPv6:
166#define ROAR_DEFAULT_INET6_PORT  ROAR_DEFAULT_PORT
167#define ROAR_DEFAULT_INET6_HOST  ROAR_NET_INET6_LOCALHOST
168
169// UNIX Domain Sockets
170#define ROAR_DEFAULT_SOCK_GLOBAL "/tmp/roar"
171#define ROAR_DEFAULT_SOCK_USER   ".roar"
172
173// DECnet
174#define ROAR_DEFAULT_OBJECT      "roar"
175#define ROAR_DEFAULT_NUM         0
176#define ROAR_DEFAULT_LISTEN_OBJECT "::" ROAR_DEFAULT_OBJECT
177
178// now handled by configure:
179//#define ROAR_DEFAULT_SOCKGRP     "audio"
180
181
182// defines for emulations:
183// ESD:
184#define ROAR_DEFAULT_ESD_GSOCK   "/tmp/.esd/socket"
185#define ROAR_DEFAULT_ESD_PORT    16001
186// RSound:
187#define ROAR_DEFAULT_RSOUND_GSOCK  "/tmp/rsound"
188#define ROAR_DEFAULT_RSOUND_PORT   12345
189#define ROAR_DEFAULT_RSOUND_OBJECT "::rsound"
190// PulseAudio:
191#define ROAR_DEFAULT_PA_PORT     4712
192// RPlay:
193#define ROAR_DEFAULT_RPLAY_PORT  5556
194// Gopher:
195#define ROAR_DEFAULT_GOPHER_PORT 70
196// WWW/HTTP:
197#define ROAR_DEFAULT_HTTP_PORT   80
198
199#if defined(ROAR_HAVE_LIBWSOCK32) && defined(ROAR_HAVE_LIBWS2_32)
200#define ROAR_LIBS_WIN32          " -lwsock32 -lws2_32"
201#else
202#define ROAR_LIBS_WIN32          ""
203#endif
204
205#ifdef ROAR_HAVE_LIBSOCKET
206#define ROAR_LIBS_LIBSOCKET      " -lsocket"
207#else
208#define ROAR_LIBS_LIBSOCKET      ""
209#endif
210
211#ifdef ROAR_HAVE_LIBSENDFILE
212#define ROAR_LIBS_LIBSENDFILE    " -lsendfile"
213#else
214#define ROAR_LIBS_LIBSENDFILE    ""
215#endif
216
217#define ROAR_LIBS_NET_LIBS       ROAR_LIBS_LIBSOCKET ROAR_LIBS_WIN32
218
219#define ROAR_LIBS                "-lroar"       ROAR_LIBS_LIBSENDFILE ROAR_LIBS_NET_LIBS
220#define ROAR_LIBS_DSP            "-lroardsp "   ROAR_LIBS
221#define ROAR_LIBS_MIDI           "-lroarmidi "  ROAR_LIBS_DSP
222#define ROAR_LIBS_LIGHT          "-lroarlight " ROAR_LIBS
223#define ROAR_LIBS_EIO            "-lroareio "   ROAR_LIBS
224#define ROAR_CFLAGS              ""
225
226// comp libs:
227#define ROAR_LIBS_C_ESD          "-lroaresd "   ROAR_LIBS
228#define ROAR_LIBS_C_ARTSC        "-lroarartsc " ROAR_LIBS
229#define ROAR_LIBS_C_PULSE        "-lroarpulse " ROAR_LIBS
230#define ROAR_LIBS_C_PULSE_SIMPLE "-lroarpulse-simple " ROAR_LIBS_C_PULSE
231#define ROAR_LIBS_C_SNDIO        "-lroarsndio " ROAR_LIBS
232#define ROAR_LIBS_C_YIFF         "-lroaryiff "  ROAR_LIBS
233
234//some basic macros:
235#define ROAR_STDIN  0
236#define ROAR_STDOUT 1
237#define ROAR_STDERR 2
238
239#define ROAR_DEBUG_OUTFH stderr
240
241#ifndef ROAR_DBG_PREFIX
242#define ROAR_DBG_PREFIX "roaraudio"
243#endif
244
245#define ROAR_DBG_FULLPREFIX "(" ROAR_DBG_PREFIX ": " __FILE__ ":%i): "
246
247// some default info levels:
248#define ROAR_DBG_INFO_NONE             0
249#define ROAR_DBG_INFO_NOTICE           1
250#define ROAR_DBG_INFO_INFO             2
251#define ROAR_DBG_INFO_VERBOSE          3
252
253#if !defined(__GNUC__)
254 #define ROAR_DBG(format, ...)
255 #define ROAR_ERR(format, ...)
256 #define ROAR_WARN(format, ...)
257 #define ROAR_INFO(format, level, ...)
258#elif __GNUC__ < 3
259 #define ROAR_DBG(format, args...)
260 #define ROAR_ERR(format, args...)
261 #define ROAR_WARN(format, args...)
262 #define ROAR_INFO(format, level, args...)
263#else
264
265#ifdef DEBUG
266 #define ROAR_DBG(format, args...)  roar_debug_msg(ROAR_DEBUG_TYPE_DEBUG, __LINE__, __FILE__, ROAR_DBG_PREFIX, format, ## args)
267#else
268 #define ROAR_DBG(format, args...)
269#endif
270
271#define ROAR_ERR(format, args...)  roar_debug_msg(ROAR_DEBUG_TYPE_ERROR, __LINE__, __FILE__, ROAR_DBG_PREFIX, format, ## args)
272#define ROAR_WARN(format, args...) roar_debug_msg(ROAR_DEBUG_TYPE_WARNING, __LINE__, __FILE__, ROAR_DBG_PREFIX, format, ## args)
273
274// INFO function:
275#ifdef DEBUG
276 #define ROAR_INFO(format, level, args...) roar_debug_msg(ROAR_DEBUG_TYPE_INFO, __LINE__, __FILE__, ROAR_DBG_PREFIX, format, ## args)
277#elif defined(ROAR_DBG_INFOVAR)
278 #define ROAR_INFO(format, level, args...) if ( (ROAR_DBG_INFOVAR) >= (level) ) roar_debug_msg(ROAR_DEBUG_TYPE_INFO, __LINE__, __FILE__, ROAR_DBG_PREFIX, format, ## args)
279#else
280 #define ROAR_INFO(format, level, args...)
281#endif
282
283#endif
284
285#ifdef ROAR_HAVE_SAFE_OVERFLOW
286#define ROAR_MATH_OVERFLOW_ADD(a, b) ((a)+(b))
287#else
288#define ROAR_MATH_OVERFLOW_ADD(a, b) ((4294967295U - (a)) + 1 + (b))
289#endif
290
291#ifdef ROAR_HAVE_STRCASESTR
292#define _roar_strcasestr(a,b) strcasestr((a), (b))
293#else
294#define _roar_strcasestr(a,b) NULL
295#endif
296
297__END_DECLS
298
299#endif
300
301//ll
Note: See TracBrowser for help on using the repository browser.