Changeset 4929:061614c260d8 in roaraudio


Ignore:
Timestamp:
05/08/11 12:16:52 (11 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

use VS API

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roarclients/roardtmf.c

    r4883 r4929  
    118118int main (int argc, char * argv[]) { 
    119119 int    rate     = ROAR_RATE_DEFAULT; 
    120  int    bits     = ROAR_BITS_DEFAULT; 
    121  int    codec    = ROAR_CODEC_DEFAULT; 
    122120 char * server   = NULL; 
    123121 char * k; 
    124122 int    i; 
    125123 char * name = "roardtmf"; 
    126  struct roar_vio_calls stream; 
     124 roar_vs_t * vss = NULL; 
    127125 char * tones = NULL; 
    128126 void * buf; 
     
    138136  } else if ( !strcmp(k, "--rate") || !strcmp(k, "-r") ) { 
    139137   rate = roar_str2rate(argv[++i]); 
    140   } else if ( !strcmp(k, "--bits") ) { 
    141    bits = roar_str2bits(argv[++i]); 
    142   } else if ( !strcmp(k, "--codec") ) { 
    143    codec = roar_str2codec(argv[++i]); 
    144138  } else if ( !strcmp(k, "--help") ) { 
    145139   usage(); 
     
    158152 } 
    159153 
    160  if ( codec != ROAR_CODEC_DEFAULT ) 
    161   return 2; 
    162  if ( bits  != 16 ) 
    163   return 3; 
    164  
    165154 samples = SUM_TIME * rate / 1000; 
    166155 
     
    170159*/ 
    171160 
    172  if ( (buf = roar_mm_malloc((len = bits*samples/8))) == NULL ) 
     161 if ( (buf = roar_mm_malloc((len = 16*samples/8))) == NULL ) 
    173162  return 4; 
    174163 
    175  if ( roar_vio_simple_stream(&stream, rate, 1, bits, codec, server, ROAR_DIR_PLAY, name) == -1 ) { 
     164 if ( (vss = roar_vs_new_playback(server, name, rate, 1, ROAR_CODEC_DEFAULT, 16, NULL)) == NULL ) { 
    176165  fprintf(stderr, "Error: can not start playback\n"); 
    177166  roar_mm_free(buf); 
     
    189178   return 5; 
    190179  } 
    191   roar_vio_write(&stream, buf, len); 
     180  roar_vs_write(vss, buf, len, NULL); 
    192181 } 
    193182 
    194  roar_vio_close(&stream); 
     183 roar_vs_sync(vss, ROAR_VS_WAIT, NULL); 
     184 
     185 roar_vs_close(vss, ROAR_VS_FALSE, 0); 
    195186 
    196187 roar_mm_free(buf); 
Note: See TracChangeset for help on using the changeset viewer.