source: roaraudio/include/libroarsndio/sndiosym.h @ 3239:5e424066db4f

Last change on this file since 3239:5e424066db4f was 3239:5e424066db4f, checked in by phi, 14 years ago

complet struct sio_cap

File size: 5.5 KB
Line 
1//sndiosym.h:
2
3/*
4 *      Copyright (C) Philipp 'ph3-der-loewe' Schafft - 2009
5 *  The code (may) include prototypes and comments (and maybe
6 *  other code fragements) from EsounD.
7 *  They are mostly copyrighted by Eric B. Mitchell (aka 'Ricdude)
8 *  <ericmit@ix.netcom.com>. For more information see AUTHORS.esd.
9 *
10 *  This file is part of libroaresd a part of RoarAudio,
11 *  a cross-platform sound system for both, home and professional use.
12 *  See README for details.
13 *
14 *  This file is free software; you can redistribute it and/or modify
15 *  it under the terms of the GNU General Public License version 3
16 *  as published by the Free Software Foundation.
17 *
18 *  RoarAudio is distributed in the hope that it will be useful,
19 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
20 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21 *  GNU General Public License for more details.
22 *
23 *  You should have received a copy of the GNU General Public License
24 *  along with this software; see the file COPYING.  If not, write to
25 *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
26 *
27 *  NOTE for everyone want's to change something and send patches:
28 *  read README and HACKING! There a addition information on
29 *  the license of this document you need to read before you send
30 *  any patches.
31 */
32
33#ifndef _LIBROARSNDIO_SNDIOSYM_H_
34#define _LIBROARSNDIO_SNDIOSYM_H_
35
36#include <roaraudio.h>
37
38#ifdef ROAR_HAVE_H_POLL
39#include <poll.h>
40#else
41struct pollfd;
42#endif
43
44#define SIO_PLAY        1
45#define SIO_REC         2
46#define MIO_OUT         4
47#define MIO_IN          8
48
49#define SIO_IGNORE      0       /* pause during xrun */
50#define SIO_SYNC        1       /* resync after xrun */
51#define SIO_ERROR       2       /* terminate on xrun */
52#define SIO_XSTRINGS    {"ignore", "sync", "error"}
53
54#define SIO_NENC        8
55#define SIO_NCHAN       8
56#define SIO_NRATE       16
57#define SIO_NCONF       4
58
59#define SIO_ENCMAX      10
60
61#if BYTE_ORDER == BIG_ENDIAN && !defined(ROAR_TARGET_WIN32)
62#define SIO_LE_NATIVE   0
63#else
64#if BYTE_ORDER == LITTLE_ENDIAN
65#define SIO_LE_NATIVE   1
66#else
67#error Byte Order of this system is not supported within the sndio interface.
68#endif
69#endif
70
71#define SIO_BPS(bits) (((bits) <= 8) ? 1 : (((bits) <= 16) ? 2 : 4))
72
73#define SIO_SUN_PATH    NULL
74#define SIO_AUCAT_PATH  NULL
75
76#define SIO_MAXVOL 127
77
78
79struct sio_par {
80 unsigned bits;          /* bits per sample */
81 unsigned bps;           /* bytes per sample */
82 unsigned sig;           /* 1 = signed, 0 = unsigned */
83 unsigned le;            /* 1 = LE, 0 = BE byte order */
84 unsigned msb;           /* 1 = MSB, 0 = LSB aligned */
85 unsigned rchan;         /* number channels for recording */
86 unsigned pchan;         /* number channels for playback */
87 unsigned rate;          /* frames per second */
88 unsigned appbufsz;      /* minimum buffer size without xruns */
89 unsigned bufsz;         /* end-to-end buffer size (read-only) */
90 unsigned round;         /* optimal buffer size divisor */
91 unsigned xrun;          /* what to do on overrun/underrun */
92};
93
94struct sio_cap {
95 struct sio_enc {                /* allowed encodings */
96  unsigned bits;                 /* bits per sample */
97  unsigned bps;                  /* bytes per sample */
98  unsigned sig;                  /* 1 = signed, 0 = unsigned */
99  unsigned le;                   /* 1 = LE, 0 = BE byte order */
100  unsigned msb;                  /* 1 = MSB, 0 = LSB aligned */
101 } enc[SIO_NENC];
102 unsigned rchan[SIO_NCHAN];      /* allowed rchans */
103 unsigned pchan[SIO_NCHAN];      /* allowed pchans */
104 unsigned rate[SIO_NRATE];       /* allowed rates */
105 unsigned nconf;                 /* num. of confs[] */
106 struct sio_conf {
107  unsigned enc;                  /* bitmask of enc[] indexes */
108  unsigned rchan;                /* bitmask of rchan[] indexes */
109  unsigned pchan;                /* bitmask of pchan[] indexes */
110  unsigned rate;                 /* bitmask of rate[] indexes */
111 } confs[SIO_NCONF];
112};
113
114struct sio_hdl * sio_open(const char * name, unsigned mode, int nbio_flag);
115void   sio_close  (struct sio_hdl * hdl);
116
117void   sio_initpar(struct sio_par * par);
118int    sio_setpar (struct sio_hdl * hdl, struct sio_par * par);
119int    sio_getpar (struct sio_hdl * hdl, struct sio_par * par);
120
121int    sio_getcap (struct sio_hdl * hdl, struct sio_cap * cap);
122
123int    sio_start  (struct sio_hdl * hdl);
124int    sio_stop   (struct sio_hdl * hdl);
125
126size_t sio_read   (struct sio_hdl * hdl,       void * addr, size_t nbytes);
127size_t sio_write  (struct sio_hdl * hdl, const void * addr, size_t nbytes);
128
129void   sio_onmove (struct sio_hdl * hdl, void (*cb)(void * arg, int delta), void * arg);
130
131int    sio_nfds   (struct sio_hdl * hdl);
132
133int    sio_pollfd (struct sio_hdl * hdl, struct pollfd * pfd, int events);
134
135int    sio_revents(struct sio_hdl * hdl, struct pollfd * pfd);
136
137int    sio_eof    (struct sio_hdl * hdl);
138
139int    sio_setvol (struct sio_hdl * hdl, unsigned vol);
140void   sio_onvol  (struct sio_hdl * hdl, void (*cb)(void * arg, unsigned vol), void * arg);
141
142// MIDI:
143struct mio_hdl * mio_open   (const char * name, unsigned mode, int nbio_flag);
144void             mio_close  (struct mio_hdl * hdl);
145size_t           mio_write  (struct mio_hdl * hdl, const void * addr, size_t nbytes);
146size_t           mio_read   (struct mio_hdl * hdl, void * addr, size_t nbytes);
147int              mio_nfds   (struct mio_hdl * hdl);
148int              mio_pollfd (struct mio_hdl * hdl, struct pollfd * pfd, int events);
149int              mio_revents(struct mio_hdl * hdl, struct pollfd * pfd);
150int              mio_eof    (struct mio_hdl * hdl);
151
152#endif
153
154//ll
Note: See TracBrowser for help on using the repository browser.