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