<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>78386</bug_id>
          
          <creation_ts>2012-02-10 14:03:34 -0800</creation_ts>
          <short_desc>Round off error in setValueCurveAtTime</short_desc>
          <delta_ts>2012-03-02 09:58:02 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Web Audio</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>77666</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Raymond Toy">rtoy</reporter>
          <assigned_to name="Raymond Toy">rtoy</assigned_to>
          <cc>crogers</cc>
    
    <cc>rtoy</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>554372</commentid>
    <comment_count>0</comment_count>
    <who name="Raymond Toy">rtoy</who>
    <bug_when>2012-02-10 14:03:34 -0800</bug_when>
    <thetext>There is a round-off error in setValueCurveAtTime.  When calling setValueCurveAtTime(curve, 0.0, 0.3) with a sample rate of 44100 and the curve data being sample-frame spaced of exactly the right length, the output has one sample duplicated, causing the rest of the values to be shifted.

This is caused by a roundoff error at the line:

   unsigned curveIndex = static_cast&lt;unsigned&gt;(curveVirtualIndex);

In this particular example, curveVirtualIndex = 895.9999 instead of 896 due to roundoff.  The curveIndex is set to 895 which causes curve[895] to be output.  But it was already output the previous time, so the output is duplicated and the output has the curve values shifted by one.

Rounding curveVirtualIndex instead of truncating fixes this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>561226</commentid>
    <comment_count>1</comment_count>
    <who name="Raymond Toy">rtoy</who>
    <bug_when>2012-02-21 14:22:31 -0800</bug_when>
    <thetext>It might be easiest to fix this in bug 77666, which is how this error was found.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>569720</commentid>
    <comment_count>2</comment_count>
    <who name="Raymond Toy">rtoy</who>
    <bug_when>2012-03-02 09:58:02 -0800</bug_when>
    <thetext>This was fixed in bug 77666.  Closing this out now.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>