Skip to content

CrossoverEQ: Invalid checkGate function #5461

@JohannesLorenz

Description

@JohannesLorenz

Bug Summary

From plugins/CrossoverEQ/CrossoverEQ.cpp:

const float d = dryLevel();
const float w = wetLevel();
double outSum = 0.0;
for( int f = 0; f < frames; ++f )
{
	outSum = buf[f][0] * buf[f][0] + buf[f][1] * buf[f][1];
	buf[f][0] = d * buf[f][0] + w * m_work[f][0];
	buf[f][1] = d * buf[f][1] + w * m_work[f][1];
}
	
checkGate( outSum );

There are at least 2 bugs in this calculation:

  1. It seems to calculate outSum incorrectly - it's assigned rather than incremented in the loop, so only the last sample is actually checked. (Thanks to @DomClark for reporting)
  2. outSum must be divided by frames in the end. (caused by Effect::checkGate should have a more descriptive comment #5460)

Steps to reproduce

Unclear

Expected behavior

Unclear

Actual behavior

Unclear. It could lead to too early or to late stopping of effect processing, and thus to clipping.

Affected LMMS versions

all

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions