mirror of
https://github.com/radio95-rnt/fm95.git
synced 2026-02-26 19:23:51 +01:00
28 lines
781 B
C
28 lines
781 B
C
#pragma once
|
|
|
|
#include <math.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include "constants.h"
|
|
|
|
typedef struct {
|
|
float alpha;
|
|
float prev_sample;
|
|
} ResistorCapacitor;
|
|
|
|
void init_rc(ResistorCapacitor *pe, float alpha);
|
|
void init_rc_tau(ResistorCapacitor *pe, float tau, float sample_rate);
|
|
float apply_pre_emphasis(ResistorCapacitor *pe, float sample);
|
|
|
|
typedef struct {
|
|
float *buffer;
|
|
int write_idx; // Write position
|
|
int read_idx; // Read position
|
|
int size; // Total buffer size
|
|
int delay; // Delay in samples
|
|
} DelayLine;
|
|
|
|
void init_delay_line(DelayLine *delay_line, int max_delay);
|
|
void set_delay_line(DelayLine *delay_line, int new_delay);
|
|
float delay_line(DelayLine *delay_line, float in);
|
|
void exit_delay_line(DelayLine *delay_line); |