source: roaraudio/roard/include/roard.h @ 6052:d48765b2475e

Last change on this file since 6052:d48765b2475e was 6052:d48765b2475e, checked in by phi, 9 years ago

updated copyright headers

File size: 5.5 KB
Line 
1//roard.h:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2015
5 *
6 *  This file is part of roard a 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 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 General Public License for more details.
18 *
19 *  You should have received a copy of the GNU 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 */
25
26#ifndef _ROARD_H_
27#define _ROARD_H_
28
29// configure ROAR_INFO()
30extern int g_verbose;
31#define ROAR_DBG_INFOVAR g_verbose
32
33// configure ROAR_*()
34#define ROAR_DBG_PREFIX "roard"
35
36// need to include this first as we need the config
37#include <roaraudio.h>
38#include <roaraudio/units.h>
39#include <libroarlight/libroarlight.h>
40#include <libroareio/libroareio.h>
41
42#include <ctype.h>
43
44#ifdef ROAR_HAVE_H_SIGNAL
45#include <signal.h>
46#endif
47
48#if defined(ROAR_HAVE_SELECT) && defined(ROAR_HAVE_H_SYS_SELECT)
49#include <sys/select.h>
50#endif
51
52#ifdef ROAR_HAVE_WAIT
53#include <sys/wait.h>
54#endif
55
56#if !defined(ROAR_TARGET_WIN32) && !defined(ROAR_TARGET_MICROCONTROLLER)
57#include <grp.h>
58#include <pwd.h>
59#endif
60
61#ifdef ROAR_HAVE_H_SYS_TIME
62#include <sys/time.h>
63#endif
64#ifdef ROAR_HAVE_H_TIME
65#include <time.h>
66#endif
67
68#ifdef ROAR_HAVE_LIBSLP
69#include <slp.h>
70#endif
71
72/*
73#ifdef __linux__
74#include <linux/unistd.h>
75#include <linux/ioprio.h>
76#endif
77*/
78
79#define ROAR_SUBSYS_NONE          0x00
80#define ROAR_SUBSYS_WAVEFORM      0x01
81#define ROAR_SUBSYS_MIDI          0x02
82#define ROAR_SUBSYS_CB            0x04
83#define ROAR_SUBSYS_LIGHT         0x08
84#define ROAR_SUBSYS_RAW           0x10
85#define ROAR_SUBSYS_COMPLEX       0x20
86#define ROAR_SUBSYS_RDTCS         0x40
87
88// listeing code:
89#define ROAR_MAX_LISTEN_SOCKETS   16
90
91union uniinst {
92 void * vp;
93 int    si;
94};
95
96enum output_format {
97 FORMAT_NATIVE = 1,
98 FORMAT_WIKI,
99 FORMAT_CSV,
100
101 FORMAT_DEFAULT = FORMAT_NATIVE
102};
103
104
105// MFOI = Marked For Optional Include
106
107//#include "buffer.h"
108#include "caps.h"
109#include "memlock.h"
110#include "codecfilter.h" /* MFOI */
111#include "container_framework.h" /* MFOI */
112#include "rolestack.h"
113#include "client.h"
114#include "auth.h"
115#include "driver.h" /* MFOI */
116#include "output.h"
117#include "mixer.h"
118//#include "convert.h"
119#include "streams.h"
120#include "network.h"
121#include "commands.h"
122#include "req.h"
123#include "emul_simple.h" /* MFOI */
124#include "emul_rsound.h" /* MFOI */
125#include "sources.h"
126#include "sample.h"
127#include "hwmixer.h"
128#include "meta.h"
129#include "midi.h"
130#include "ssynth.h"
131#include "light.h"
132#include "raw.h"
133#include "rdtcs.h"
134#include "waveform.h"
135#include "beep.h"
136#include "lib.h"
137#include "plugins.h"
138
139
140extern int alive;
141#ifdef ROAR_SUPPORT_LISTEN
142extern int g_no_listen;
143#endif
144
145extern uint32_t g_pos; // current position in output stream
146
147extern int g_standby;
148extern int g_autostandby;
149
150#ifdef ROAR_SUPPORT_LISTEN
151struct roard_listen;
152#endif
153
154int main_loop (struct roar_audio_info * sa, int sysclocksync);
155void cleanup_listen_socket (int terminate);
156void clean_quit (void);
157void clean_quit_prep (void);
158
159void on_sig_int  (int signum);
160void on_sig_term (int signum);
161void on_sig_chld (int signum);
162void on_sig_usr1 (int signum);
163
164#ifdef ROAR_SUPPORT_LISTEN
165int get_listen(struct roard_listen ** sock, const char *** sockname);
166int add_listen (const char * addr, int port, int sock_type, char * user, char * group, int proto, int dir, struct roar_audio_info * info);
167#endif
168
169#ifdef ROAR_SUPPORT_LISTEN
170extern struct roard_listen {
171 int used;
172 struct roar_vio_calls sock;
173 int proto;
174 union {
175  void * vp;
176  int    si;
177  struct {
178   int                    dir;
179   struct roar_audio_info info;
180  } stpl;
181 } inst;
182} g_listen[ROAR_MAX_LISTEN_SOCKETS];
183#endif
184
185extern int g_self_client;
186
187extern int g_terminate;
188
189extern struct roar_audio_info * g_sa, * g_max_sa;
190
191#define CONF_DEF_STRING "***default***"
192
193extern struct roard_config {
194 uint32_t flags;
195 struct {
196  uint32_t                   flags;
197  struct roar_mixer_settings mixer;
198  int                        mixer_channels;
199  int                        rpgmode;
200 } streams[ROAR_DIR_DIRIDS];
201 char * location;
202 char * description;
203 char * contact;
204 char * serial;
205 char * uiurl;
206 size_t jumbo_mtu;
207 int memlock_level;
208#ifdef ROAR_HAVE_SYSTEM
209 struct {
210  const char * post_shutdown;
211 } scripts;
212#endif
213} * g_config;
214
215struct _counters {
216 size_t clients, streams,
217        samples,
218        sources, outputs,
219        mixers, bridges,
220        listens;
221};
222
223extern struct counters {
224 struct _counters cur, sum;
225} g_counters;
226
227
228#define counters_init() memset(counters_getptr(), 0, sizeof(struct counters))
229//#define counters_inc(c,i) do { signed long int __i = (i); if ( __i < 0 && __i > (g_counters.cur.c) ) { ROAR_WARN("counters_inc(c=%s, i=%li): Decrement request bigger than current counter value. Counter out of syn!", )  } while (0)
230#define counters_inc(c,i) do { signed long int __i = (i); counters_getptr()->cur.c += __i; if ( __i > 0 ) counters_getptr()->sum.c += __i; } while (0)
231
232#define counters_get(g,c) ((counters_getptr()->g.c))
233
234struct counters * counters_getptr(void);
235void counters_print(int type, int force);
236
237#endif
238
239//ll
Note: See TracBrowser for help on using the repository browser.