+// float limiter_att, compressor_att;
+
+ // Then a limiter at +0 dB (so, -14 dBFS) to take out the worst peaks only.
+ {
+ float threshold = pow(10.0f, (ref_level_dbfs + 0.0f) / 20.0f); // +0 dB.
+ float ratio = 1000.0f; // Infinity.
+ float attack_time = 0.001f;
+ float release_time = 0.005f;
+ float makeup_gain = 1.0f; // 0 dB.
+ limiter.process(samples_out.data(), samples_out.size() / 2, threshold, ratio, attack_time, release_time, makeup_gain);
+// limiter_att = limiter.get_attenuation();
+ }
+
+ // Finally, the real compressor.
+ {
+ float threshold = pow(10.0f, (ref_level_dbfs - 12.0f) / 20.0f); // -12 dB.
+ float ratio = 20.0f;
+ float attack_time = 0.005f;
+ float release_time = 0.040f;
+ float makeup_gain = 2.0f; // +3 dB.
+ compressor.process(samples_out.data(), samples_out.size() / 2, threshold, ratio, attack_time, release_time, makeup_gain);
+// compressor_att = compressor.get_attenuation();
+ }
+
+// printf("limiter=%+5.1f compressor=%+5.1f\n", 20.0*log10(limiter_att), 20.0*log10(compressor_att));
+