0
1
mirror of https://github.com/radio95-rnt/fm95.git synced 2026-02-27 03:23:54 +01:00

add bpf to rds2 carrier and lpf

This commit is contained in:
2025-03-25 17:01:25 +01:00
parent 73f97bb6d3
commit 7164421e16
4 changed files with 59 additions and 44 deletions

View File

@@ -5,6 +5,8 @@
#include "constants.h"
#include "oscillator.h"
#define FILTER_LEN 51
typedef struct
{
float alpha;
@@ -16,13 +18,11 @@ float apply_preemphasis(ResistorCapacitor *filter, float sample);
float hard_clip(float sample, float threshold);
typedef struct {
float phase;
float freq;
float loop_filter_state;
float kp;
float ki;
int sample_rate;
} PLL;
void init_pll(PLL *pll, float freq, float loop_filter_bandwidth, float damping, int sample_rate);
float apply_pll(PLL *pll, float ref_sample);
typedef struct filters
{
float filter[FILTER_LEN];
int filter_idx;
} FIRFilter;
void init_bpf(FIRFilter *bpf, float start, float end);
void init_lpf(FIRFilter *lpf, float freq);
float fir_filter(FIRFilter *fir, float sample);