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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 MutexLocker processLocker(m_processLock); | 399 MutexLocker processLocker(m_processLock); |
400 | 400 |
401 if (buffer) { | 401 if (buffer) { |
402 // Do any necesssary re-configuration to the buffer's number of channels. | 402 // Do any necesssary re-configuration to the buffer's number of channels. |
403 unsigned numberOfChannels = buffer->numberOfChannels(); | 403 unsigned numberOfChannels = buffer->numberOfChannels(); |
404 | 404 |
405 // This should not be possible since AudioBuffers can't be created with too | 405 // This should not be possible since AudioBuffers can't be created with too |
406 // many channels either. | 406 // many channels either. |
407 if (numberOfChannels > BaseAudioContext::maxNumberOfChannels()) { | 407 if (numberOfChannels > BaseAudioContext::maxNumberOfChannels()) { |
408 exceptionState.throwDOMException( | 408 exceptionState.throwDOMException( |
409 NotSupportedError, ExceptionMessages::indexOutsideRange( | 409 NotSupportedError, |
410 "number of input channels", numberOfChannels, | 410 ExceptionMessages::indexOutsideRange( |
411 1u, ExceptionMessages::InclusiveBound, | 411 "number of input channels", numberOfChannels, 1u, |
412 BaseAudioContext::maxNumberOfChannels(), | 412 ExceptionMessages::InclusiveBound, |
413 ExceptionMessages::InclusiveBound)); | 413 BaseAudioContext::maxNumberOfChannels(), |
| 414 ExceptionMessages::InclusiveBound)); |
414 return; | 415 return; |
415 } | 416 } |
416 | 417 |
417 output(0).setNumberOfChannels(numberOfChannels); | 418 output(0).setNumberOfChannels(numberOfChannels); |
418 | 419 |
419 m_sourceChannels = wrapArrayUnique(new const float*[numberOfChannels]); | 420 m_sourceChannels = wrapArrayUnique(new const float*[numberOfChannels]); |
420 m_destinationChannels = wrapArrayUnique(new float*[numberOfChannels]); | 421 m_destinationChannels = wrapArrayUnique(new float*[numberOfChannels]); |
421 | 422 |
422 for (unsigned i = 0; i < numberOfChannels; ++i) | 423 for (unsigned i = 0; i < numberOfChannels; ++i) |
423 m_sourceChannels[i] = buffer->getChannelData(i)->data(); | 424 m_sourceChannels[i] = buffer->getChannelData(i)->data(); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
510 | 511 |
511 if (when < 0) { | 512 if (when < 0) { |
512 exceptionState.throwDOMException( | 513 exceptionState.throwDOMException( |
513 InvalidStateError, | 514 InvalidStateError, |
514 ExceptionMessages::indexExceedsMinimumBound("start time", when, 0.0)); | 515 ExceptionMessages::indexExceedsMinimumBound("start time", when, 0.0)); |
515 return; | 516 return; |
516 } | 517 } |
517 | 518 |
518 if (grainOffset < 0) { | 519 if (grainOffset < 0) { |
519 exceptionState.throwDOMException( | 520 exceptionState.throwDOMException( |
520 InvalidStateError, ExceptionMessages::indexExceedsMinimumBound( | 521 InvalidStateError, |
521 "offset", grainOffset, 0.0)); | 522 ExceptionMessages::indexExceedsMinimumBound("offset", grainOffset, |
| 523 0.0)); |
522 return; | 524 return; |
523 } | 525 } |
524 | 526 |
525 if (grainDuration < 0) { | 527 if (grainDuration < 0) { |
526 exceptionState.throwDOMException( | 528 exceptionState.throwDOMException( |
527 InvalidStateError, ExceptionMessages::indexExceedsMinimumBound( | 529 InvalidStateError, |
528 "duration", grainDuration, 0.0)); | 530 ExceptionMessages::indexExceedsMinimumBound("duration", grainDuration, |
| 531 0.0)); |
529 return; | 532 return; |
530 } | 533 } |
531 | 534 |
532 // The node is started. Add a reference to keep us alive so that audio | 535 // The node is started. Add a reference to keep us alive so that audio |
533 // will eventually get played even if Javascript should drop all references | 536 // will eventually get played even if Javascript should drop all references |
534 // to this node. The reference will get dropped when the source has finished | 537 // to this node. The reference will get dropped when the source has finished |
535 // playing. | 538 // playing. |
536 context()->notifySourceNodeStartedProcessing(node()); | 539 context()->notifySourceNodeStartedProcessing(node()); |
537 | 540 |
538 // This synchronizes with process(). updateSchedulingInfo will read some of | 541 // This synchronizes with process(). updateSchedulingInfo will read some of |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 | 758 |
756 void AudioBufferSourceNode::start(double when, | 759 void AudioBufferSourceNode::start(double when, |
757 double grainOffset, | 760 double grainOffset, |
758 double grainDuration, | 761 double grainDuration, |
759 ExceptionState& exceptionState) { | 762 ExceptionState& exceptionState) { |
760 audioBufferSourceHandler().start(when, grainOffset, grainDuration, | 763 audioBufferSourceHandler().start(when, grainOffset, grainDuration, |
761 exceptionState); | 764 exceptionState); |
762 } | 765 } |
763 | 766 |
764 } // namespace blink | 767 } // namespace blink |
OLD | NEW |