Changeset 2227:802529aa529d in roaraudio


Ignore:
Timestamp:
07/28/09 02:08:38 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added theoretical esd support

Location:
roarclients
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • roarclients/Makefile

    r2216 r2227  
    4949        $L 
    5050roarinterconnect: roarinterconnect.o 
    51         $L 
     51        $L $(lib_esd) 
    5252roarbidir: roarbidir.o 
    5353        $L 
  • roarclients/roarinterconnect.c

    r2226 r2227  
    2525#include <roaraudio.h> 
    2626 
     27#ifdef ROAR_HAVE_ESD 
     28#include <esd.h> 
     29#endif 
     30 
     31#define MT_NULL    0x00 
     32#define MT_MASK    0xF0 
     33#define MT_ROAR    0x10 
     34#define MT_ESD     0x20 
     35 
     36#define ST_NONE    0x00 
     37#define ST_MASK    0x0F 
     38#define ST_BIDIR   0x01 
     39#define ST_FILTER  0x02 
     40 
    2741void usage (void) { 
    2842 printf("roarinterconnect [OPTIONS]...\n"); 
     
    4963 int    channels = 2; 
    5064 int    codec    = ROAR_CODEC_DEFAULT; 
     65 int    type     = MT_ROAR|ST_BIDIR; 
     66 int    tmp; 
    5167 char * server   = NULL; 
    5268 char * remote   = NULL; 
     
    8096 } 
    8197 
    82  rfh = roar_simple_stream(rate, channels, bits, codec, remote, ROAR_DIR_BIDIR, "roarinterconnect"); 
     98 switch (type & MT_MASK) { 
     99  case MT_ROAR: 
     100    switch (type & ST_MASK) { 
     101     case ST_BIDIR: 
     102       tmp = ROAR_DIR_BIDIR; 
     103      break; 
     104     case ST_FILTER: 
     105       tmp = ROAR_DIR_FILTER; 
     106      break; 
     107     default: 
     108       fprintf(stderr, "Error: unknown stream type\n"); 
     109       return 2; 
     110    } 
     111    rfh = roar_simple_stream(rate, channels, bits, codec, remote, tmp, "roarinterconnect"); 
     112   break; 
     113#ifdef ROAR_HAVE_ESD 
     114  case MT_ESD: 
     115    if ( (type & ST_MASK) != ST_FILTER ) { 
     116     fprintf(stderr, "Error: server type only supports stream type filter\n"); 
     117     return 2; 
     118    } 
     119 
     120    tmp = ESD_STREAM|ESD_PLAY; 
     121 
     122    switch (bits) { 
     123     case  8: tmp |= ESD_BITS8;  break; 
     124     case 16: tmp |= ESD_BITS16; break; 
     125     default: 
     126       fprintf(stderr, "Error: EsounD only supports 8 and 16 bit streams\n"); 
     127       return 2; 
     128    } 
     129 
     130    switch (channels) { 
     131     case 1: tmp |= ESD_MONO;   break; 
     132     case 2: tmp |= ESD_STEREO; break; 
     133     default: 
     134       fprintf(stderr, "Error: EsounD only supports mono and stereo streams\n"); 
     135       return 2; 
     136    } 
     137 
     138    rfh = esd_filter_stream(tmp, rate, remote, "roarinterconnect"); 
     139   break; 
     140#endif 
     141  default: 
     142    fprintf(stderr, "Error: unknown/not supported server type\n"); 
     143    return 2; 
     144 } 
    83145 
    84146 if ( rfh == -1 ) { 
Note: See TracChangeset for help on using the changeset viewer.