0
1
mirror of https://github.com/radio95-rnt/fm95.git synced 2026-02-26 11:22:00 +01:00
Files
fm95/lib/filters.h
2024-12-31 16:10:21 +01:00

23 lines
582 B
C

#include "math.h"
#include <string.h>
#include "constants.h"
#define FIR_PHASES 32
#define FIR_TAPS 32
typedef struct {
float alpha;
float prev_sample;
} Emphasis;
void init_emphasis(Emphasis *pe, float tau, float sample_rate);
float apply_pre_emphasis(Emphasis *pe, float sample);
typedef struct {
float low_pass_fir[FIR_PHASES][FIR_TAPS];
float sample_buffer[FIR_TAPS];
int buffer_index;
} LowPassFilter;
void init_low_pass_filter(LowPassFilter *lp, float cutoff_frequency, float sample_rate);
float apply_low_pass_filter(LowPassFilter *lp, float sample);