static void runAddingPlate(LADSPA_Handle instance, unsigned long sample_count) { Plate *plugin_data = (Plate *)instance; LADSPA_Data run_adding_gain = plugin_data->run_adding_gain; /* Reverb time (float value) */ const LADSPA_Data time = *(plugin_data->time); /* Damping (float value) */ const LADSPA_Data damping = *(plugin_data->damping); /* Dry/wet mix (float value) */ const LADSPA_Data wet = *(plugin_data->wet); /* Input (array of floats of length sample_count) */ const LADSPA_Data * const input = plugin_data->input; /* Left output (array of floats of length sample_count) */ LADSPA_Data * const outputl = plugin_data->outputl; /* Right output (array of floats of length sample_count) */ LADSPA_Data * const outputr = plugin_data->outputr; float * out = plugin_data->out; waveguide_nl ** w = plugin_data->w; #line 48 "plate_1423.xml" unsigned long pos; const float scale = powf(time * 0.117647f, 1.34f); const float lpscale = 1.0f - damping * 0.93; for (pos=0; pos<8; pos++) { waveguide_nl_set_delay(w[pos], w[pos]->size * scale); } for (pos=0; pos<4; pos++) { waveguide_nl_set_fc(w[pos], LP_INNER * lpscale); } for (; pos<8; pos++) { waveguide_nl_set_fc(w[pos], LP_OUTER * lpscale); } for (pos = 0; pos < sample_count; pos++) { const float alpha = (out[0] + out[2] + out[4] + out[6]) * 0.5f + input[pos]; const float beta = (out[1] + out[9] + out[14]) * 0.666666666f; const float gamma = (out[3] + out[8] + out[11]) * 0.666666666f; const float delta = (out[5] + out[10] + out[13]) * 0.666666666f; const float epsilon = (out[7] + out[12] + out[15]) * 0.666666666f; RUN_WG(0, beta, alpha); RUN_WG(1, gamma, alpha); RUN_WG(2, delta, alpha); RUN_WG(3, epsilon, alpha); RUN_WG(4, beta, gamma); RUN_WG(5, gamma, delta); RUN_WG(6, delta, epsilon); RUN_WG(7, epsilon, beta); buffer_write(outputl[pos], beta * wet + input[pos] * (1.0f - wet)); buffer_write(outputr[pos], gamma * wet + input[pos] * (1.0f - wet)); } }
static void runAddingGong(LADSPA_Handle instance, unsigned long sample_count) { Gong *plugin_data = (Gong *)instance; LADSPA_Data run_adding_gain = plugin_data->run_adding_gain; /* Inner damping (float value) */ const LADSPA_Data damp_i = *(plugin_data->damp_i); /* Outer damping (float value) */ const LADSPA_Data damp_o = *(plugin_data->damp_o); /* Mic position (float value) */ const LADSPA_Data micpos = *(plugin_data->micpos); /* Inner size 1 (float value) */ const LADSPA_Data scale0 = *(plugin_data->scale0); /* Inner stiffness 1 + (float value) */ const LADSPA_Data apa0 = *(plugin_data->apa0); /* Inner stiffness 1 - (float value) */ const LADSPA_Data apb0 = *(plugin_data->apb0); /* Inner size 2 (float value) */ const LADSPA_Data scale1 = *(plugin_data->scale1); /* Inner stiffness 2 + (float value) */ const LADSPA_Data apa1 = *(plugin_data->apa1); /* Inner stiffness 2 - (float value) */ const LADSPA_Data apb1 = *(plugin_data->apb1); /* Inner size 3 (float value) */ const LADSPA_Data scale2 = *(plugin_data->scale2); /* Inner stiffness 3 + (float value) */ const LADSPA_Data apa2 = *(plugin_data->apa2); /* Inner stiffness 3 - (float value) */ const LADSPA_Data apb2 = *(plugin_data->apb2); /* Inner size 4 (float value) */ const LADSPA_Data scale3 = *(plugin_data->scale3); /* Inner stiffness 4 + (float value) */ const LADSPA_Data apa3 = *(plugin_data->apa3); /* Inner stiffness 4 - (float value) */ const LADSPA_Data apb3 = *(plugin_data->apb3); /* Outer size 1 (float value) */ const LADSPA_Data scale4 = *(plugin_data->scale4); /* Outer stiffness 1 + (float value) */ const LADSPA_Data apa4 = *(plugin_data->apa4); /* Outer stiffness 1 - (float value) */ const LADSPA_Data apb4 = *(plugin_data->apb4); /* Outer size 2 (float value) */ const LADSPA_Data scale5 = *(plugin_data->scale5); /* Outer stiffness 2 + (float value) */ const LADSPA_Data apa5 = *(plugin_data->apa5); /* Outer stiffness 2 - (float value) */ const LADSPA_Data apb5 = *(plugin_data->apb5); /* Outer size 3 (float value) */ const LADSPA_Data scale6 = *(plugin_data->scale6); /* Outer stiffness 3 + (float value) */ const LADSPA_Data apa6 = *(plugin_data->apa6); /* Outer stiffness 3 - (float value) */ const LADSPA_Data apb6 = *(plugin_data->apb6); /* Outer size 4 (float value) */ const LADSPA_Data scale7 = *(plugin_data->scale7); /* Outer stiffness 4 + (float value) */ const LADSPA_Data apa7 = *(plugin_data->apa7); /* Outer stiffness 4 - (float value) */ const LADSPA_Data apb7 = *(plugin_data->apb7); /* Input (array of floats of length sample_count) */ const LADSPA_Data * const input = plugin_data->input; /* Output (array of floats of length sample_count) */ LADSPA_Data * const output = plugin_data->output; int maxsize_i = plugin_data->maxsize_i; int maxsize_o = plugin_data->maxsize_o; float * out = plugin_data->out; waveguide_nl ** w = plugin_data->w; #line 52 "gong_1424.xml" unsigned long pos; /* The a coef of the inner lowpass */ const float lpi = 1.0f - damp_i * 0.1423f; /* The a coef of the outer lowpass */ const float lpo = 1.0f - damp_o * 0.19543f; /* Set the parameters of the waveguides */ waveguide_nl_set_delay(w[0], maxsize_i * scale0); waveguide_nl_set_ap(w[0], apa0, apb0); waveguide_nl_set_delay(w[1], maxsize_i * scale1); waveguide_nl_set_ap(w[1], apa1, apb1); waveguide_nl_set_delay(w[2], maxsize_i * scale2); waveguide_nl_set_ap(w[2], apa2, apb2); waveguide_nl_set_delay(w[3], maxsize_i * scale3); waveguide_nl_set_ap(w[3], apa3, apb3); waveguide_nl_set_delay(w[4], maxsize_o * scale4); waveguide_nl_set_ap(w[4], apa4, apb4); waveguide_nl_set_delay(w[5], maxsize_o * scale5); waveguide_nl_set_ap(w[5], apa5, apb5); waveguide_nl_set_delay(w[6], maxsize_o * scale6); waveguide_nl_set_ap(w[6], apa6, apb6); waveguide_nl_set_delay(w[7], maxsize_o * scale7); waveguide_nl_set_ap(w[7], apa7, apb7); for (pos=0; pos<4; pos++) { waveguide_nl_set_fc(w[pos], lpi); } for (; pos<8; pos++) { waveguide_nl_set_fc(w[pos], lpo); } for (pos = 0; pos < sample_count; pos++) { /* Calcualte the deflections at the wavejunctions alpha is the centre, beta is north, gamma is east, delta is south and epsilon is west */ const float alpha = (out[0] + out[2] + out[4] + out[6]) * 0.5f + input[pos]; const float beta = (out[1] + out[9] + out[14]) * 0.666666666666f; const float gamma = (out[3] + out[8] + out[11]) * 0.666666666666f; const float delta = (out[5] + out[10] + out[13]) * 0.666666666666f; const float epsilon = (out[7] + out[12] + out[15]) * 0.666666666666f; /* Inject the energy at the junctions + reflections into the waveguides (the macro gives the reflection calcs) */ RUN_WG(0, beta, alpha); RUN_WG(1, gamma, alpha); RUN_WG(2, delta, alpha); RUN_WG(3, epsilon, alpha); RUN_WG(4, beta, gamma); RUN_WG(5, gamma, delta); RUN_WG(6, delta, epsilon); RUN_WG(7, epsilon, beta); buffer_write(output[pos], (1.0f - micpos) * alpha + micpos * delta); } }