Chromium Code Reviews| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 | 43 |
| 44 namespace WebCore { | 44 namespace WebCore { |
| 45 | 45 |
| 46 const double DefaultGrainDuration = 0.020; // 20ms | 46 const double DefaultGrainDuration = 0.020; // 20ms |
| 47 | 47 |
| 48 // Arbitrary upper limit on playback rate. | 48 // Arbitrary upper limit on playback rate. |
| 49 // Higher than expected rates can be useful when playing back oversampled buffer s | 49 // Higher than expected rates can be useful when playing back oversampled buffer s |
| 50 // to minimize linear interpolation aliasing. | 50 // to minimize linear interpolation aliasing. |
| 51 const double MaxRate = 1024; | 51 const double MaxRate = 1024; |
| 52 | 52 |
| 53 PassRefPtr<AudioBufferSourceNode> AudioBufferSourceNode::create(AudioContext* co ntext, float sampleRate) | 53 PassRefPtrWillBeRawPtr<AudioBufferSourceNode> AudioBufferSourceNode::create(Audi oContext* context, float sampleRate) |
| 54 { | 54 { |
| 55 return adoptRef(new AudioBufferSourceNode(context, sampleRate)); | 55 return adoptRefWillBeNoop(new AudioBufferSourceNode(context, sampleRate)); |
| 56 } | 56 } |
| 57 | 57 |
| 58 AudioBufferSourceNode::AudioBufferSourceNode(AudioContext* context, float sample Rate) | 58 AudioBufferSourceNode::AudioBufferSourceNode(AudioContext* context, float sample Rate) |
| 59 : AudioScheduledSourceNode(context, sampleRate) | 59 : AudioScheduledSourceNode(context, sampleRate) |
| 60 , m_buffer(nullptr) | 60 , m_buffer(nullptr) |
| 61 , m_isLooping(false) | 61 , m_isLooping(false) |
| 62 , m_loopStart(0) | 62 , m_loopStart(0) |
| 63 , m_loopEnd(0) | 63 , m_loopEnd(0) |
| 64 , m_virtualReadIndex(0) | 64 , m_virtualReadIndex(0) |
| 65 , m_isGrain(false) | 65 , m_isGrain(false) |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 473 if (m_pannerNode != pannerNode && !hasFinished()) { | 473 if (m_pannerNode != pannerNode && !hasFinished()) { |
| 474 if (pannerNode) | 474 if (pannerNode) |
| 475 pannerNode->ref(AudioNode::RefTypeConnection); | 475 pannerNode->ref(AudioNode::RefTypeConnection); |
| 476 if (m_pannerNode) | 476 if (m_pannerNode) |
| 477 m_pannerNode->deref(AudioNode::RefTypeConnection); | 477 m_pannerNode->deref(AudioNode::RefTypeConnection); |
| 478 | 478 |
| 479 m_pannerNode = pannerNode; | 479 m_pannerNode = pannerNode; |
| 480 } | 480 } |
| 481 } | 481 } |
| 482 | 482 |
| 483 void AudioBufferSourceNode::clearPannerNode() | 483 void AudioBufferSourceNode::clearPannerNode() |
|
haraken
2014/03/27 11:44:05
If you move m_pannerNode to RawPtrWillBeMember<>,
| |
| 484 { | 484 { |
| 485 if (m_pannerNode) { | 485 if (m_pannerNode) { |
| 486 m_pannerNode->deref(AudioNode::RefTypeConnection); | 486 m_pannerNode->deref(AudioNode::RefTypeConnection); |
| 487 m_pannerNode = 0; | 487 m_pannerNode = 0; |
| 488 } | 488 } |
| 489 } | 489 } |
| 490 | 490 |
| 491 void AudioBufferSourceNode::finish() | 491 void AudioBufferSourceNode::finish() |
| 492 { | 492 { |
| 493 clearPannerNode(); | 493 clearPannerNode(); |
| 494 ASSERT(!m_pannerNode); | 494 ASSERT(!m_pannerNode); |
| 495 AudioScheduledSourceNode::finish(); | 495 AudioScheduledSourceNode::finish(); |
| 496 } | 496 } |
| 497 | 497 |
| 498 void AudioBufferSourceNode::trace(Visitor* visitor) | |
| 499 { | |
| 500 visitor->trace(m_buffer); | |
| 501 visitor->trace(m_gain); | |
| 502 visitor->trace(m_playbackRate); | |
| 503 AudioNode::trace(visitor); | |
|
haraken
2014/03/27 11:44:05
AudioScheduledSourceNode::trace(visitor) ?
keishi
2014/04/03 06:53:19
Done.
| |
| 504 } | |
| 505 | |
| 498 } // namespace WebCore | 506 } // namespace WebCore |
| 499 | 507 |
| 500 #endif // ENABLE(WEB_AUDIO) | 508 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |