Changeset 86801 in webkit


Ignore:
Timestamp:
May 18, 2011 4:14:25 PM (13 years ago)
Author:
crogers@google.com
Message:

2011-05-18 Chris Rogers <crogers@google.com>

Reviewed by James Robinson.

EqualPowerPanner is not using the correct azimuth range for stereo panning
https://bugs.webkit.org/show_bug.cgi?id=61085

No new tests since audio API is not yet implemented.

  • platform/audio/EqualPowerPanner.cpp: (WebCore::EqualPowerPanner::pan):
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r86798 r86801  
     12011-05-18  Chris Rogers  <crogers@google.com>
     2
     3        Reviewed by James Robinson.
     4
     5        EqualPowerPanner is not using the correct azimuth range for stereo panning
     6        https://bugs.webkit.org/show_bug.cgi?id=61085
     7
     8        No new tests since audio API is not yet implemented.
     9
     10        * platform/audio/EqualPowerPanner.cpp:
     11        (WebCore::EqualPowerPanner::pan):
     12
    1132011-05-18  Yi Shen  <yi.4.shen@nokia.com>
    214
  • trunk/Source/WebCore/platform/audio/EqualPowerPanner.cpp

    r73458 r86801  
    3131#include "AudioBus.h"
    3232#include "AudioUtilities.h"
     33#include <algorithm>
    3334#include <wtf/MathExtras.h>
    3435
    3536// Use a 50ms smoothing / de-zippering time-constant.
    3637const double SmoothingTimeConstant = 0.050;
    37  
     38
     39using namespace std;
     40
    3841namespace WebCore {
    3942
     
    6871        return;
    6972
    70     // Pan smoothly from left to right with azimuth going from -30 -> +30 degrees.
    71     double desiredPanPosition;
    72     if (azimuth > 30.0)
    73         desiredPanPosition = 1.0;
    74     else if (azimuth < -30.0)
    75         desiredPanPosition = 0.0;
    76     else
    77         desiredPanPosition = (azimuth + 30.0) / 60.0;
     73    // Clamp azimuth to allowed range of -180 -> +180.
     74    azimuth = max(-180.0, azimuth);
     75    azimuth = min(180.0, azimuth);
     76   
     77    // Alias the azimuth ranges behind us to in front of us:
     78    // -90 -> -180 to -90 -> 0 and 90 -> 180 to 90 -> 0
     79    if (azimuth < -90)
     80        azimuth = -180 - azimuth;
     81    else if (azimuth > 90)
     82        azimuth = 180 - azimuth;
     83   
     84    // Pan smoothly from left to right with azimuth going from -90 -> +90 degrees.
     85    double desiredPanPosition = (azimuth + 90) / 180;
    7886
    7987    double desiredGainL = 0.5 * cos(piDouble * desiredPanPosition) + 0.5;
Note: See TracChangeset for help on using the changeset viewer.