source: roaraudio/include/roaraudio.h @ 6067:53fec3e5f6cf

Last change on this file since 6067:53fec3e5f6cf was 6067:53fec3e5f6cf, checked in by phi, 9 years ago

updated copyright headers

File size: 8.4 KB
Line 
1//roaraudio.h:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
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#ifdef ROAR_HAVE_H_SYS_SOCKET
76#include <sys/socket.h>
77#endif
78
79#include <limits.h>
80#if !defined(ROAR_TARGET_WIN32) && !defined(ROAR_TARGET_MICROCONTROLLER)
81#include <sys/mman.h>
82#endif
83
84#ifdef ROAR_HAVE_H_SYS_STAT
85#include <sys/stat.h>
86#endif
87
88// NOTE: we need this macro in some of our header files.
89// TODO: This is oubslute, we will remove it soon.
90#if INT_MAX >= 32767
91#define roar_intm16  int
92#define roar_uintm16 unsigned int
93#else
94#define roar_intm16  int16_t
95#define roar_uintm16 uint16_t
96#endif
97
98// this is to avoid warning messages on platforms
99// where sizeof(void*) == 8 and szeof(int) == 4
100#ifdef __LP64__
101#define ROAR_INSTINT long int
102#else
103#define ROAR_INSTINT int
104#endif
105
106#ifndef __BEGIN_DECLS
107#ifdef __cplusplus
108# define __BEGIN_DECLS extern "C" {
109# define __END_DECLS }
110#else
111# define __BEGIN_DECLS
112# define __END_DECLS
113#endif
114#endif
115
116__BEGIN_DECLS
117
118#include <roaraudio/license.h>
119#include <roaraudio/vendors.h>
120#include <roaraudio/proto.h>
121#include <roaraudio/caps.h>
122#include <roaraudio/error.h>
123#include <roaraudio/audio.h>
124#include <roaraudio/stream.h>
125#include <roaraudio/client.h>
126#include <roaraudio/sample.h>
127#include <roaraudio/beep.h>
128#include <roaraudio/meta.h>
129#include <roaraudio/genre.h>
130#include <roaraudio/acl.h>
131#include <roaraudio/misc.h>
132#include <roaraudio/byteorder.h>
133#include <roaraudio/socket.h>
134#include <roaraudio/ltm.h>
135#include <roaraudio/notify.h>
136
137#include <libroar/libroar.h>
138
139// Some settings for roard:
140#ifndef ROAR_ROARD_BITS
141#define ROAR_ROARD_BITS 32
142#endif
143
144// Some glocal network defaults:
145#ifndef ROAR_NET_INET4_LOCALHOST
146#define ROAR_NET_INET4_LOCALHOST "localhost"
147#endif
148#ifndef ROAR_NET_INET4_ANYHOST
149#define ROAR_NET_INET4_ANYHOST   "0.0.0.0"
150#endif
151
152#ifndef ROAR_NET_INET6_LOCALHOST
153#define ROAR_NET_INET6_LOCALHOST "ipv6-localhost"
154#endif
155#ifndef ROAR_NET_INET6_ANYHOST
156#define ROAR_NET_INET6_ANYHOST   "::"
157#endif
158
159// IP:
160#define ROAR_DEFAULT_PORT        16002
161
162// IPv4
163#define ROAR_DEFAULT_INET4_PORT  ROAR_DEFAULT_PORT
164#define ROAR_DEFAULT_INET4_HOST  ROAR_NET_INET4_LOCALHOST
165// aliases:
166#define ROAR_DEFAULT_HOST        ROAR_DEFAULT_INET4_HOST
167#define ROAR_DEFAULT_HOSTPORT    ROAR_DEFAULT_HOST ":16002"
168
169// IPv6:
170#define ROAR_DEFAULT_INET6_PORT  ROAR_DEFAULT_PORT
171#define ROAR_DEFAULT_INET6_HOST  ROAR_NET_INET6_LOCALHOST
172
173// UNIX Domain Sockets
174#define ROAR_DEFAULT_SOCK_GLOBAL "/tmp/roar"
175#define ROAR_DEFAULT_SOCK_USER   ".roar"
176
177// DECnet
178#define ROAR_DEFAULT_OBJECT      "roar"
179#define ROAR_DEFAULT_NUM         0
180#define ROAR_DEFAULT_LISTEN_OBJECT "::" ROAR_DEFAULT_OBJECT
181
182// now handled by configure:
183//#define ROAR_DEFAULT_SOCKGRP     "audio"
184
185
186// defines for emulations:
187// ESD:
188#define ROAR_DEFAULT_ESD_GSOCK   "/tmp/.esd/socket"
189#define ROAR_DEFAULT_ESD_PORT    16001
190// RSound:
191#define ROAR_DEFAULT_RSOUND_GSOCK  "/tmp/rsound"
192#define ROAR_DEFAULT_RSOUND_PORT   12345
193#define ROAR_DEFAULT_RSOUND_OBJECT "::rsound"
194// PulseAudio:
195#define ROAR_DEFAULT_PA_PORT     4712
196// RPlay:
197#define ROAR_DEFAULT_RPLAY_PORT  5556
198// Gopher:
199#define ROAR_DEFAULT_GOPHER_PORT 70
200// WWW/HTTP:
201#define ROAR_DEFAULT_HTTP_PORT   80
202
203#if defined(ROAR_HAVE_LIBWSOCK32) && defined(ROAR_HAVE_LIBWS2_32)
204#define ROAR_LIBS_WIN32          " -lwsock32 -lws2_32"
205#else
206#define ROAR_LIBS_WIN32          ""
207#endif
208
209#ifdef ROAR_HAVE_LIBSOCKET
210#define ROAR_LIBS_LIBSOCKET      " -lsocket"
211#else
212#define ROAR_LIBS_LIBSOCKET      ""
213#endif
214
215#ifdef ROAR_HAVE_LIBSENDFILE
216#define ROAR_LIBS_LIBSENDFILE    " -lsendfile"
217#else
218#define ROAR_LIBS_LIBSENDFILE    ""
219#endif
220
221#define ROAR_LIBS_NET_LIBS       ROAR_LIBS_LIBSOCKET ROAR_LIBS_WIN32
222
223#define ROAR_LIBS                "-lroar"       ROAR_LIBS_LIBSENDFILE ROAR_LIBS_NET_LIBS
224#define ROAR_LIBS_DSP            "-lroardsp "   ROAR_LIBS
225#define ROAR_LIBS_MIDI           "-lroarmidi "  ROAR_LIBS_DSP
226#define ROAR_LIBS_LIGHT          "-lroarlight " ROAR_LIBS
227#define ROAR_LIBS_EIO            "-lroareio "   ROAR_LIBS
228#define ROAR_CFLAGS              ""
229
230// comp libs:
231#define ROAR_LIBS_C_ESD          "-lroaresd "   ROAR_LIBS
232#define ROAR_LIBS_C_ARTSC        "-lroarartsc " ROAR_LIBS
233#define ROAR_LIBS_C_PULSE        "-lroarpulse " ROAR_LIBS
234#define ROAR_LIBS_C_PULSE_SIMPLE "-lroarpulse-simple " ROAR_LIBS_C_PULSE
235#define ROAR_LIBS_C_SNDIO        "-lroarsndio " ROAR_LIBS
236#define ROAR_LIBS_C_YIFF         "-lroaryiff "  ROAR_LIBS
237
238//some basic macros:
239#define ROAR_STDIN  0
240#define ROAR_STDOUT 1
241#define ROAR_STDERR 2
242
243#define ROAR_DEBUG_OUTFH stderr
244
245#ifndef ROAR_DBG_PREFIX
246#define ROAR_DBG_PREFIX "roaraudio"
247#endif
248
249#define ROAR_DBG_FULLPREFIX "(" ROAR_DBG_PREFIX ": " __FILE__ ":%i): "
250
251// some default info levels:
252#define ROAR_DBG_INFO_NONE             0
253#define ROAR_DBG_INFO_NOTICE           1
254#define ROAR_DBG_INFO_INFO             2
255#define ROAR_DBG_INFO_VERBOSE          3
256
257#if !defined(__GNUC__)
258 #define ROAR_DBG(format, ...)
259 #define ROAR_ERR(format, ...)
260 #define ROAR_WARN(format, ...)
261 #define ROAR_INFO(format, level, ...)
262#elif __GNUC__ < 3
263 #define ROAR_DBG(format, args...)
264 #define ROAR_ERR(format, args...)
265 #define ROAR_WARN(format, args...)
266 #define ROAR_INFO(format, level, args...)
267#else
268
269#ifdef DEBUG
270 #define ROAR_DBG(format, args...)  roar_debug_msg(ROAR_DEBUG_TYPE_DEBUG, __LINE__, __FILE__, ROAR_DBG_PREFIX, format, ## args)
271#else
272 #define ROAR_DBG(format, args...)
273#endif
274
275#define ROAR_ERR(format, args...)  roar_debug_msg(ROAR_DEBUG_TYPE_ERROR, __LINE__, __FILE__, ROAR_DBG_PREFIX, format, ## args)
276#define ROAR_WARN(format, args...) roar_debug_msg(ROAR_DEBUG_TYPE_WARNING, __LINE__, __FILE__, ROAR_DBG_PREFIX, format, ## args)
277
278// INFO function:
279#ifdef DEBUG
280 #define ROAR_INFO(format, level, args...) roar_debug_msg(ROAR_DEBUG_TYPE_INFO, __LINE__, __FILE__, ROAR_DBG_PREFIX, format, ## args)
281#elif defined(ROAR_DBG_INFOVAR)
282 #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)
283#else
284 #define ROAR_INFO(format, level, args...)
285#endif
286
287#endif
288
289#ifdef ROAR_HAVE_SAFE_OVERFLOW
290#define ROAR_MATH_OVERFLOW_ADD(a, b) ((a)+(b))
291#else
292#define ROAR_MATH_OVERFLOW_ADD(a, b) ((4294967295U - (a)) + 1 + (b))
293#endif
294
295#ifdef ROAR_HAVE_STRCASESTR
296#define _roar_strcasestr(a,b) strcasestr((a), (b))
297#else
298#define _roar_strcasestr(a,b) NULL
299#endif
300
301__END_DECLS
302
303#endif
304
305//ll
Note: See TracBrowser for help on using the repository browser.