~rantlivelintkale/extended-drive.lv2

d7a4e2547902afc9605dc17b9be4543a52578b1a — Veikka Valtteri Kallinen 5 months ago 2dc0abf
smooth controls per sample not block
1 files changed, 23 insertions(+), 23 deletions(-)

M src/main.c
M src/main.c => src/main.c +23 -23
@@ 464,15 464,15 @@ static LV2_Handle instantiate(const LV2_Descriptor *descriptor,

	// Control smoothing filters
	{
		lpf_set(100.f, plugin->rate_r, &plugin->cf[0]);
		lpf_set(100.f, plugin->rate_r, &plugin->cf[1]);
		lpf_set(100.f, plugin->rate_r, &plugin->cf[2]);
		lpf_set(100.f, plugin->rate_r, &plugin->cf[3]);
		lpf_set(100.f, plugin->rate_r, &plugin->cf[4]);
		lpf_set(100.f, plugin->rate_r, &plugin->cf[5]);
		lpf_set(100.f, plugin->rate_r, &plugin->cf[6]);
		lpf_set(100.f, plugin->rate_r, &plugin->cf[7]);
		lpf_set(100.f, plugin->rate_r, &plugin->cf[8]);
		lpf_set(10.f, plugin->rate_r, &plugin->cf[0]);
		lpf_set(10.f, plugin->rate_r, &plugin->cf[1]);
		lpf_set(10.f, plugin->rate_r, &plugin->cf[2]);
		lpf_set(10.f, plugin->rate_r, &plugin->cf[3]);
		lpf_set(10.f, plugin->rate_r, &plugin->cf[4]);
		lpf_set(10.f, plugin->rate_r, &plugin->cf[5]);
		lpf_set(10.f, plugin->rate_r, &plugin->cf[6]);
		lpf_set(10.f, plugin->rate_r, &plugin->cf[7]);
		lpf_set(10.f, plugin->rate_r, &plugin->cf[8]);
	}

	return (LV2_Handle) plugin;


@@ 555,21 555,21 @@ static void run(LV2_Handle instance, uint32_t n_samples)
	}

	{
		float const filter      = lpf_process(*plugin->filter, &plugin->cf[0]);
		float const integration = lpf_process(*plugin->integration > 0.f ? 1.f : 0.f, &plugin->cf[1]);
		float const bias        = lpf_process(*plugin->bias > 0.f ? 1.f : 0.f, &plugin->cf[2]);
		float const pre         = lpf_process(db_co(*plugin->pre), &plugin->cf[3]);
		float const soft        = lpf_process(*plugin->soft > 0.f ? 1.f : 0.f, &plugin->cf[4]);
		float const post        = lpf_process(db_co(*plugin->post), &plugin->cf[5]);
		float const mix         = lpf_process(*plugin->mix, &plugin->cf[6]);
		float const tone        = lpf_process(*plugin->tone, &plugin->cf[7]);
		float const mid         = lpf_process(*plugin->mid, &plugin->cf[8]);

		hpf_set(filter, plugin->rate_r, &plugin->hpf[0]);
		hpf_set(1000.f - 500.f * mid, plugin->rate_r, &plugin->hpf[1]);
		lpf_set(250.f + 250.f * mid, plugin->rate_r, &plugin->lpf[0]);

		for (uint32_t pos = 0; pos < n_samples; pos++) {
			float const filter      = lpf_process(*plugin->filter, &plugin->cf[0]);
			float const integration = lpf_process(*plugin->integration > 0.f ? 1.f : 0.f, &plugin->cf[1]);
			float const bias        = lpf_process(*plugin->bias > 0.f ? 1.f : 0.f, &plugin->cf[2]);
			float const pre         = lpf_process(db_co(*plugin->pre), &plugin->cf[3]);
			float const soft        = lpf_process(*plugin->soft > 0.f ? 1.f : 0.f, &plugin->cf[4]);
			float const post        = lpf_process(db_co(*plugin->post), &plugin->cf[5]);
			float const mix         = lpf_process(*plugin->mix, &plugin->cf[6]);
			float const tone        = lpf_process(*plugin->tone, &plugin->cf[7]);
			float const mid         = lpf_process(*plugin->mid, &plugin->cf[8]);

			hpf_set(filter, plugin->rate_r, &plugin->hpf[0]);
			hpf_set(1000.f - 500.f * mid, plugin->rate_r, &plugin->hpf[1]);
			lpf_set(250.f + 250.f * mid, plugin->rate_r, &plugin->lpf[0]);

			float x = output[pos];
			// common DC block
			dcf_filter(&x, &plugin->dcf_z[0], plugin->dcf_r);