mirror of
https://github.com/radio95-rnt/fm95.git
synced 2026-02-26 19:23:51 +01:00
27 lines
583 B
C
27 lines
583 B
C
#pragma once
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <math.h>
|
|
#include "constants.h"
|
|
#include "oscillator.h"
|
|
|
|
#define FILTER_LEN 51
|
|
|
|
typedef struct
|
|
{
|
|
float alpha;
|
|
float prev_sample;
|
|
} ResistorCapacitor;
|
|
|
|
void init_preemphasis(ResistorCapacitor *filter, float tau, float sample_rate);
|
|
float apply_preemphasis(ResistorCapacitor *filter, float sample);
|
|
|
|
float hard_clip(float sample, float threshold);
|
|
|
|
typedef struct filters
|
|
{
|
|
float filter[FILTER_LEN];
|
|
int filter_idx;
|
|
} FIRFilter;
|
|
void init_lpf(FIRFilter *lpf, float freq);
|
|
float fir_filter(FIRFilter *fir, float sample); |