Changeset 2129:2d9c6346122f in roaraudio


Ignore:
Timestamp:
07/23/09 21:10:52 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

read/write data

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roarclients/roarphone.c

    r2128 r2129  
    5656 
    5757int run_stream (struct roar_vio_calls * s0, struct roar_vio_calls * s1, struct roar_audio_info * info) { 
    58  return -1; 
     58 size_t len; 
     59 char * buf; 
     60 ssize_t l; 
     61 
     62 len = (info->rate / 100) * info->channels * info->bits / 8; 
     63 
     64 if ( (buf = malloc(len)) == NULL ) 
     65  return -1; 
     66 
     67 while (1) { 
     68  if ( (l = roar_vio_read(s0, buf, len)) <= 0 ) 
     69   break; 
     70  if ( roar_vio_write(s1, buf, l) != l ) 
     71   break; 
     72  if ( (l = roar_vio_read(s1, buf, len)) <= 0 ) 
     73   break; 
     74  if ( roar_vio_write(s0, buf, l) != l ) 
     75   break; 
     76 } 
     77 
     78 free(buf); 
     79 
     80 return 0; 
    5981} 
    6082 
Note: See TracChangeset for help on using the changeset viewer.