OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 ExceptionState& exceptionState) { | 460 ExceptionState& exceptionState) { |
461 warnIfOutsideRange("setTargetAtTime value", target); | 461 warnIfOutsideRange("setTargetAtTime value", target); |
462 handler().timeline().setTargetAtTime(target, time, timeConstant, | 462 handler().timeline().setTargetAtTime(target, time, timeConstant, |
463 exceptionState); | 463 exceptionState); |
464 | 464 |
465 // Don't update the histogram here. It's not clear in normal usage if the | 465 // Don't update the histogram here. It's not clear in normal usage if the |
466 // parameter value will actually reach |target|. | 466 // parameter value will actually reach |target|. |
467 return this; | 467 return this; |
468 } | 468 } |
469 | 469 |
470 AudioParam* AudioParam::setValueCurveAtTime(DOMFloat32Array* curve, | 470 AudioParam* AudioParam::setValueCurveAtTime( |
471 double time, | 471 const NotShared<DOMFloat32Array>& curve, |
472 double duration, | 472 double time, |
473 ExceptionState& exceptionState) { | 473 double duration, |
474 float* curveData = curve->data(); | 474 ExceptionState& exceptionState) { |
| 475 float* curveData = curve.view()->data(); |
475 float min = minValue(); | 476 float min = minValue(); |
476 float max = maxValue(); | 477 float max = maxValue(); |
477 | 478 |
478 // First, find any non-finite value in the curve and throw an exception if | 479 // First, find any non-finite value in the curve and throw an exception if |
479 // there are any. | 480 // there are any. |
480 for (unsigned k = 0; k < curve->length(); ++k) { | 481 for (unsigned k = 0; k < curve.view()->length(); ++k) { |
481 float value = curveData[k]; | 482 float value = curveData[k]; |
482 | 483 |
483 if (!std::isfinite(value)) { | 484 if (!std::isfinite(value)) { |
484 exceptionState.throwDOMException( | 485 exceptionState.throwDOMException( |
485 V8TypeError, "The provided float value for the curve at element " + | 486 V8TypeError, "The provided float value for the curve at element " + |
486 String::number(k) + " is non-finite: " + | 487 String::number(k) + " is non-finite: " + |
487 String::number(value)); | 488 String::number(value)); |
488 return nullptr; | 489 return nullptr; |
489 } | 490 } |
490 } | 491 } |
491 | 492 |
492 // Second, find the first value in the curve (if any) that is outside the | 493 // Second, find the first value in the curve (if any) that is outside the |
493 // nominal range. It's probably not necessary to produce a warning on every | 494 // nominal range. It's probably not necessary to produce a warning on every |
494 // value outside the nominal range. | 495 // value outside the nominal range. |
495 for (unsigned k = 0; k < curve->length(); ++k) { | 496 for (unsigned k = 0; k < curve.view()->length(); ++k) { |
496 float value = curveData[k]; | 497 float value = curveData[k]; |
497 | 498 |
498 if (value < min || value > max) { | 499 if (value < min || value > max) { |
499 warnIfOutsideRange("setValueCurveAtTime value", value); | 500 warnIfOutsideRange("setValueCurveAtTime value", value); |
500 break; | 501 break; |
501 } | 502 } |
502 } | 503 } |
503 | 504 |
504 handler().timeline().setValueCurveAtTime(curve, time, duration, | 505 handler().timeline().setValueCurveAtTime(curve.view(), time, duration, |
505 exceptionState); | 506 exceptionState); |
506 | 507 |
507 // We could update the histogram with every value in the curve, due to | 508 // We could update the histogram with every value in the curve, due to |
508 // interpolation, we'll probably be missing many values. So we don't update | 509 // interpolation, we'll probably be missing many values. So we don't update |
509 // the histogram. setValueCurveAtTime is probably a fairly rare method | 510 // the histogram. setValueCurveAtTime is probably a fairly rare method |
510 // anyway. | 511 // anyway. |
511 return this; | 512 return this; |
512 } | 513 } |
513 | 514 |
514 AudioParam* AudioParam::cancelScheduledValues(double startTime, | 515 AudioParam* AudioParam::cancelScheduledValues(double startTime, |
515 ExceptionState& exceptionState) { | 516 ExceptionState& exceptionState) { |
516 handler().timeline().cancelScheduledValues(startTime, exceptionState); | 517 handler().timeline().cancelScheduledValues(startTime, exceptionState); |
517 return this; | 518 return this; |
518 } | 519 } |
519 | 520 |
520 AudioParam* AudioParam::cancelAndHoldAtTime(double startTime, | 521 AudioParam* AudioParam::cancelAndHoldAtTime(double startTime, |
521 ExceptionState& exceptionState) { | 522 ExceptionState& exceptionState) { |
522 handler().timeline().cancelAndHoldAtTime(startTime, exceptionState); | 523 handler().timeline().cancelAndHoldAtTime(startTime, exceptionState); |
523 return this; | 524 return this; |
524 } | 525 } |
525 | 526 |
526 } // namespace blink | 527 } // namespace blink |
OLD | NEW |