13
0

Fix ACE Compressor inplace processing #9636

This commit is contained in:
Robin Gareus 2024-02-18 18:19:35 +01:00
parent 1117f8d6cc
commit 9386847cc9
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
2 changed files with 20 additions and 3 deletions

View File

@ -138,9 +138,20 @@ ParameterDescriptor::ParameterDescriptor(const Evoral::Parameter& parameter)
case MidiChannelPressureAutomation: case MidiChannelPressureAutomation:
case MidiNotePressureAutomation: case MidiNotePressureAutomation:
lower = 0.0; lower = 0.0;
normal = 0.0;
upper = 127.0; upper = 127.0;
print_fmt = "%.0f"; print_fmt = "%.0f";
switch(parameter.id()) {
case 7: // Channel Volume (MSB)
normal = 127;
break;
case 8: // Balance (MSB)
case 10: // Pan (MSB)
normal = 64;
break;
default:
normal = 0.0;
break;
}
break; break;
case MidiPitchBenderAutomation: case MidiPitchBenderAutomation:
lower = 0.0; lower = 0.0;

View File

@ -338,6 +338,12 @@ run(LV2_Handle instance, uint32_t n_samples)
makeup_target = 1.f; makeup_target = 1.f;
} }
for (uint32_t c=0; c<n_channels; ++c) {
if (ins[c] != outs[c]) {
memcpy (outs[c], ins[c], sizeof (float) * n_samples);
}
}
#ifdef LV2_EXTENDED #ifdef LV2_EXTENDED
if (acomp->v_knee != *acomp->knee) { if (acomp->v_knee != *acomp->knee) {
acomp->v_knee = *acomp->knee; acomp->v_knee = *acomp->knee;
@ -366,7 +372,7 @@ run(LV2_Handle instance, uint32_t n_samples)
for (i = 0; i < n_samples; i++) { for (i = 0; i < n_samples; i++) {
maxabs = 0.f; maxabs = 0.f;
for (uint32_t c=0; c<n_channels; ++c) { for (uint32_t c=0; c<n_channels; ++c) {
maxabs = fmaxf(fabsf(ins[c][i]), maxabs); maxabs = fmaxf(fabsf(outs[c][i]), maxabs);
} }
sc0 = sc[i]; sc0 = sc[i];
ingain = usesidechain ? fabs(sc0) : maxabs; ingain = usesidechain ? fabs(sc0) : maxabs;
@ -409,7 +415,7 @@ run(LV2_Handle instance, uint32_t n_samples)
makeup_gain += tau * (makeup_target - makeup_gain); makeup_gain += tau * (makeup_target - makeup_gain);
for (uint32_t c=0; c<n_channels; ++c) { for (uint32_t c=0; c<n_channels; ++c) {
float out = ins[c][i] * Lgain * makeup_gain; float out = outs[c][i] * Lgain * makeup_gain;
outs[c][i] = out; outs[c][i] = out;
out = fabsf (out); out = fabsf (out);
if (out > max_out) { if (out > max_out) {