Changeset 1131:bca464362519 in roaraudio
- Timestamp:
- 01/20/09 17:57:30 (15 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
include/libroardsp/libroardsp.h
r1105 r1131 58 58 #define ROARDSP_FCTL_MODE 9 59 59 60 // consts for filter(chain) reset: 61 #define ROARDSP_RESET_NONE 0 62 #define ROARDSP_RESET_FULL 1 63 #define ROARDSP_RESET_STATE 2 64 60 65 // filter specific constants: 61 66 #define ROARDSP_DOWNMIX_LEFT 1 … … 76 81 int (*uninit)(struct roardsp_filter * filter); 77 82 int (*ctl )(struct roardsp_filter * filter, int cmd, void * data); 83 int (*reset )(struct roardsp_filter * filter, int what); 78 84 }; 79 85 … … 115 121 int roardsp_filter_calc (struct roardsp_filter * filter, void * data, size_t len); 116 122 int roardsp_filter_ctl (struct roardsp_filter * filter, int cmd, void * data); 123 int roardsp_filter_reset (struct roardsp_filter * filter, int what); 117 124 118 125 int roardsp_fchain_init (struct roardsp_filterchain * chain); … … 120 127 int roardsp_fchain_add (struct roardsp_filterchain * chain, struct roardsp_filter * filter); 121 128 int roardsp_fchain_calc (struct roardsp_filterchain * chain, void * data, size_t len); 129 int roardsp_fchain_reset (struct roardsp_filterchain * chain, int what); 122 130 int roardsp_fchain_num (struct roardsp_filterchain * chain); 123 131 … … 161 169 int roardsp_dcblock_uninit (struct roardsp_filter * filter); 162 170 int roardsp_dcblock_calc16 (struct roardsp_filter * filter, void * data, size_t samples); 171 int roardsp_dcblock_reset (struct roardsp_filter * filter, int what); 163 172 164 173 // codecs: -
libroardsp/filter.c
r1104 r1131 31 31 int (*uninit )(struct roardsp_filter * filter); 32 32 int (*ctl )(struct roardsp_filter * filter, int cmd, void * data); 33 int (*reset )(struct roardsp_filter * filter, int what); 33 34 int (*calc [5][3])(struct roardsp_filter * filter, void * data, size_t samples); 34 35 } _roardsp_filterlist[] = { 35 {ROARDSP_FILTER_AMP, "AMP", roardsp_amp_init, roardsp_amp_uninit, roardsp_amp_ctl, {36 {ROARDSP_FILTER_AMP, "AMP", roardsp_amp_init, roardsp_amp_uninit, roardsp_amp_ctl, NULL, { 36 37 {NULL, NULL, NULL},{roardsp_amp_calc8, NULL, NULL},{roardsp_amp_calc16, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}}, 37 {ROARDSP_FILTER_ADD, "Add", roardsp_add_init, roardsp_amp_uninit, roardsp_amp_ctl, {38 {ROARDSP_FILTER_ADD, "Add", roardsp_add_init, roardsp_amp_uninit, roardsp_amp_ctl, NULL, { 38 39 {NULL, NULL, NULL},{NULL, NULL, NULL},{roardsp_add_calc16, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}}, 39 40 #ifdef ROAR_HAVE_LIBM 40 {ROARDSP_FILTER_LOWP, "Lowpass", roardsp_lowp_init, roardsp_lowp_uninit, roardsp_lowp_ctl, {41 {ROARDSP_FILTER_LOWP, "Lowpass", roardsp_lowp_init, roardsp_lowp_uninit, roardsp_lowp_ctl, NULL, { 41 42 {NULL, NULL, NULL},{NULL, NULL, NULL},{roardsp_lowp_calc16, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}}, 42 {ROARDSP_FILTER_HIGHP, "Highpass", roardsp_highp_init, roardsp_highp_uninit, roardsp_highp_ctl, {43 {ROARDSP_FILTER_HIGHP, "Highpass", roardsp_highp_init, roardsp_highp_uninit, roardsp_highp_ctl, NULL, { 43 44 {NULL, NULL, NULL},{NULL, NULL, NULL},{roardsp_highp_calc16, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}}, 44 45 #endif 45 {ROARDSP_FILTER_QUANTIFY, "Quantifier", roardsp_quantify_init, NULL, roardsp_quantify_ctl, {46 {ROARDSP_FILTER_QUANTIFY, "Quantifier", roardsp_quantify_init, NULL, roardsp_quantify_ctl, NULL, { 46 47 {NULL, NULL, NULL},{NULL, NULL, NULL},{roardsp_quantify_calc16, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}}, 47 {ROARDSP_FILTER_CLIP, "Clip", roardsp_clip_init, NULL, roardsp_clip_ctl, {48 {ROARDSP_FILTER_CLIP, "Clip", roardsp_clip_init, NULL, roardsp_clip_ctl, NULL, { 48 49 {NULL, NULL, NULL},{NULL, NULL, NULL},{roardsp_clip_calc16, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}}, 49 {ROARDSP_FILTER_DOWNMIX, "downmix", roardsp_downmix_init, NULL, roardsp_downmix_ctl, {50 {ROARDSP_FILTER_DOWNMIX, "downmix", roardsp_downmix_init, NULL, roardsp_downmix_ctl, NULL, { 50 51 {NULL, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, roardsp_downmix_calc162},{NULL, NULL, NULL},{NULL, NULL, NULL}}}, 51 {ROARDSP_FILTER_DCBLOCK, "DCBlock", roardsp_dcblock_init, NULL, NULL, {52 {ROARDSP_FILTER_DCBLOCK, "DCBlock", roardsp_dcblock_init, NULL, NULL, roardsp_dcblock_reset, { 52 53 {NULL, NULL, NULL},{NULL, NULL, NULL},{roardsp_dcblock_calc16, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}}, 53 {-1, NULL, NULL, NULL, NULL, {54 {-1, NULL, NULL, NULL, NULL, NULL, { 54 55 // ? 8Bit 16Bit 24Bit 32Bit 55 56 // 0B:n 1 2 1B:n 1 2 2B:n 1 2 3B:n 1 2 4B:n 1 2 … … 168 169 } 169 170 171 int roardsp_filter_reset (struct roardsp_filter * filter, int what) { 172 if ( filter == NULL ) 173 return -1; 174 175 if ( filter->reset ) 176 return filter->reset(filter, what); 177 178 return -1; 179 } 180 170 181 //ll -
libroardsp/filter_dcblock.c
r1100 r1131 54 54 } 55 55 56 int roardsp_dcblock_reset (struct roardsp_filter * filter, int what) { 57 if ( filter == NULL ) 58 return -1; 59 60 if ( filter->inst == NULL ) 61 return -1; 62 63 switch (what) { 64 case ROARDSP_RESET_NONE: 65 return 0; 66 break; 67 case ROARDSP_RESET_FULL: 68 memset(filter->inst, 0, sizeof(struct roardsp_dcblock)); 69 return 0; 70 break; 71 case ROARDSP_RESET_STATE: 72 memset(((struct roardsp_dcblock*)filter->inst)->dc, 0, sizeof(int32_t)*ROARDSP_DCBLOCK_NUMBLOCKS); 73 return 0; 74 break; 75 default: 76 return -1; 77 } 78 79 return -1; 80 } 81 56 82 int roardsp_dcblock_calc16 (struct roardsp_filter * filter, void * data, size_t samples) { 57 83 struct roardsp_dcblock * inst = filter->inst; -
libroardsp/filterchain.c
r679 r1131 78 78 } 79 79 80 int roardsp_fchain_reset (struct roardsp_filterchain * chain, int what) { 81 int i; 82 int ret = 0; 83 /* 84 struct roardsp_filterchain backup[1]; 85 */ 86 87 if ( chain == NULL ) 88 return -1; 89 90 /* 91 if ( what == ROARDSP_RESET_FULL ) { 92 if ( roardsp_fchain_init(backup) == -1 ) 93 return -1; 94 95 if ( roardsp_fchain_uninit(chain) == -1 ) 96 return -1; 97 98 if ( roardsp_fchain_init(chain) == -1 ) 99 return -1; 100 } else { 101 */ 102 for (i = 0; i < chain->filters; i++) { 103 if ( roardsp_filter_reset(chain->filter[i], what) == -1 ) 104 ret = -1; 105 } 106 /* 107 } 108 */ 109 110 return ret; 111 } 112 80 113 int roardsp_fchain_num (struct roardsp_filterchain * chain) { 81 114 if ( chain == NULL )
Note: See TracChangeset
for help on using the changeset viewer.