[651] | 1 | //libroardsp.h: |
---|
| 2 | |
---|
| 3 | #ifndef _LIBROARDSP_H_ |
---|
| 4 | #define _LIBROARDSP_H_ |
---|
| 5 | |
---|
[652] | 6 | #include <roaraudio.h> |
---|
| 7 | |
---|
[659] | 8 | // defines |
---|
| 9 | #define ROARDSP_MAX_FILTERS_PER_CHAIN 8 |
---|
| 10 | |
---|
[662] | 11 | #define ROARDSP_FILTER_NONE 0 |
---|
| 12 | #define ROARDSP_FILTER_AMP 1 |
---|
| 13 | #define ROARDSP_FILTER_LOWP 2 |
---|
| 14 | #define ROARDSP_FILTER_HIGHP 3 |
---|
| 15 | |
---|
[672] | 16 | // filter CTLs: |
---|
| 17 | |
---|
| 18 | #define ROARDSP_FCTL_FREQ 1 |
---|
| 19 | #define ROARDSP_FCTL_TIME 2 |
---|
| 20 | #define ROARDSP_FCTL_MUL 3 |
---|
| 21 | #define ROARDSP_FCTL_DIV 4 |
---|
| 22 | |
---|
[659] | 23 | // types: |
---|
| 24 | |
---|
| 25 | struct roardsp_filter { |
---|
| 26 | int channels; |
---|
| 27 | int bits; |
---|
[673] | 28 | int rate; |
---|
[659] | 29 | void * inst; |
---|
| 30 | int (*calc )(struct roardsp_filter * filter, void * data, size_t samples); |
---|
| 31 | int (*uninit)(struct roardsp_filter * filter); |
---|
[672] | 32 | int (*ctl )(struct roardsp_filter * filter, int cmd, void * data); |
---|
[659] | 33 | }; |
---|
| 34 | |
---|
| 35 | struct roardsp_filterchain { |
---|
| 36 | int filters; |
---|
| 37 | struct roardsp_filter * filter[ROARDSP_MAX_FILTERS_PER_CHAIN]; |
---|
| 38 | }; |
---|
| 39 | |
---|
| 40 | struct roardsp_lowp { |
---|
| 41 | uint32_t freq; // in mHz (0Hz..4MHz) |
---|
| 42 | uint16_t a, b; |
---|
| 43 | int32_t old[ROAR_MAX_CHANNELS]; |
---|
| 44 | }; |
---|
| 45 | |
---|
[685] | 46 | struct roardsp_highp { |
---|
| 47 | uint32_t freq; // in mHz (0Hz..4MHz) |
---|
| 48 | int32_t a, b, c; |
---|
| 49 | int32_t oldout[ROAR_MAX_CHANNELS]; |
---|
| 50 | int32_t oldin[ROAR_MAX_CHANNELS]; |
---|
| 51 | }; |
---|
| 52 | |
---|
[659] | 53 | // funcs: |
---|
[664] | 54 | int roardsp_filter_str2id(char * str); |
---|
| 55 | char * roardsp_filter_id2str(int id); |
---|
| 56 | int roardsp_filter_init (struct roardsp_filter * filter, struct roar_stream * stream, int id); |
---|
| 57 | int roardsp_filter_uninit(struct roardsp_filter * filter); |
---|
| 58 | int roardsp_filter_calc (struct roardsp_filter * filter, void * data, size_t len); |
---|
[672] | 59 | int roardsp_filter_ctl (struct roardsp_filter * filter, int cmd, void * data); |
---|
[659] | 60 | |
---|
| 61 | int roardsp_fchain_init (struct roardsp_filterchain * chain); |
---|
| 62 | int roardsp_fchain_uninit(struct roardsp_filterchain * chain); |
---|
| 63 | int roardsp_fchain_add (struct roardsp_filterchain * chain, struct roardsp_filter * filter); |
---|
| 64 | int roardsp_fchain_calc (struct roardsp_filterchain * chain, void * data, size_t len); |
---|
[679] | 65 | int roardsp_fchain_num (struct roardsp_filterchain * chain); |
---|
[659] | 66 | |
---|
[676] | 67 | // filter: |
---|
| 68 | |
---|
| 69 | int roardsp_lowp_init (struct roardsp_filter * filter, struct roar_stream * stream, int id); |
---|
| 70 | int roardsp_lowp_uninit(struct roardsp_filter * filter); |
---|
| 71 | int roardsp_lowp_calc16(struct roardsp_filter * filter, void * data, size_t samples); |
---|
| 72 | int roardsp_lowp_ctl (struct roardsp_filter * filter, int cmd, void * data); |
---|
| 73 | |
---|
[685] | 74 | int roardsp_highp_init (struct roardsp_filter * filter, struct roar_stream * stream, int id); |
---|
| 75 | int roardsp_highp_uninit(struct roardsp_filter * filter); |
---|
| 76 | int roardsp_highp_calc16(struct roardsp_filter * filter, void * data, size_t samples); |
---|
| 77 | int roardsp_highp_ctl (struct roardsp_filter * filter, int cmd, void * data); |
---|
[676] | 78 | |
---|
[651] | 79 | #endif |
---|
| 80 | |
---|
| 81 | //ll |
---|