Changeset 3929:4663575733dd in roaraudio
- Timestamp:
- 06/10/10 17:18:56 (14 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- roarclients
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
roarclients/Makefile
r3830 r3929 55 55 $L 56 56 roarinterconnect: roarinterconnect.o 57 $L $(lib_esd) $(LIBROAREIO) 57 $L $(lib_esd) $(LIBROAREIO) $(lib_rsound) 58 58 roarbidir: roarbidir.o 59 59 $L -
roarclients/roarinterconnect.c
r3842 r3929 35 35 #endif 36 36 37 #ifdef ROAR_HAVE_LIBRSOUND 38 #include <rsound.h> 39 #ifdef RSD_EXEC 40 #define _HAVE_RSOUND 41 #endif 42 #endif 43 37 44 #if defined(ROAR_HAVE_OSS_BSD) || defined(ROAR_HAVE_OSS) 38 45 #define _HAVE_OSS … … 45 52 #define MT_SIMPLE 0x30 46 53 #define MT_OSS 0x40 54 #define MT_RSOUND 0x50 47 55 #define MT_DEFAULT MT_ROAR 48 56 … … 79 87 #ifdef _HAVE_OSS 80 88 " oss - Open Sound System (OSS) device\n" 89 #endif 90 #ifdef _HAVE_RSOUND 91 " rsound - RSound server\n" 81 92 #endif 82 93 "\n" … … 112 123 ret -= ret & MT_MASK; 113 124 ret += MT_OSS; 125 } else if ( !strcmp(type, "rsound") ) { 126 ret -= ret & MT_MASK; 127 ret += MT_RSOUND; 114 128 } else if ( !strcmp(type, "bidir") ) { 115 129 ret -= ret & ST_MASK; … … 142 156 // very unlike to be configured at the server side. 143 157 case MT_OSS: ret |= ST_BIDIR; break; 158 case MT_RSOUND: ret |= ST_TRANSMIT; break; // RSound does only handle playback streams. 144 159 default: 145 160 return MT_NONE|ST_NONE; // error case … … 150 165 return ret; 151 166 } 167 168 #ifdef _HAVE_RSOUND 169 // RSound format helper function: 170 enum rsd_format para2rsdfmt (int bits, int codec) { 171 switch (codec) { 172 /* 173 RSD_S16_LE = 0x0001, 174 RSD_S16_BE = 0x0002, 175 RSD_U16_LE = 0x0004, 176 RSD_U16_BE = 0x0008, 177 RSD_U8 = 0x0010, 178 RSD_S8 = 0x0020, 179 RSD_S16_NE = 0x0040, 180 RSD_U16_NE = 0x0080, 181 */ 182 case ROAR_CODEC_PCM_S_LE: 183 switch (bits) { 184 #ifdef RSD_S8 185 case 8: return RSD_S8; break; 186 #endif 187 #ifdef RSD_S16_LE 188 case 16: return RSD_S16_LE; break; 189 #endif 190 } 191 break; 192 case ROAR_CODEC_PCM_S_BE: 193 switch (bits) { 194 #ifdef RSD_S8 195 case 8: return RSD_S8; break; 196 #endif 197 #ifdef RSD_S16_BE 198 case 16: return RSD_S16_BE; break; 199 #endif 200 } 201 break; 202 case ROAR_CODEC_PCM_U_LE: 203 switch (bits) { 204 #ifdef RSD_U8 205 case 8: return RSD_U8; break; 206 #endif 207 #ifdef RSD_U16_LE 208 case 16: return RSD_U16_LE; break; 209 #endif 210 } 211 break; 212 case ROAR_CODEC_PCM_U_BE: 213 switch (bits) { 214 #ifdef RSD_U8 215 case 8: return RSD_U8; break; 216 #endif 217 #ifdef RSD_U16_BE 218 case 16: return RSD_U16_BE; break; 219 #endif 220 } 221 break; 222 #ifdef RSD_ALAW 223 case ROAR_CODEC_ALAW: 224 return RSD_ALAW; 225 break; 226 #endif 227 #ifdef RSD_MULAW 228 case ROAR_CODEC_MULAW: 229 return RSD_MULAW; 230 break; 231 #endif 232 } 233 return 0; 234 } 235 #endif 152 236 153 237 int main (int argc, char * argv[]) { … … 157 241 struct roar_vio_calls vio; 158 242 struct roar_audio_info info; 243 #endif 244 #ifdef _HAVE_RSOUND 245 rsound_t *rd; 246 enum rsd_format fmt = 0; 159 247 #endif 160 248 int rate = 44100; … … 303 391 break; 304 392 #endif 393 #ifdef _HAVE_RSOUND 394 case MT_RSOUND: 395 fmt = para2rsdfmt(bits, codec); 396 397 if ( fmt == 0 ) { 398 fprintf(stderr, "Error: Bits/Codec not supported by RSound\n"); 399 return 2; 400 } 401 402 switch (type & ST_MASK) { 403 case ST_TRANSMIT: 404 localdir = ROAR_DIR_MONITOR; 405 406 rsd_init(&rd); 407 rsd_set_param(rd, RSD_HOST, remote); 408 rsd_set_param(rd, RSD_CHANNELS, &channels); 409 rsd_set_param(rd, RSD_SAMPLERATE, &rate); 410 rsd_set_param(rd, RSD_FORMAT, &fmt); 411 rfh = rsd_exec(rd); 412 if ( rfh == -1 ) { 413 rsd_stop(rd); 414 rsd_free(rd); 415 } 416 break; 417 default: 418 fprintf(stderr, "Error: this type is not supported by RSound\n"); 419 return 2; 420 break; 421 } 422 break; 423 #endif 305 424 case MT_SIMPLE: 306 425 switch (type & ST_MASK) {
Note: See TracChangeset
for help on using the changeset viewer.