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