Changeset 2991:2006474e65c9 in roaraudio


Ignore:
Timestamp:
10/26/09 13:40:45 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added support for downmix of channels an lowpass

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roarclients/roarphone.c

    r2986 r2991  
    5959 int64_t dtx_threshold; 
    6060 size_t jumbo_mtu; 
     61 struct { 
     62  struct { 
     63   int downmix; 
     64   float lowp_freq; 
     65  } in; 
     66 } filter; 
    6167} g_conf; 
    6268 
     
    104110        "  --bits     BITS      - Set bits per sample\n" 
    105111        "  --chans    CHANNELS  - Set number of channels\n" 
     112       ); 
     113 
     114 printf("\nAudio Filter Options:\n\n"); 
     115 printf("  --afi-downmix        - Enable input downmixing\n" 
     116        "  --afi-lowpass FREQ   - Enable input lowpass at FREQ (in Hz)\n" 
    106117       ); 
    107118 
     
    374385 struct roar_vio_calls dvio, svio, svio_jumbo, svio_real; 
    375386 struct roar_vio_calls * svio_p; 
     387 struct roardsp_filter * filter; 
    376388 char * driver   = DRIVER; 
    377389 char * device   = NULL; 
     
    406418  } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 ) { 
    407419   info.channels = atoi(argv[++i]); 
     420 
     421/* 
     422 printf("  --afi-downmix        - Enable input downmixing\n" 
     423        "  --afi-lowpass FREQ   - Enable input lowpass at FREQ (in Hz)\n" 
     424*/ 
     425  } else if ( strcmp(k, "--afi-downmix") == 0 ) { 
     426   g_conf.filter.in.downmix = 1; 
     427  } else if ( strcmp(k, "--afi-lowpass") == 0 ) { 
     428   g_conf.filter.in.lowp_freq = atof(argv[++i]); 
     429 
    408430  } else if ( strcmp(k, "--codec") == 0 ) { 
    409431   info.codec = roar_str2codec(argv[++i]); 
     432 
    410433  } else if ( strcmp(k, "--driver") == 0 ) { 
    411434   driver = argv[++i]; 
     
    524547 set_meta(); 
    525548 
     549#define _err(x) roar_vio_close(&dvio); roar_vio_close(&svio); return (x) 
     550 
     551 if ( g_conf.filter.in.downmix ) { 
     552  if ( roardsp_filter_new(&filter, &(g_cons.stream), ROARDSP_FILTER_DOWNMIX) == -1 ) { 
     553   _err(2); 
     554  } 
     555 
     556  if ( roardsp_fchain_add(&(g_filterchains.input), filter) == -1 ) { 
     557   _err(2); 
     558  } 
     559 } 
     560 
     561 if ( g_conf.filter.in.lowp_freq > 1 ) { 
     562  if ( roardsp_filter_new(&filter, &(g_cons.stream), ROARDSP_FILTER_LOWP) == -1 ) { 
     563   _err(2); 
     564  } 
     565 
     566  if ( roardsp_filter_ctl(filter, ROARDSP_FCTL_FREQ, &(g_conf.filter.in.lowp_freq)) == -1 ) { 
     567   _err(2); 
     568  } 
     569 
     570  if ( roardsp_fchain_add(&(g_filterchains.input), filter) == -1 ) { 
     571   _err(2); 
     572  } 
     573 } 
     574 
     575#undef _err 
     576 
    526577 if ( g_conf.transcode ) { 
    527578  dinfo.codec = info.codec; 
Note: See TracChangeset for help on using the changeset viewer.