Changeset 671:59e319049464 in roaraudio
- Timestamp:
- 08/27/08 14:12:59 (16 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroardsp/filter.c
r667 r671 30 30 int (* init )(struct roardsp_filter * filter, struct roar_stream * stream, int id); 31 31 int (*uninit )(struct roardsp_filter * filter); 32 int (*ctl )(struct roardsp_filter * filter, int cmd, void * data); 32 33 int (*calc [5][3])(struct roardsp_filter * filter, void * data, size_t samples); 33 34 } _roardsp_filterlist[] = { 34 {ROARDSP_FILTER_AMP, "AMP", NULL, NULL, {35 {ROARDSP_FILTER_AMP, "AMP", NULL, NULL, NULL, { 35 36 {NULL, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}}, 36 {ROARDSP_FILTER_LOWP, "Lowpass", NULL, NULL, {37 {ROARDSP_FILTER_LOWP, "Lowpass", NULL, NULL, NULL, { 37 38 {NULL, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}}, 38 {ROARDSP_FILTER_HIGHP, "Highpass", NULL, NULL, {39 {ROARDSP_FILTER_HIGHP, "Highpass", NULL, NULL, NULL, { 39 40 {NULL, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}}, 40 {-1, NULL, NULL, NULL, {{NULL, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}} 41 {-1, NULL, NULL, NULL, NULL, { 42 {NULL, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}} 41 43 }; 42 44 … … 64 66 65 67 int roardsp_filter_init (struct roardsp_filter * filter, struct roar_stream * stream, int id) { 68 struct _roardsp_filterlist * l = _roardsp_filterlist; 69 int bytes; 70 int (*calc)(struct roardsp_filter * filter, void * data, size_t samples) = NULL; 71 66 72 if ( filter == NULL ) 67 73 return -1; … … 72 78 filter->bits = stream->info.bits; 73 79 74 return -1; 80 bytes = stream->info.bits / 8; 81 82 while ( l->id != id ) 83 if ( l->id == -1 ) 84 return -1; 85 86 filter->uninit = l->uninit; 87 filter->ctl = l->ctl; 88 89 if ( filter->channels < 3 ) 90 calc = l->calc[bytes][filter->channels]; 91 92 if ( calc == NULL ) 93 calc = l->calc[bytes][0]; // for n channels 94 95 if ( calc == NULL ) 96 return -1; 97 98 if ( l->init ) 99 return l->init(filter, stream, id); 100 101 return 0; 75 102 } 76 103 … … 101 128 } 102 129 130 int roardsp_filter_ctl (struct roardsp_filter * filter, int cmd, void * data) { 131 if ( filter == NULL ) 132 return -1; 133 134 if ( filter->ctl ) 135 return filter->ctl(filter, cmd, data); 136 137 return -1; 138 } 139 103 140 //ll
Note: See TracChangeset
for help on using the changeset viewer.