Commit a0075f54 authored by Stefan Westerfeld's avatar Stefan Westerfeld

Add debugging helper function to limiter.

Signed-off-by: Stefan Westerfeld's avatarStefan Westerfeld <stefan@space.twc.de>
parent 648437a7
......@@ -64,8 +64,20 @@ Limiter::process_block (const float *in, float *out)
const float alpha = float (i) / block_size;
const float scale = ceiling / (left_max * (1 - alpha) + right_max * alpha);
// debug_scale (scale);
for (uint c = 0; c < n_channels; c++)
out[i * n_channels + c] = in[i * n_channels + c] * scale;
}
last_block_max = block_max;
}
void
Limiter::debug_scale (float scale)
{
static int debug_scale_samples = 0;
if (debug_scale_samples % (sample_rate / 1000) == 0)
printf ("%f %f\n", double (debug_scale_samples) / sample_rate, scale);
debug_scale_samples++;
}
......@@ -14,6 +14,7 @@ class Limiter
std::vector<float> buffer;
void process_block (const float *in, float *out);
void debug_scale (float scale);
public:
Limiter (int n_channels, int sample_rate);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment