Changeset 663:e9b7eeca0a38 in roaraudio for libroardsp/filterchain.c


Ignore:
Timestamp:
08/26/08 17:32:04 (16 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

done filterchain code, startet filter object code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroardsp/filterchain.c

    r661 r663  
    2525#include "libroardsp.h" 
    2626 
     27int roardsp_fchain_init  (struct roardsp_filterchain * chain) { 
     28 if ( chain == NULL ) 
     29  return -1; 
     30 
     31 memset((void*)chain, 0, sizeof(struct roardsp_filterchain)); 
     32 return 0; 
     33} 
     34 
     35int roardsp_fchain_uninit(struct roardsp_filterchain * chain) { 
     36 int i; 
     37 int ret = 0; 
     38 
     39 if ( chain == NULL ) 
     40  return -1; 
     41 
     42 for (i = 0; i < chain->filters; i++) { 
     43  if ( roardsp_filter_uninit(chain->filter[i]) == -1 ) 
     44   ret = -1; 
     45 } 
     46 
     47 if ( roardsp_fchain_init(chain) == -1 ) 
     48  ret = -1; 
     49 
     50 return ret; 
     51} 
     52 
     53int roardsp_fchain_add   (struct roardsp_filterchain * chain, struct roardsp_filter * filter) { 
     54 if ( chain == NULL ) 
     55  return -1; 
     56 
     57 if ( chain->filters < ROARDSP_MAX_FILTERS_PER_CHAIN ) { 
     58  chain->filter[chain->filters++] = filter; 
     59  return 0; 
     60 } 
     61 
     62 return -1; 
     63} 
     64 
     65int roardsp_fchain_calc  (struct roardsp_filterchain * chain, void * data, size_t len) { 
     66 int i; 
     67 int ret = 0; 
     68 
     69 if ( chain == NULL ) 
     70  return -1; 
     71 
     72 for (i = 0; i < chain->filters; i++) { 
     73  if ( roardsp_filter_calc(chain->filter[i], data, len) == -1 ) 
     74   ret = -1; 
     75 } 
     76 
     77 return ret; 
     78} 
    2779 
    2880//ll 
Note: See TracChangeset for help on using the changeset viewer.