//esdstream.c: #include "libroaresd.h" #if BYTE_ORDER == BIG_ENDIAN #define CODEC_DEF_8BIT ROAR_CODEC_PCM_U_BE #elif BYTE_ORDER == LITTLE_ENDIAN #define CODEC_DEF_8BIT ROAR_CODEC_PCM_U_LE #else #define CODEC_DEF_8BIT ROAR_CODEC_PCM_U_PDP #endif /* open a socket for playing, monitoring, or recording as a stream */ /* the *_fallback functions try to open /dev/dsp if there's no EsounD */ int esd_play_stream( esd_format_t format, int rate, const char *host, const char *name ) { int channels; int bits; int codec = ROAR_CODEC_DEFAULT; if ( (format & ESD_BITS16) ) { bits = 16; } else { bits = 8; codec = CODEC_DEF_8BIT; } if ( (format & ESD_MONO) ) { channels = 1; } else { channels = 2; } return roar_simple_play(rate, channels, bits, codec, (char*)host, (char*) name); } int esd_play_stream_fallback( esd_format_t format, int rate, const char *host, const char *name ) { int r; if ( (r = esd_play_stream(format, rate, host, name)) != -1 ) { return r; } return esd_play_stream(format, rate, "+fork", name); } int esd_monitor_stream( esd_format_t format, int rate, const char *host, const char *name ) { int channels; int bits; int codec = ROAR_CODEC_DEFAULT; ROAR_DBG("esd_monitor_stream(format=%x, rate=%i, host='%s', name='%s') = ?", format, rate, host, name); if ( (format & ESD_BITS16) ) { bits = 16; } else { bits = 8; codec = CODEC_DEF_8BIT; } if ( (format & ESD_MONO) ) { channels = 1; } else { channels = 2; } return roar_simple_monitor(rate, channels, bits, codec, (char*)host, (char*)name); } /* int esd_monitor_stream_fallback( esd_format_t format, int rate ); */ int esd_record_stream( esd_format_t format, int rate, const char *host, const char *name ); int esd_record_stream_fallback( esd_format_t format, int rate, const char *host, const char *name ); int esd_filter_stream( esd_format_t format, int rate, const char *host, const char *name ) { int channels; int bits; int codec = ROAR_CODEC_DEFAULT; if ( (format & ESD_BITS16) ) { bits = 16; } else { bits = 8; codec = CODEC_DEF_8BIT; } if ( (format & ESD_MONO) ) { channels = 1; } else { channels = 2; } return roar_simple_filter(rate, channels, bits, codec, (char*)host, (char*)name); } //ll