source: roaraudio/libroaresd/esdstream.c @ 0:2a41d2f42394

Last change on this file since 0:2a41d2f42394 was 0:2a41d2f42394, checked in by phi, 16 years ago

Initial revision

File size: 1.8 KB
Line 
1//esdstream.c:
2
3#include "libroaresd.h"
4
5/* open a socket for playing, monitoring, or recording as a stream */
6/* the *_fallback functions try to open /dev/dsp if there's no EsounD */
7int esd_play_stream( esd_format_t format, int rate,
8                     const char *host, const char *name ) {
9
10int channels;
11int bits;
12
13 if ( (format & ESD_BITS8) ) {
14  bits = 8;
15 } else {
16  bits = 16;
17 }
18
19 if ( (format & ESD_MONO) ) {
20  channels = 1;
21 } else {
22  channels = 2;
23 }
24
25 return roar_simple_play(rate, channels, bits, ROAR_CODEC_DEFAULT, (char*)host, (char*) name);
26}
27
28int esd_play_stream_fallback( esd_format_t format, int rate,
29                              const char *host, const char *name ) {
30 return esd_play_stream(format, rate, host, name); // for the moment this need to be ok...
31}
32
33
34
35int esd_monitor_stream( esd_format_t format, int rate,
36                        const char *host, const char *name ) {
37
38int channels;
39int bits;
40
41 if ( (format & ESD_BITS8) ) {
42  bits = 8;
43 } else {
44  bits = 16;
45 }
46
47 if ( (format & ESD_MONO) ) {
48  channels = 1;
49 } else {
50  channels = 2;
51 }
52
53 return roar_simple_monitor(rate, channels, bits, ROAR_CODEC_DEFAULT, (char*)host, (char*)name);
54}
55/* int esd_monitor_stream_fallback( esd_format_t format, int rate ); */
56int esd_record_stream( esd_format_t format, int rate,
57                       const char *host, const char *name );
58int esd_record_stream_fallback( esd_format_t format, int rate,
59                                const char *host, const char *name );
60int esd_filter_stream( esd_format_t format, int rate,
61                       const char *host, const char *name ) {
62
63int channels;
64int bits;
65
66 if ( (format & ESD_BITS8) ) {
67  bits = 8;
68 } else {
69  bits = 16;
70 }
71
72 if ( (format & ESD_MONO) ) {
73  channels = 1;
74 } else {
75  channels = 2;
76 }
77
78 return roar_simple_filter(rate, channels, bits, ROAR_CODEC_DEFAULT, (char*)host, (char*)name);
79}
80
81
82//ll
Note: See TracBrowser for help on using the repository browser.