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 */ |
---|
7 | int esd_play_stream( esd_format_t format, int rate, |
---|
8 | const char *host, const char *name ) { |
---|
9 | |
---|
10 | int channels; |
---|
11 | int 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 | |
---|
28 | int 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 | |
---|
35 | int esd_monitor_stream( esd_format_t format, int rate, |
---|
36 | const char *host, const char *name ) { |
---|
37 | |
---|
38 | int channels; |
---|
39 | int 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 ); */ |
---|
56 | int esd_record_stream( esd_format_t format, int rate, |
---|
57 | const char *host, const char *name ); |
---|
58 | int esd_record_stream_fallback( esd_format_t format, int rate, |
---|
59 | const char *host, const char *name ); |
---|
60 | int esd_filter_stream( esd_format_t format, int rate, |
---|
61 | const char *host, const char *name ) { |
---|
62 | |
---|
63 | int channels; |
---|
64 | int 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 |
---|