| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 445 for (; writeIndex < fillToFrame; ++writeIndex) | 445 for (; writeIndex < fillToFrame; ++writeIndex) |
| 446 values[writeIndex] = value; | 446 values[writeIndex] = value; |
| 447 break; | 447 break; |
| 448 } | 448 } |
| 449 | 449 |
| 450 // Save old values and recalculate information based on the
curve's duration | 450 // Save old values and recalculate information based on the
curve's duration |
| 451 // instead of the next event time. | 451 // instead of the next event time. |
| 452 unsigned nextEventFillToFrame = fillToFrame; | 452 unsigned nextEventFillToFrame = fillToFrame; |
| 453 double nextEventFillToTime = fillToTime; | 453 double nextEventFillToTime = fillToTime; |
| 454 fillToTime = std::min(endTime, time1 + duration); | 454 fillToTime = std::min(endTime, time1 + duration); |
| 455 // |fillToTime| can be greater than |startTime| when the end
of the | 455 // |fillToTime| can be less than |startTime| when the end of
the |
| 456 // setValueCurve automation has been reached, but the next a
utomation has not | 456 // setValueCurve automation has been reached, but the next a
utomation has not |
| 457 // yet started. In this case, |fillToTime| is clipped to |ti
me1|+|duration| | 457 // yet started. In this case, |fillToTime| is clipped to |ti
me1|+|duration| |
| 458 // above, but |startTime| will keep increasing (because the
current time is | 458 // above, but |startTime| will keep increasing (because the
current time is |
| 459 // increasing). | 459 // increasing). |
| 460 fillToFrame = AudioUtilities::timeToSampleFrame(std::max(0.0
, fillToTime - startTime), sampleRate); | 460 fillToFrame = AudioUtilities::timeToSampleFrame(std::max(0.0
, fillToTime - startTime), sampleRate); |
| 461 fillToFrame = std::min(fillToFrame, numberOfValues); | 461 fillToFrame = std::min(fillToFrame, numberOfValues); |
| 462 | 462 |
| 463 // Index into the curve data using a floating-point value. | 463 // Index into the curve data using a floating-point value. |
| 464 // We're scaling the number of curve points by the duration
(see curvePointsPerFrame). | 464 // We're scaling the number of curve points by the duration
(see curvePointsPerFrame). |
| 465 double curveVirtualIndex = 0; | 465 double curveVirtualIndex = 0; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 // to the end of the values buffer. | 524 // to the end of the values buffer. |
| 525 for (; writeIndex < numberOfValues; ++writeIndex) | 525 for (; writeIndex < numberOfValues; ++writeIndex) |
| 526 values[writeIndex] = value; | 526 values[writeIndex] = value; |
| 527 | 527 |
| 528 return value; | 528 return value; |
| 529 } | 529 } |
| 530 | 530 |
| 531 } // namespace blink | 531 } // namespace blink |
| 532 | 532 |
| 533 #endif // ENABLE(WEB_AUDIO) | 533 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |