Changeset 5181:ca57e34b2a35 in roaraudio for libroardsp/filter_add.c
- Timestamp:
- 10/22/11 16:17:35 (13 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroardsp/filter_add.c
r4708 r5181 26 26 #include "libroardsp.h" 27 27 28 int roardsp_add_init (struct roardsp_filter * filter, struct roar_stream * stream, int id) { 29 struct roardsp_amp * self = roar_mm_malloc(sizeof(struct roardsp_amp)); 30 31 if ( self == NULL ) 32 return -1; 33 34 memset(self, 0, sizeof(struct roardsp_amp)); 35 36 filter->inst = (void*) self; 37 38 roardsp_filter_reset(filter, ROARDSP_RESET_FULL); 39 40 return 0; 28 #define _calcX(bits) \ 29 int roardsp_add_calc##bits (struct roardsp_filter * filter, void * data, size_t samples) { \ 30 struct roardsp_amp * self = (struct roardsp_amp *) filter->inst; \ 31 int##bits##_t * samp = (int##bits##_t *) data; \ 32 size_t i; \ 33 \ 34 for (i = 0; i < samples; i++) { \ 35 samp[i] += self->mul / self->div; \ 36 }; \ 37 \ 38 return 0; \ 41 39 } 42 40 43 int roardsp_add_calc16 (struct roardsp_filter * filter, void * data, size_t samples) { 44 struct roardsp_amp * self = (struct roardsp_amp *) filter->inst; 45 int16_t * samp = (int16_t *) data; 46 size_t i; 47 48 for (i = 0; i < samples; i++) { 49 samp[i] += self->mul / self->div; 50 }; 51 52 return 0; 53 } 41 _calcX(8) 42 _calcX(16) 43 _calcX(32) 54 44 55 45 int roardsp_add_reset (struct roardsp_filter * filter, int what) {
Note: See TracChangeset
for help on using the changeset viewer.