[Webkit-unassigned] [Bug 72871] New: Incorrect calculation for DistanceEffect linearGain

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Nov 21 04:15:39 PST 2011


https://bugs.webkit.org/show_bug.cgi?id=72871

           Summary: Incorrect calculation for DistanceEffect linearGain
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: All
        OS/Version: All
            Status: UNCONFIRMED
          Severity: Normal
          Priority: P2
         Component: Web Audio
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: davidgaleano at hotmail.com
                CC: crogers at google.com


I think the following code in "WebCore/platform/audio/Distance.cpp" is incorrect:

    double DistanceEffect::linearGain(double distance)
73    {
74        return (1.0 - m_rolloffFactor * (distance - m_refDistance)) / (m_maxDistance - m_refDistance);
75    }

When the distance is equal or lower to the reference distance the output gain should be one but if you resolve the equation for that case:

    (1.0 - m_rolloffFactor * (m_refDistance - m_refDistance)) / (m_maxDistance - m_refDistance)
    (1.0 - m_rolloffFactor * 0) / (m_maxDistance - m_refDistance)
    (1.0 - 0) / (m_maxDistance - m_refDistance)
    1.0 / (m_maxDistance - m_refDistance)

Which is not one in a majority of cases.

I think the parenthesis are wrong and the correct code should be:

    double DistanceEffect::linearGain(double distance)
73    {
74        return (1.0 - (m_rolloffFactor * (distance - m_refDistance) / (m_maxDistance - m_refDistance));
75    }

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list