source: roaraudio/include/libroarsndio/sndiosym.h @ 1558:cfc3330022d5

Last change on this file since 1558:cfc3330022d5 was 1558:cfc3330022d5, checked in by phi, 15 years ago

we need to save device/server name

File size: 4.0 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
47#define SIO_IGNORE      0       /* pause during xrun */
48#define SIO_SYNC        1       /* resync after xrun */
49#define SIO_ERROR       2       /* terminate on xrun */
50
51#if BYTE_ORDER == BIG_ENDIAN && !defined(ROAR_TARGET_WIN32)
52#define SIO_LE_NATIVE   0
53#else
54#if BYTE_ORDER == LITTLE_ENDIAN
55#define SIO_LE_NATIVE   1
56#else
57#error Byte Order of this system is not supported within the sndio interface.
58#endif
59#endif
60
61#define SIO_BPS(bits) (((bits)/8) + ((bits) % 8 ? 1 : 0))
62
63struct sio_par {
64 unsigned bits;          /* bits per sample */
65 unsigned bps;           /* bytes per sample */
66 unsigned sig;           /* 1 = signed, 0 = unsigned */
67 unsigned le;            /* 1 = LE, 0 = BE byte order */
68 unsigned msb;           /* 1 = MSB, 0 = LSB aligned */
69 unsigned rchan;         /* number channels for recording */
70 unsigned pchan;         /* number channels for playback */
71 unsigned rate;          /* frames per second */
72 unsigned appbufsz;      /* minimum buffer size without xruns */
73 unsigned bufsz;         /* end-to-end buffer size (read-only) */
74 unsigned round;         /* optimal buffer size divisor */
75 unsigned xrun;          /* what to do on overrun/underrun */
76};
77
78struct sio_cap;
79
80struct sio_hdl {
81 char           * device;
82 int              fh;
83 struct sio_par   para;
84 void           (*on_move)(void * arg, int delta);
85 void           * on_move_arg;
86 void           (*on_vol )(void * arg, unsigned vol);
87 void           * on_vol_arg;
88};
89
90struct sio_hdl * sio_open(char * name, unsigned mode, int nbio_flag);
91void   sio_close  (struct sio_hdl * hdl);
92
93void   sio_initpar(struct sio_par * par);
94int    sio_setpar (struct sio_hdl * hdl, struct sio_par * par);
95int    sio_getpar (struct sio_hdl * hdl, struct sio_par * par);
96
97int    sio_getcap (struct sio_hdl * hdl, struct sio_cap * cap);
98
99int    sio_start  (struct sio_hdl * hdl);
100int    sio_stop   (struct sio_hdl * hdl);
101
102size_t sio_read   (struct sio_hdl * hdl, void * addr, size_t nbytes);
103size_t sio_write  (struct sio_hdl * hdl, void * addr, size_t nbytes);
104
105void   sio_onmove (struct sio_hdl * hdl, void (*cb)(void * arg, int delta), void * arg);
106
107int    sio_nfds   (struct sio_hdl * hdl);
108
109int    sio_pollfd (struct sio_hdl * hdl, struct pollfd * pfd, int events);
110
111int    sio_revents(struct sio_hdl * hdl, struct pollfd * pfd);
112
113int    sio_eof    (struct sio_hdl * hdl);
114
115int    sio_setvol (struct sio_hdl * hdl, unsigned vol);
116void   sio_onvol  (struct sio_hdl * hdl, void (*cb)(void * arg, unsigned vol), void * arg);
117
118#endif
119
120//ll
Note: See TracBrowser for help on using the repository browser.