Changeset 1141:37c25717fca0 in roaraudio for libroardsp
- Timestamp:
- 01/21/09 22:51:58 (15 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- libroardsp
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
libroardsp/filter.c
r1134 r1141 34 34 int (*calc [5][3])(struct roardsp_filter * filter, void * data, size_t samples); 35 35 } _roardsp_filterlist[] = { 36 {ROARDSP_FILTER_AMP, "AMP", roardsp_amp_init, roardsp_amp_uninit, roardsp_amp_ctl, NULL, {36 {ROARDSP_FILTER_AMP, "AMP", roardsp_amp_init, roardsp_amp_uninit, roardsp_amp_ctl, roardsp_amp_reset, { 37 37 {NULL, NULL, NULL},{roardsp_amp_calc8, NULL, NULL},{roardsp_amp_calc16, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}}, 38 {ROARDSP_FILTER_ADD, "Add", roardsp_add_init, roardsp_amp_uninit, roardsp_amp_ctl, NULL, {38 {ROARDSP_FILTER_ADD, "Add", roardsp_add_init, roardsp_amp_uninit, roardsp_amp_ctl, roardsp_add_reset, { 39 39 {NULL, NULL, NULL},{NULL, NULL, NULL},{roardsp_add_calc16, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}}, 40 40 #ifdef ROAR_HAVE_LIBM 41 {ROARDSP_FILTER_LOWP, "Lowpass", roardsp_lowp_init, roardsp_lowp_uninit, roardsp_lowp_ctl, NULL, {41 {ROARDSP_FILTER_LOWP, "Lowpass", roardsp_lowp_init, roardsp_lowp_uninit, roardsp_lowp_ctl, roardsp_lowp_reset, { 42 42 {NULL, NULL, NULL},{NULL, NULL, NULL},{roardsp_lowp_calc16, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}}, 43 {ROARDSP_FILTER_HIGHP, "Highpass", roardsp_highp_init, roardsp_highp_uninit, roardsp_highp_ctl, NULL, {43 {ROARDSP_FILTER_HIGHP, "Highpass", roardsp_highp_init, roardsp_highp_uninit, roardsp_highp_ctl, roardsp_highp_reset, { 44 44 {NULL, NULL, NULL},{NULL, NULL, NULL},{roardsp_highp_calc16, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}}, 45 45 #endif 46 {ROARDSP_FILTER_QUANTIFY, "Quantifier", roardsp_quantify_init, NULL, roardsp_quantify_ctl, NULL, {46 {ROARDSP_FILTER_QUANTIFY, "Quantifier", roardsp_quantify_init, NULL, roardsp_quantify_ctl, roardsp_quantify_reset, { 47 47 {NULL, NULL, NULL},{NULL, NULL, NULL},{roardsp_quantify_calc16, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}}, 48 {ROARDSP_FILTER_CLIP, "Clip", roardsp_ clip_init, NULL, roardsp_clip_ctl, NULL, {48 {ROARDSP_FILTER_CLIP, "Clip", roardsp_quantify_init, NULL, roardsp_clip_ctl, roardsp_clip_reset, { 49 49 {NULL, NULL, NULL},{NULL, NULL, NULL},{roardsp_clip_calc16, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, NULL}}}, 50 {ROARDSP_FILTER_DOWNMIX, "downmix", roardsp_ downmix_init, NULL, roardsp_downmix_ctl, NULL, {50 {ROARDSP_FILTER_DOWNMIX, "downmix", roardsp_quantify_init, NULL, roardsp_downmix_ctl, roardsp_downmix_reset, { 51 51 {NULL, NULL, NULL},{NULL, NULL, NULL},{NULL, NULL, roardsp_downmix_calc162},{NULL, NULL, NULL},{NULL, NULL, NULL}}}, 52 52 {ROARDSP_FILTER_DCBLOCK, "DCBlock", roardsp_dcblock_init, NULL, NULL, roardsp_dcblock_reset, { -
libroardsp/filter_add.c
r979 r1141 27 27 int roardsp_add_init (struct roardsp_filter * filter, struct roar_stream * stream, int id) { 28 28 struct roardsp_amp * self = malloc(sizeof(struct roardsp_amp)); 29 int32_t fac;30 29 31 30 if ( self == NULL ) … … 36 35 filter->inst = (void*) self; 37 36 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); 42 38 43 39 return 0; … … 56 52 } 57 53 54 int 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 58 82 //ll -
libroardsp/filter_amp.c
r882 r1141 27 27 int roardsp_amp_init (struct roardsp_filter * filter, struct roar_stream * stream, int id) { 28 28 struct roardsp_amp * self = malloc(sizeof(struct roardsp_amp)); 29 int32_t fac;30 29 31 30 if ( self == NULL ) … … 36 35 filter->inst = (void*) self; 37 36 38 fac = 1; 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); 42 38 43 39 return 0; … … 103 99 } 104 100 101 int roardsp_amp_reset (struct roardsp_filter * filter, int what) { 102 struct roardsp_amp * self; 103 104 if ( filter == NULL ) 105 return -1; 106 107 if ( filter->inst == NULL ) 108 return -1; 109 110 self = filter->inst; 111 112 switch (what) { 113 case ROARDSP_RESET_NONE: 114 case ROARDSP_RESET_STATE: 115 return 0; 116 break; 117 case ROARDSP_RESET_FULL: 118 self->mul = 1; 119 self->div = 1; 120 return 0; 121 break; 122 default: 123 return -1; 124 } 125 126 return -1; 127 } 128 105 129 //ll -
libroardsp/filter_clip.c
r987 r1141 24 24 25 25 #include "libroardsp.h" 26 27 int roardsp_clip_init (struct roardsp_filter * filter, struct roar_stream * stream, int id) {28 int n = 64;29 30 roardsp_amp_ctl(filter, ROARDSP_FCTL_N, &n);31 32 return 0;33 }34 26 35 27 int roardsp_clip_calc16 (struct roardsp_filter * filter, void * data, size_t samples) { … … 67 59 } 68 60 61 int roardsp_clip_reset (struct roardsp_filter * filter, int what) { 62 int32_t n = 16384; 63 64 if ( filter == NULL ) 65 return -1; 66 67 switch (what) { 68 case ROARDSP_RESET_NONE: 69 case ROARDSP_RESET_STATE: 70 return 0; 71 break; 72 case ROARDSP_RESET_FULL: 73 roardsp_clip_ctl(filter, ROARDSP_FCTL_LIMIT, &n); 74 return 0; 75 break; 76 default: 77 return -1; 78 } 79 80 return -1; 81 } 82 69 83 //ll -
libroardsp/filter_downmix.c
r1104 r1141 24 24 25 25 #include "libroardsp.h" 26 27 int roardsp_downmix_init (struct roardsp_filter * filter, struct roar_stream * stream, int id) {28 int mode = ROARDSP_DOWNMIX_ARITHMETIC;29 30 roardsp_downmix_ctl(filter, ROARDSP_FCTL_MODE, &mode);31 32 ROAR_DBG("roardsp_downmix_init(*) = 0");33 return 0;34 }35 26 36 27 int roardsp_downmix_calc162 (struct roardsp_filter * filter, void * data, size_t samples) { … … 106 97 } 107 98 99 int roardsp_downmix_reset (struct roardsp_filter * filter, int what) { 100 int mode = ROARDSP_DOWNMIX_ARITHMETIC; 101 102 if ( filter == NULL ) 103 return -1; 104 105 switch (what) { 106 case ROARDSP_RESET_NONE: 107 case ROARDSP_RESET_STATE: 108 return 0; 109 break; 110 case ROARDSP_RESET_FULL: 111 roardsp_downmix_ctl(filter, ROARDSP_FCTL_MODE, &mode); 112 return 0; 113 break; 114 default: 115 return -1; 116 } 117 118 return -1; 119 } 120 108 121 //ll -
libroardsp/filter_highp.c
r1104 r1141 111 111 } 112 112 113 int roardsp_highp_reset (struct roardsp_filter * filter, int what) { 114 struct roardsp_highp * self; 115 float freq = 25; 116 117 if ( filter == NULL ) 118 return -1; 119 120 if ( filter->inst == NULL ) 121 return -1; 122 123 self = filter->inst; 124 125 switch (what) { 126 case ROARDSP_RESET_NONE: 127 return 0; 128 break; 129 case ROARDSP_RESET_FULL: 130 roardsp_highp_ctl(filter, ROARDSP_FCTL_FREQ, &freq); 131 case ROARDSP_RESET_STATE: 132 memset(self->oldin, 0, sizeof(int32_t)*ROAR_MAX_CHANNELS); 133 memset(self->oldout, 0, sizeof(int32_t)*ROAR_MAX_CHANNELS); 134 return 0; 135 break; 136 default: 137 return -1; 138 } 139 140 return -1; 141 } 142 113 143 #endif 114 144 -
libroardsp/filter_lowp.c
r1104 r1141 107 107 } 108 108 109 int roardsp_lowp_reset (struct roardsp_filter * filter, int what) { 110 struct roardsp_lowp * self; 111 float freq; 112 113 if ( filter == NULL ) 114 return -1; 115 116 if ( filter->inst == NULL ) 117 return -1; 118 119 self = filter->inst; 120 freq = filter->rate/2; 121 122 switch (what) { 123 case ROARDSP_RESET_NONE: 124 return 0; 125 break; 126 case ROARDSP_RESET_FULL: 127 roardsp_lowp_ctl(filter, ROARDSP_FCTL_FREQ, &freq); 128 case ROARDSP_RESET_STATE: 129 memset(self->old, 0, sizeof(int32_t)*ROAR_MAX_CHANNELS); 130 return 0; 131 break; 132 default: 133 return -1; 134 } 135 136 return -1; 137 } 138 109 139 #endif 110 140 -
libroardsp/filter_quantify.c
r987 r1141 26 26 27 27 int roardsp_quantify_init (struct roardsp_filter * filter, struct roar_stream * stream, int id) { 28 int n = 64;29 28 30 roardsp_ amp_ctl(filter, ROARDSP_FCTL_N, &n);29 roardsp_filter_reset(filter, ROARDSP_RESET_FULL); 31 30 32 ROAR_DBG("roardsp_quantify_init(*) = 0");33 31 return 0; 34 32 } … … 71 69 } 72 70 71 int roardsp_quantify_reset (struct roardsp_filter * filter, int what) { 72 int n = 64; 73 74 if ( filter == NULL ) 75 return -1; 76 77 switch (what) { 78 case ROARDSP_RESET_NONE: 79 case ROARDSP_RESET_STATE: 80 return 0; 81 break; 82 case ROARDSP_RESET_FULL: 83 roardsp_quantify_ctl(filter, ROARDSP_FCTL_N, &n); 84 return 0; 85 break; 86 default: 87 return -1; 88 } 89 90 return -1; 91 } 92 73 93 //ll
Note: See TracChangeset
for help on using the changeset viewer.