mirror of
https://github.com/radio95-rnt/fm95.git
synced 2026-02-27 03:23:54 +01:00
fix bug
This commit is contained in:
2
.vscode/.server-controller-port.log
vendored
2
.vscode/.server-controller-port.log
vendored
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"port": 13452,
|
"port": 13452,
|
||||||
"time": 1754149596407,
|
"time": 1754151185891,
|
||||||
"version": "0.0.3"
|
"version": "0.0.3"
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdint.h>
|
||||||
#ifdef BS412_DEBUG
|
#ifdef BS412_DEBUG
|
||||||
#include "../lib/debug.h"
|
#include "../lib/debug.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -14,7 +15,7 @@ typedef struct
|
|||||||
{
|
{
|
||||||
int mpx_deviation;
|
int mpx_deviation;
|
||||||
int average_counter;
|
int average_counter;
|
||||||
int sample_rate;
|
uint32_t sample_rate;
|
||||||
float target;
|
float target;
|
||||||
float attack;
|
float attack;
|
||||||
float release;
|
float release;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
float targetLevel;
|
float targetLevel;
|
||||||
@@ -11,7 +12,7 @@ typedef struct {
|
|||||||
float currentGain;
|
float currentGain;
|
||||||
float currentLevel;
|
float currentLevel;
|
||||||
|
|
||||||
int sampleRate;
|
uint32_t sampleRate;
|
||||||
float attackCoef;
|
float attackCoef;
|
||||||
float releaseCoef;
|
float releaseCoef;
|
||||||
|
|
||||||
|
|||||||
@@ -445,7 +445,7 @@ void init_runtime(FM95_Runtime* runtime, FM95_Config config, bool rds_on) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float last_gain = 0.0f;
|
float last_gain = 0.0f;
|
||||||
if((uint32_t)runtime->bs412.sample_rate == config.sample_rate) last_gain = runtime->bs412.gain;
|
if(runtime->bs412.sample_rate == config.sample_rate) last_gain = runtime->bs412.gain;
|
||||||
init_bs412(&runtime->bs412, config.mpx_deviation, config.mpx_power, config.bs412_attack, config.bs412_release, config.bs412_max, config.sample_rate);
|
init_bs412(&runtime->bs412, config.mpx_deviation, config.mpx_power, config.bs412_attack, config.bs412_release, config.bs412_max, config.sample_rate);
|
||||||
runtime->bs412.gain = last_gain;
|
runtime->bs412.gain = last_gain;
|
||||||
|
|
||||||
@@ -454,7 +454,8 @@ void init_runtime(FM95_Runtime* runtime, FM95_Config config, bool rds_on) {
|
|||||||
init_stereo_encoder(&runtime->stencode, 4.0f, &runtime->osc, (config.stereo == 2), config.volumes.mono, config.volumes.pilot, config.volumes.stereo);
|
init_stereo_encoder(&runtime->stencode, 4.0f, &runtime->osc, (config.stereo == 2), config.volumes.mono, config.volumes.pilot, config.volumes.stereo);
|
||||||
|
|
||||||
if(config.agc_max != 0.0) {
|
if(config.agc_max != 0.0) {
|
||||||
if((uint32_t)runtime->agc.sampleRate == config.sample_rate) last_gain = runtime->agc.currentGain;
|
last_gain = 0.0f;
|
||||||
|
if(runtime->agc.sampleRate == config.sample_rate) last_gain = runtime->agc.currentGain;
|
||||||
initAGC(&runtime->agc, config.sample_rate, config.agc_target, config.agc_min, config.agc_max, config.agc_attack, config.agc_release);
|
initAGC(&runtime->agc, config.sample_rate, config.agc_target, config.agc_min, config.agc_max, config.agc_attack, config.agc_release);
|
||||||
runtime->agc.currentGain = last_gain;
|
runtime->agc.currentGain = last_gain;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user