[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 | |
---|
| 46 | // funcs: |
---|
[664] | 47 | int roardsp_filter_str2id(char * str); |
---|
| 48 | char * roardsp_filter_id2str(int id); |
---|
| 49 | int roardsp_filter_init (struct roardsp_filter * filter, struct roar_stream * stream, int id); |
---|
| 50 | int roardsp_filter_uninit(struct roardsp_filter * filter); |
---|
| 51 | int roardsp_filter_calc (struct roardsp_filter * filter, void * data, size_t len); |
---|
[672] | 52 | int roardsp_filter_ctl (struct roardsp_filter * filter, int cmd, void * data); |
---|
[659] | 53 | |
---|
| 54 | int roardsp_fchain_init (struct roardsp_filterchain * chain); |
---|
| 55 | int roardsp_fchain_uninit(struct roardsp_filterchain * chain); |
---|
| 56 | int roardsp_fchain_add (struct roardsp_filterchain * chain, struct roardsp_filter * filter); |
---|
| 57 | int roardsp_fchain_calc (struct roardsp_filterchain * chain, void * data, size_t len); |
---|
| 58 | |
---|
[676] | 59 | // filter: |
---|
| 60 | |
---|
| 61 | int roardsp_lowp_init (struct roardsp_filter * filter, struct roar_stream * stream, int id); |
---|
| 62 | int roardsp_lowp_uninit(struct roardsp_filter * filter); |
---|
| 63 | int roardsp_lowp_calc16(struct roardsp_filter * filter, void * data, size_t samples); |
---|
| 64 | int roardsp_lowp_ctl (struct roardsp_filter * filter, int cmd, void * data); |
---|
| 65 | |
---|
| 66 | |
---|
[651] | 67 | #endif |
---|
| 68 | |
---|
| 69 | //ll |
---|