source: roaraudio/libroarsndio/stream.c @ 1566:952d80a40019

Last change on this file since 1566:952d80a40019 was 1563:824d1c4a4765, checked in by phi, 15 years ago

started with streaming calls

File size: 2.0 KB
Line 
1//stream.c:
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#include "libroarsndio.h"
34
35int    sio_start  (struct sio_hdl * hdl) {
36 return 0;
37}
38
39int    sio_stop   (struct sio_hdl * hdl) {
40
41 if ( hdl == NULL )
42  return 0;
43
44 if ( hdl->fh == -1 )
45  return 0;
46
47 close(hdl->fh);
48
49 hdl->fh = -1;
50
51 return 1;
52}
53
54size_t sio_read   (struct sio_hdl * hdl, void * addr, size_t nbytes) {
55 ssize_t ret;
56
57 if ( hdl == NULL )
58  return 0;
59
60 if ( hdl->fh == -1 )
61  return 0;
62
63 if ( (ret = read(hdl->fh, addr, nbytes)) < 0 )
64  return 0;
65
66 return ret;
67}
68size_t sio_write  (struct sio_hdl * hdl, void * addr, size_t nbytes) {
69 ssize_t ret;
70
71 if ( hdl == NULL )
72  return 0;
73
74 if ( hdl->fh == -1 )
75  return 0;
76
77 if ( (ret = write(hdl->fh, addr, nbytes)) < 0 )
78  return 0;
79
80 return ret;
81}
82
83//ll
Note: See TracBrowser for help on using the repository browser.