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 29 matching lines...) Expand all Loading... | |
| 40 | 40 |
| 41 namespace blink { | 41 namespace blink { |
| 42 | 42 |
| 43 const double DefaultGrainDuration = 0.020; // 20ms | 43 const double DefaultGrainDuration = 0.020; // 20ms |
| 44 | 44 |
| 45 // Arbitrary upper limit on playback rate. | 45 // Arbitrary upper limit on playback rate. |
| 46 // Higher than expected rates can be useful when playing back oversampled buffer s | 46 // Higher than expected rates can be useful when playing back oversampled buffer s |
| 47 // to minimize linear interpolation aliasing. | 47 // to minimize linear interpolation aliasing. |
| 48 const double MaxRate = 1024; | 48 const double MaxRate = 1024; |
| 49 | 49 |
| 50 PassRefPtrWillBeRawPtr<AudioBufferSourceNode> AudioBufferSourceNode::create(Audi oContext* context, float sampleRate) | 50 AudioBufferSourceNode* AudioBufferSourceNode::create(AudioContext* context, floa t sampleRate) |
| 51 { | 51 { |
| 52 return adoptRefWillBeNoop(new AudioBufferSourceNode(context, sampleRate)); | 52 return adoptRefCountedGarbageCollected(new AudioBufferSourceNode(context, sa mpleRate)); |
|
tkent
2014/08/18 04:18:24
adoptRefCountedGarbageCollected should be adoptRef
haraken
2014/08/18 05:09:40
Done.
| |
| 53 } | 53 } |
| 54 | 54 |
| 55 AudioBufferSourceNode::AudioBufferSourceNode(AudioContext* context, float sample Rate) | 55 AudioBufferSourceNode::AudioBufferSourceNode(AudioContext* context, float sample Rate) |
| 56 : AudioScheduledSourceNode(context, sampleRate) | 56 : AudioScheduledSourceNode(context, sampleRate) |
| 57 , m_buffer(nullptr) | 57 , m_buffer(nullptr) |
| 58 , m_isLooping(false) | 58 , m_isLooping(false) |
| 59 , m_loopStart(0) | 59 , m_loopStart(0) |
| 60 , m_loopEnd(0) | 60 , m_loopEnd(0) |
| 61 , m_virtualReadIndex(0) | 61 , m_virtualReadIndex(0) |
| 62 , m_isGrain(false) | 62 , m_isGrain(false) |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 448 } | 448 } |
| 449 | 449 |
| 450 bool AudioBufferSourceNode::propagatesSilence() const | 450 bool AudioBufferSourceNode::propagatesSilence() const |
| 451 { | 451 { |
| 452 return !isPlayingOrScheduled() || hasFinished() || !m_buffer; | 452 return !isPlayingOrScheduled() || hasFinished() || !m_buffer; |
| 453 } | 453 } |
| 454 | 454 |
| 455 void AudioBufferSourceNode::setPannerNode(PannerNode* pannerNode) | 455 void AudioBufferSourceNode::setPannerNode(PannerNode* pannerNode) |
| 456 { | 456 { |
| 457 if (m_pannerNode != pannerNode && !hasFinished()) { | 457 if (m_pannerNode != pannerNode && !hasFinished()) { |
| 458 RefPtrWillBeRawPtr<PannerNode> oldPannerNode(m_pannerNode.release()); | 458 PannerNode* oldPannerNode(m_pannerNode.release()); |
| 459 m_pannerNode = pannerNode; | 459 m_pannerNode = pannerNode; |
| 460 if (pannerNode) | 460 if (pannerNode) |
| 461 pannerNode->makeConnection(); | 461 pannerNode->makeConnection(); |
| 462 if (oldPannerNode) | 462 if (oldPannerNode) |
| 463 oldPannerNode->breakConnection(); | 463 oldPannerNode->breakConnection(); |
| 464 } | 464 } |
| 465 } | 465 } |
| 466 | 466 |
| 467 void AudioBufferSourceNode::clearPannerNode() | 467 void AudioBufferSourceNode::clearPannerNode() |
| 468 { | 468 { |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 483 { | 483 { |
| 484 visitor->trace(m_buffer); | 484 visitor->trace(m_buffer); |
| 485 visitor->trace(m_playbackRate); | 485 visitor->trace(m_playbackRate); |
| 486 visitor->trace(m_pannerNode); | 486 visitor->trace(m_pannerNode); |
| 487 AudioScheduledSourceNode::trace(visitor); | 487 AudioScheduledSourceNode::trace(visitor); |
| 488 } | 488 } |
| 489 | 489 |
| 490 } // namespace blink | 490 } // namespace blink |
| 491 | 491 |
| 492 #endif // ENABLE(WEB_AUDIO) | 492 #endif // ENABLE(WEB_AUDIO) |
| OLD | NEW |