Changeset 5249:26fb6a2e20fc in roaraudio for roarclients/roardtmf.c


Ignore:
Timestamp:
11/13/11 15:01:24 (9 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

fixed warnings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roarclients/roardtmf.c

    r4929 r5249  
    7676} 
    7777 
    78 int calc (int16_t * samples, size_t len, int rate, char c) { 
     78int calc_break (int16_t * samples, size_t len, int rate, char c) { 
     79 (void)rate, (void)c; 
     80 memset(samples, 0, len); 
     81 return 0; 
     82} 
     83 
     84int calc_tone (int16_t * samples, size_t len, int rate, char c) { 
    7985 struct tone * ct = NULL; 
    8086 int i; 
     
    128134 size_t len; 
    129135 char   c; 
     136 int err; 
    130137 
    131138 for (i = 1; i < argc; i++) { 
     
    162169  return 4; 
    163170 
    164  if ( (vss = roar_vs_new_playback(server, name, rate, 1, ROAR_CODEC_DEFAULT, 16, NULL)) == NULL ) { 
    165   fprintf(stderr, "Error: can not start playback\n"); 
     171 if ( (vss = roar_vs_new_playback(server, name, rate, 1, ROAR_CODEC_DEFAULT, 16, &err)) == NULL ) { 
     172  fprintf(stderr, "Error: can not start playback: %s\n", roar_vs_strerr(err)); 
    166173  roar_mm_free(buf); 
    167174  return 1; 
     
    171178  tones++; 
    172179 
    173   if ( c == ' ' || c == '+' || c == '.' || c == '_' ) 
     180  if ( c == '+' || c == '.' || c == '_' ) 
    174181   continue; 
    175182 
    176   if ( calc(buf, len, rate, c) == -1 ) { 
     183  if ( c == ' ' ) { 
     184   calc_break(buf, len, rate, c); 
     185  } else { 
     186   if ( calc_tone(buf, len, rate, c) == -1 ) { 
     187    roar_mm_free(buf); 
     188    return 5; 
     189   } 
     190  } 
     191  if ( roar_vs_write(vss, buf, len, &err) != (ssize_t)len ) { 
     192   fprintf(stderr, "Error: can not write data: %s\n", roar_vs_strerr(err)); 
    177193   roar_mm_free(buf); 
    178194   return 5; 
    179195  } 
    180   roar_vs_write(vss, buf, len, NULL); 
    181196 } 
    182197 
Note: See TracChangeset for help on using the changeset viewer.