mirror of
https://github.com/radio95-rnt/fm95.git
synced 2026-02-26 19:23:51 +01:00
stuff for developing, actual debug mode as well as add the vban protocol specs
This commit is contained in:
@@ -13,6 +13,9 @@ void init_modulation_power_measure(MPXPowerMeasurement* mpx, int sample_rate) {
|
||||
mpx->sample_counter = 0;
|
||||
mpx->sample = 0;
|
||||
mpx->sample_rate = sample_rate;
|
||||
#ifdef BS412_DEBUG
|
||||
debug_printf("Initialized MPX power measurement with sample rate: %d\n", sample_rate);
|
||||
#endif
|
||||
}
|
||||
|
||||
float measure_mpx(MPXPowerMeasurement* mpx, float deviation) {
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef DEBUG
|
||||
#define BS412_DEBUG
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#ifdef BS412_DEBUG
|
||||
#include "../lib/debug.h"
|
||||
|
||||
@@ -19,9 +19,9 @@ void init_refrenced_fm_modulator(RefrencedFMModulator* fm, Oscillator* osc, floa
|
||||
fm->osc = osc;
|
||||
}
|
||||
|
||||
float refrenced_modulate_fm(RefrencedFMModulator* fm, float sample) {
|
||||
float refrenced_modulate_fm(RefrencedFMModulator* fm, float sample, float phase_multiplier) {
|
||||
float inst_freq = sample * fm->deviation;
|
||||
float phase = fm->osc->phase + ((M_2PI * inst_freq) / fm->osc->sample_rate);
|
||||
float phase = (fm->osc->phase * phase_multiplier) + ((M_2PI * inst_freq) / fm->osc->sample_rate);
|
||||
|
||||
if (phase >= M_2PI) {
|
||||
phase -= M_2PI;
|
||||
|
||||
@@ -19,4 +19,4 @@ typedef struct
|
||||
Oscillator* osc;
|
||||
} RefrencedFMModulator;
|
||||
void init_refrenced_fm_modulator(RefrencedFMModulator *fm, Oscillator *osc, float deviation);
|
||||
float refrenced_modulate_fm(RefrencedFMModulator *fm, float sample);
|
||||
float refrenced_modulate_fm(RefrencedFMModulator *fm, float sample, float phase_multiplier);
|
||||
|
||||
Reference in New Issue
Block a user