mirror of
https://github.com/radio95-rnt/fm95.git
synced 2026-02-26 19:23:51 +01:00
small optimazations
This commit is contained in:
@@ -11,7 +11,7 @@ inline float deviation_to_dbr(float deviation) {
|
||||
return 10.0f * (log2f(deviation) - LOG2_19000) * 0.30103f;
|
||||
}
|
||||
|
||||
void init_bs412(BS412Compressor* mpx, float mpx_deviation, float target_power, float attack, float release, float max, int sample_rate) {
|
||||
void init_bs412(BS412Compressor* mpx, uint32_t mpx_deviation, float target_power, float attack, float release, float max, uint32_t sample_rate) {
|
||||
mpx->mpx_deviation = mpx_deviation;
|
||||
mpx->average_counter = 0;
|
||||
mpx->average = 0;
|
||||
@@ -26,7 +26,7 @@ void init_bs412(BS412Compressor* mpx, float mpx_deviation, float target_power, f
|
||||
#endif
|
||||
}
|
||||
|
||||
float soft_clip_tanh(float sample, float threshold) {
|
||||
inline float soft_clip_tanh(float sample, float threshold) {
|
||||
if (fabsf(sample) <= threshold) {
|
||||
return sample; // Linear region
|
||||
}
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int mpx_deviation;
|
||||
int average_counter;
|
||||
uint32_t mpx_deviation;
|
||||
uint32_t average_counter;
|
||||
uint32_t sample_rate;
|
||||
float target;
|
||||
float attack;
|
||||
@@ -27,5 +27,5 @@ typedef struct
|
||||
float dbr_to_deviation(float dbr);
|
||||
float deviation_to_dbr(float deviation);
|
||||
|
||||
void init_bs412(BS412Compressor *mpx, float mpx_deviation, float target_power, float attack, float release, float max, int sample_rate);
|
||||
void init_bs412(BS412Compressor *mpx, uint32_t mpx_deviation, float target_power, float attack, float release, float max, uint32_t sample_rate);
|
||||
float bs412_compress(BS412Compressor *mpx, float average);
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "gain_control.h"
|
||||
|
||||
void initAGC(AGC* agc, int sampleRate, float targetLevel, float minGain, float maxGain, float attackTime, float releaseTime) {
|
||||
void initAGC(AGC* agc, uint32_t sampleRate, float targetLevel, float minGain, float maxGain, float attackTime, float releaseTime) {
|
||||
agc->targetLevel = targetLevel;
|
||||
agc->minGain = minGain;
|
||||
agc->maxGain = maxGain;
|
||||
|
||||
@@ -21,5 +21,5 @@ typedef struct {
|
||||
float rmsBeta;
|
||||
} AGC;
|
||||
|
||||
void initAGC(AGC* agc, int sampleRate, float targetLevel, float minGain, float maxGain, float attackTime, float releaseTime);
|
||||
void initAGC(AGC* agc, uint32_t sampleRate, float targetLevel, float minGain, float maxGain, float attackTime, float releaseTime);
|
||||
float process_agc(AGC* agc, float sidechain);
|
||||
Reference in New Issue
Block a user