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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 } | 555 } |
556 | 556 |
557 double AudioBufferSourceHandler::computePlaybackRate() { | 557 double AudioBufferSourceHandler::computePlaybackRate() { |
558 // Incorporate buffer's sample-rate versus BaseAudioContext's sample-rate. | 558 // Incorporate buffer's sample-rate versus BaseAudioContext's sample-rate. |
559 // Normally it's not an issue because buffers are loaded at the | 559 // Normally it's not an issue because buffers are loaded at the |
560 // BaseAudioContext's sample-rate, but we can handle it in any case. | 560 // BaseAudioContext's sample-rate, but we can handle it in any case. |
561 double sampleRateFactor = 1.0; | 561 double sampleRateFactor = 1.0; |
562 if (buffer()) { | 562 if (buffer()) { |
563 // Use doubles to compute this to full accuracy. | 563 // Use doubles to compute this to full accuracy. |
564 sampleRateFactor = | 564 sampleRateFactor = |
565 buffer()->sampleRate() / static_cast<double>(sampleRate()); | 565 buffer()->sampleRate() / static_cast<double>(context()->sampleRate()); |
566 } | 566 } |
567 | 567 |
568 // Use finalValue() to incorporate changes of AudioParamTimeline and | 568 // Use finalValue() to incorporate changes of AudioParamTimeline and |
569 // AudioSummingJunction from m_playbackRate AudioParam. | 569 // AudioSummingJunction from m_playbackRate AudioParam. |
570 double basePlaybackRate = m_playbackRate->finalValue(); | 570 double basePlaybackRate = m_playbackRate->finalValue(); |
571 | 571 |
572 double finalPlaybackRate = sampleRateFactor * basePlaybackRate; | 572 double finalPlaybackRate = sampleRateFactor * basePlaybackRate; |
573 | 573 |
574 // Take the detune value into account for the final playback rate. | 574 // Take the detune value into account for the final playback rate. |
575 finalPlaybackRate *= pow(2, m_detune->finalValue() / 1200); | 575 finalPlaybackRate *= pow(2, m_detune->finalValue() / 1200); |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 | 755 |
756 void AudioBufferSourceNode::start(double when, | 756 void AudioBufferSourceNode::start(double when, |
757 double grainOffset, | 757 double grainOffset, |
758 double grainDuration, | 758 double grainDuration, |
759 ExceptionState& exceptionState) { | 759 ExceptionState& exceptionState) { |
760 audioBufferSourceHandler().start(when, grainOffset, grainDuration, | 760 audioBufferSourceHandler().start(when, grainOffset, grainDuration, |
761 exceptionState); | 761 exceptionState); |
762 } | 762 } |
763 | 763 |
764 } // namespace blink | 764 } // namespace blink |
OLD | NEW |