source: roaraudio/roard/include/roard.h @ 4708:c9d40761088a

Last change on this file since 4708:c9d40761088a was 4708:c9d40761088a, checked in by phi, 13 years ago

updated copyright statements

File size: 5.1 KB
Line 
1//roard.h:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2008-2011
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()
30int 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 <pwd.h>
58#endif
59
60#ifdef ROAR_HAVE_H_SYS_TIME
61#include <sys/time.h>
62#endif
63#ifdef ROAR_HAVE_H_TIME
64#include <time.h>
65#endif
66
67#ifdef ROAR_HAVE_LIBSLP
68#include <slp.h>
69#endif
70
71/*
72#ifdef __linux__
73#include <linux/unistd.h>
74#include <linux/ioprio.h>
75#endif
76*/
77
78#define ROAR_SUBSYS_NONE          0x00
79#define ROAR_SUBSYS_WAVEFORM      0x01
80#define ROAR_SUBSYS_MIDI          0x02
81#define ROAR_SUBSYS_CB            0x04
82#define ROAR_SUBSYS_LIGHT         0x08
83#define ROAR_SUBSYS_RAW           0x10
84#define ROAR_SUBSYS_COMPLEX       0x20
85#define ROAR_SUBSYS_RDTCS         0x40
86
87// listeing code:
88#define ROAR_MAX_LISTEN_SOCKETS  8
89
90union uniinst {
91 void * vp;
92 int    si;
93};
94
95// MFOI = Marked For Optional Include
96
97//#include "buffer.h"
98#include "caps.h"
99#include "memlock.h"
100#include "codecfilter.h" /* MFOI */
101#include "container_framework.h" /* MFOI */
102#include "client.h"
103#include "auth.h"
104#include "driver.h" /* MFOI */
105#include "output.h"
106#include "mixer.h"
107//#include "convert.h"
108#include "streams.h"
109#include "network.h"
110#include "commands.h"
111#include "req.h"
112#include "emul_esd.h" /* MFOI */
113#include "emul_simple.h" /* MFOI */
114#include "emul_rsound.h" /* MFOI */
115#include "emul_rplay.h" /* MFOI */
116#include "emul_gopher.h" /* MFOI */
117#include "sources.h"
118#include "sample.h"
119#include "hwmixer.h"
120#include "meta.h"
121#include "midi.h"
122#include "ssynth.h"
123#include "light.h"
124#include "raw.h"
125#include "rdtcs.h"
126#include "waveform.h"
127#include "beep.h"
128#include "lib.h"
129#include "plugins.h"
130
131
132int alive;
133#ifdef ROAR_SUPPORT_LISTEN
134int g_no_listen;
135#endif
136
137uint32_t g_pos; // current possition in output stream
138
139int g_standby;
140int g_autostandby;
141
142#ifdef ROAR_SUPPORT_LISTEN
143struct roard_listen;
144#endif
145
146int main_loop (int driver, DRIVER_USERDATA_T driver_inst, struct roar_audio_info * sa, int sysclocksync);
147void cleanup_listen_socket (int terminate);
148void clean_quit (void);
149void clean_quit_prep (void);
150
151void on_sig_int  (int signum);
152void on_sig_term (int signum);
153void on_sig_chld (int signum);
154void on_sig_usr1 (int signum);
155
156#ifdef ROAR_SUPPORT_LISTEN
157int get_listen(struct roard_listen ** sock, char *** sockname);
158int add_listen (char * addr, int port, int sock_type, char * user, char * group, int proto, int dir, struct roar_audio_info * info);
159#endif
160
161#ifdef ROAR_SUPPORT_LISTEN
162struct roard_listen {
163 int used;
164 struct roar_vio_calls sock;
165 int proto;
166 union {
167  void * vp;
168  int    si;
169  struct {
170   int                    dir;
171   struct roar_audio_info info;
172  } stpl;
173 } inst;
174} g_listen[ROAR_MAX_LISTEN_SOCKETS];
175#endif
176
177int g_self_client;
178
179int g_terminate;
180
181struct roar_audio_info * g_sa, * g_max_sa;
182
183#define CONF_DEF_STRING "***default***"
184
185struct roard_config {
186 uint32_t flags;
187 struct {
188  uint32_t flags;
189  struct roar_mixer_settings mixer;
190  int                        mixer_channels;
191 } streams[ROAR_DIR_DIRIDS];
192 char * location;
193 char * description;
194 size_t jumbo_mtu;
195 int memlock_level;
196} * g_config;
197
198struct _counters {
199 size_t clients, streams,
200        samples,
201        sources, outputs,
202        mixers, bridges,
203        listens;
204};
205
206struct {
207 struct _counters cur, sum;
208} g_counters;
209
210
211#define counters_init() memset(&g_counters, 0, sizeof(g_counters))
212//#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)
213#define counters_inc(c,i) do { signed long int __i = (i); g_counters.cur.c += __i; if ( __i > 0 ) g_counters.sum.c += __i; } while (0)
214
215#define counters_get(g,c) ((g_counters.g.c))
216
217void counters_print(int type, int force);
218
219#endif
220
221//ll
Note: See TracBrowser for help on using the repository browser.