aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/samplerate.h
blob: 4fbf680745867a494fa9a2c4363fceae38305cd2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include "iir_filter.h"

typedef struct samplerate {
	double factor;
	struct {
		iir_filter_t lp;
		sample_t last_sample;
		double in_index;
	} down;
	struct {
		iir_filter_t lp;
		sample_t last_sample;
		double in_index;
	} up;
} samplerate_t;

int init_samplerate(samplerate_t *state, double low_samplerate, double high_samplerate, double filter_cutoff);
int samplerate_downsample(samplerate_t *state, sample_t *samples, int input_num);
int samplerate_upsample(samplerate_t *state, sample_t *input, int input_num, sample_t *output);