Got rid of ss_get_wave_sample().
[ahxm.git] / out_arts.c
blobd058b586cc3768b040dafae6e95d56275ab2f3ba
1 /*
3 Ann Hell Ex Machina - Music Software
4 Copyright (C) 2003/2005 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>
29 #include "ss_core.h"
30 #include "ss_output.h"
32 #ifdef CONFOPT_ARTS
34 #include <artsc.h>
36 /*******************
37 Data
38 ********************/
40 /* stream handler */
41 static arts_stream_t arts=NULL;
43 /*******************
44 Code
45 ********************/
47 int _out_open_arts(char * file)
49 /* init library and connect to server */
50 if(arts_init())
51 return(-100);
53 /* only 2 channels seems to be supported */
54 if(ss_nchannels > 2)
55 ss_nchannels=2;
57 arts=arts_play_stream(ss_frequency, 16, ss_nchannels, "annhell");
59 /* can't open stream */
60 if(arts == NULL)
61 return(-101);
63 return(arts_stream_get(arts, ARTS_P_PACKET_SIZE));
67 int _out_write_arts(short int * buffer, int size)
69 return(arts_write(arts, buffer, size * sizeof(short int)));
73 int _out_close_arts(void)
75 /* disconnect */
76 arts_free();
78 return(0);
81 /* driver */
83 struct _output_driver _out_driver_arts=
84 { "arts", NULL, _out_open_arts, _out_write_arts, _out_close_arts };
86 #else /* CONFOPT_ARTS */
88 struct _output_driver _out_driver_arts=
89 { "arts", NULL, NULL, NULL, NULL };
91 #endif /* CONFOPT_ARTS */