Changeset 1141:37c25717fca0 in roaraudio for libroardsp/filter_add.c


Ignore:
Timestamp:
01/21/09 22:51:58 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added support to reset filters, some cleanup

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroardsp/filter_add.c

    r979 r1141  
    2727int roardsp_add_init  (struct roardsp_filter * filter, struct roar_stream * stream, int id) { 
    2828 struct roardsp_amp * self = malloc(sizeof(struct roardsp_amp)); 
    29  int32_t fac; 
    3029 
    3130 if ( self == NULL ) 
     
    3635 filter->inst = (void*) self; 
    3736 
    38  fac = 0; 
    39  roardsp_amp_ctl(filter, ROARDSP_FCTL_MUL, &fac); 
    40  fac = 1; 
    41  roardsp_amp_ctl(filter, ROARDSP_FCTL_DIV, &fac); 
     37 roardsp_filter_reset(filter, ROARDSP_RESET_FULL); 
    4238 
    4339 return 0; 
     
    5652} 
    5753 
     54int roardsp_add_reset (struct roardsp_filter * filter, int what) { 
     55 struct roardsp_amp * self; 
     56 
     57 if ( filter == NULL ) 
     58  return -1; 
     59 
     60 if ( filter->inst == NULL ) 
     61  return -1; 
     62 
     63 self = filter->inst; 
     64 
     65 switch (what) { 
     66  case ROARDSP_RESET_NONE: 
     67  case ROARDSP_RESET_STATE: 
     68    return  0; 
     69   break; 
     70  case ROARDSP_RESET_FULL: 
     71    self->mul = 0; 
     72    self->div = 1; 
     73    return  0; 
     74   break; 
     75  default: 
     76    return -1; 
     77 } 
     78 
     79 return -1; 
     80} 
     81 
    5882//ll 
Note: See TracChangeset for help on using the changeset viewer.