Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(71)

Side by Side Diff: Source/modules/webaudio/AudioBufferSourceNode.cpp

Issue 349213007: WebAudio: Remove AudioNode::RefType. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix webaudio/delaynode-max-nondefault-delay.html Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/modules/webaudio/AudioBufferSourceNode.h ('k') | Source/modules/webaudio/AudioContext.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
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)
63 , m_grainOffset(0.0) 63 , m_grainOffset(0.0)
64 , m_grainDuration(DefaultGrainDuration) 64 , m_grainDuration(DefaultGrainDuration)
65 , m_pannerNode(0)
66 { 65 {
67 ScriptWrappable::init(this); 66 ScriptWrappable::init(this);
68 setNodeType(NodeTypeAudioBufferSource); 67 setNodeType(NodeTypeAudioBufferSource);
69 68
70 m_playbackRate = AudioParam::create(context, "playbackRate", 1.0, 0.0, MaxRa te); 69 m_playbackRate = AudioParam::create(context, "playbackRate", 1.0, 0.0, MaxRa te);
71 70
72 // Default to mono. A call to setBuffer() will set the number of output 71 // Default to mono. A call to setBuffer() will set the number of output
73 // channels to that of the buffer. 72 // channels to that of the buffer.
74 addOutput(AudioNodeOutput::create(this, 1)); 73 addOutput(AudioNodeOutput::create(this, 1));
75 74
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 } 442 }
444 443
445 bool AudioBufferSourceNode::propagatesSilence() const 444 bool AudioBufferSourceNode::propagatesSilence() const
446 { 445 {
447 return !isPlayingOrScheduled() || hasFinished() || !m_buffer; 446 return !isPlayingOrScheduled() || hasFinished() || !m_buffer;
448 } 447 }
449 448
450 void AudioBufferSourceNode::setPannerNode(PannerNode* pannerNode) 449 void AudioBufferSourceNode::setPannerNode(PannerNode* pannerNode)
451 { 450 {
452 if (m_pannerNode != pannerNode && !hasFinished()) { 451 if (m_pannerNode != pannerNode && !hasFinished()) {
452 RefPtr<PannerNode> oldPannerNode(m_pannerNode.release());
453 m_pannerNode = pannerNode;
453 if (pannerNode) 454 if (pannerNode)
454 pannerNode->ref(AudioNode::RefTypeConnection); 455 pannerNode->makeConnection();
455 if (m_pannerNode) 456 if (oldPannerNode)
456 m_pannerNode->deref(AudioNode::RefTypeConnection); 457 oldPannerNode->breakConnection();
457
458 m_pannerNode = pannerNode;
459 } 458 }
460 } 459 }
461 460
462 void AudioBufferSourceNode::clearPannerNode() 461 void AudioBufferSourceNode::clearPannerNode()
463 { 462 {
464 if (m_pannerNode) { 463 if (m_pannerNode) {
465 m_pannerNode->deref(AudioNode::RefTypeConnection); 464 m_pannerNode->breakConnection();
466 m_pannerNode = 0; 465 m_pannerNode.clear();
467 } 466 }
468 } 467 }
469 468
470 void AudioBufferSourceNode::finish() 469 void AudioBufferSourceNode::finish()
471 { 470 {
472 clearPannerNode(); 471 clearPannerNode();
473 ASSERT(!m_pannerNode); 472 ASSERT(!m_pannerNode);
474 AudioScheduledSourceNode::finish(); 473 AudioScheduledSourceNode::finish();
475 } 474 }
476 475
477 void AudioBufferSourceNode::trace(Visitor* visitor) 476 void AudioBufferSourceNode::trace(Visitor* visitor)
478 { 477 {
479 visitor->trace(m_buffer); 478 visitor->trace(m_buffer);
480 visitor->trace(m_playbackRate); 479 visitor->trace(m_playbackRate);
481 AudioScheduledSourceNode::trace(visitor); 480 AudioScheduledSourceNode::trace(visitor);
482 } 481 }
483 482
484 } // namespace WebCore 483 } // namespace WebCore
485 484
486 #endif // ENABLE(WEB_AUDIO) 485 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/modules/webaudio/AudioBufferSourceNode.h ('k') | Source/modules/webaudio/AudioContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698