light changes

This commit is contained in:
2025-01-23 10:03:39 +01:00
parent 43521d90a8
commit 7096a6e572
13 changed files with 106 additions and 300 deletions
+7 -7
View File
@@ -36,7 +36,7 @@
volatile sig_atomic_t to_run = 1;
float clip(float sample) {
float hard_clip(float sample) {
if (sample > CLIPPER_THRESHOLD) {
return CLIPPER_THRESHOLD; // Clip to the upper threshold
} else if (sample < -CLIPPER_THRESHOLD) {
@@ -113,10 +113,10 @@ int main() {
init_fm_modulator(&mod, FREQUENCY, DEVIATION, SAMPLE_RATE);
#ifdef PREEMPHASIS
ResistorCapacitor preemp;
init_rc(&preemp, PREEMPHASIS_TAU, SAMPLE_RATE);
init_rc_tau(&preemp, PREEMPHASIS_TAU, SAMPLE_RATE);
#endif
#ifdef LPF
LowPassFilter lpf;
ResistorCapacitor lpf;
init_low_pass_filter(&lpf, LPF_CUTOFF, SAMPLE_RATE);
#endif
@@ -140,17 +140,17 @@ int main() {
#ifdef LPF
float lowpassed = apply_low_pass_filter(&lpf, in);
float preemphasized = apply_pre_emphasis(&preemp, lowpassed);
float current_input = clip(preemphasized);
float current_input = hard_clip(preemphasized);
#else
float preemphasized = apply_pre_emphasis(&preemp, in);
float current_input = clip(preemphasized);
float current_input = hard_clip(preemphasized);
#endif
#else
#ifdef LPF
float lowpassed = apply_low_pass_filter(&lpf, in);
float current_input = clip(lowpassed);
float current_input = hard_clip(lowpassed);
#else
float current_input = clip(in);
float current_input = hard_clip(in);
#endif
#endif