attemp to use a pll

This commit is contained in:
2025-03-22 21:11:40 +01:00
parent 48084001e1
commit e190a21aea
3 changed files with 55 additions and 3 deletions
+19 -1
View File
@@ -3,6 +3,7 @@
#include <string.h>
#include <stdlib.h>
#include "constants.h"
#include "oscillator.h"
typedef struct
{
@@ -13,4 +14,21 @@ typedef struct
void init_preemphasis(ResistorCapacitor *filter, float tau, float sample_rate);
float apply_preemphasis(ResistorCapacitor *filter, float sample);
float hard_clip(float sample, float threshold);
float hard_clip(float sample, float threshold);
typedef struct {
float phase_error;
float loop_filter;
float vco_phase;
float vco_frequency;
float reference_frequency;
float target_frequency;
float multiplier;
float sample_rate;
float loop_gain;
float filter_coefficient;
} PLL;
void init_pll(PLL *pll, float reference_frequency, float target_frequency, float sample_rate);
float update_pll(PLL *pll, float reference_signal);