Added support for comb, allpass and flanger events.
[ahxm.git] / out_arts.c
blob0f508030aa62c5ac549dc3b1ca5d8e8510e93f7f
1 /*
3 Ann Hell Ex Machina - Music Software
4 Copyright (C) 2003/2004 Angel Ortega <angel@triptico.com>
6 out_arts.c - Output driver for libartsc (aRtsd client)
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 http://www.triptico.com
26 #include "config.h"
27 #include <stdio.h>
28 #include "output.h"
30 #ifdef CONFOPT_ARTS
32 #include <artsc.h>
33 #include "core.h"
35 /*******************
36 Data
37 ********************/
39 /* stream handler */
40 static arts_stream_t arts=NULL;
42 /*******************
43 Code
44 ********************/
46 int _out_open_arts(char * file)
48 /* init library and connect to server */
49 if(arts_init())
50 return(-100);
52 /* only 2 channels seems to be supported */
53 if(_n_channels > 2)
54 _n_channels=2;
56 arts=arts_play_stream(_frequency, 16, _n_channels, "annhell");
58 /* can't open stream */
59 if(arts == NULL)
60 return(-101);
62 return(arts_stream_get(arts, ARTS_P_PACKET_SIZE));
66 int _out_write_arts(short int * buffer, int size)
68 return(arts_write(arts, buffer, size * sizeof(short int)));
72 int _out_close_arts(void)
74 /* disconnect */
75 arts_free();
77 return(0);
80 /* driver */
82 struct _output_driver _out_driver_arts=
83 { "arts", NULL, _out_open_arts, _out_write_arts, _out_close_arts };
85 #else /* CONFOPT_ARTS */
87 struct _output_driver _out_driver_arts=
88 { "arts", NULL, NULL, NULL, NULL };
90 #endif /* CONFOPT_ARTS */