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

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

Issue 270103005: Tried to move AudioSummingJuction to oilpan (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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/OscillatorNode.h ('k') | Source/modules/webaudio/PannerNode.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) 2012, Google Inc. All rights reserved. 2 * Copyright (C) 2012, 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 25 matching lines...) Expand all
36 #include "wtf/MathExtras.h" 36 #include "wtf/MathExtras.h"
37 #include "wtf/StdLibExtras.h" 37 #include "wtf/StdLibExtras.h"
38 #include <algorithm> 38 #include <algorithm>
39 39
40 using namespace std; 40 using namespace std;
41 41
42 namespace WebCore { 42 namespace WebCore {
43 43
44 using namespace VectorMath; 44 using namespace VectorMath;
45 45
46 PassRefPtr<OscillatorNode> OscillatorNode::create(AudioContext* context, float s ampleRate) 46 PassRefPtrWillBeRawPtr<OscillatorNode> OscillatorNode::create(AudioContext* cont ext, float sampleRate)
47 { 47 {
48 return adoptRef(new OscillatorNode(context, sampleRate)); 48 return adoptRefWillBeNoop(new OscillatorNode(context, sampleRate));
49 } 49 }
50 50
51 OscillatorNode::OscillatorNode(AudioContext* context, float sampleRate) 51 OscillatorNode::OscillatorNode(AudioContext* context, float sampleRate)
52 : AudioScheduledSourceNode(context, sampleRate) 52 : AudioScheduledSourceNode(context, sampleRate)
53 , m_type(SINE) 53 , m_type(SINE)
54 , m_firstRender(true) 54 , m_firstRender(true)
55 , m_virtualReadIndex(0) 55 , m_virtualReadIndex(0)
56 , m_phaseIncrements(AudioNode::ProcessingSizeInFrames) 56 , m_phaseIncrements(AudioNode::ProcessingSizeInFrames)
57 , m_detuneValues(AudioNode::ProcessingSizeInFrames) 57 , m_detuneValues(AudioNode::ProcessingSizeInFrames)
58 { 58 {
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 setType(TRIANGLE); 109 setType(TRIANGLE);
110 } 110 }
111 111
112 bool OscillatorNode::setType(unsigned type) 112 bool OscillatorNode::setType(unsigned type)
113 { 113 {
114 PeriodicWave* periodicWave = 0; 114 PeriodicWave* periodicWave = 0;
115 float sampleRate = this->sampleRate(); 115 float sampleRate = this->sampleRate();
116 116
117 switch (type) { 117 switch (type) {
118 case SINE: { 118 case SINE: {
119 DEFINE_STATIC_REF(PeriodicWave, periodicWaveSine, (PeriodicWave::createS ine(sampleRate))); 119 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(PeriodicWave, periodicWaveSine, (Pe riodicWave::createSine(sampleRate)));
120 periodicWave = periodicWaveSine; 120 periodicWave = periodicWaveSine;
121 break; 121 break;
122 } 122 }
123 case SQUARE: { 123 case SQUARE: {
124 DEFINE_STATIC_REF(PeriodicWave, periodicWaveSquare, (PeriodicWave::creat eSquare(sampleRate))); 124 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(PeriodicWave, periodicWaveSquare, ( PeriodicWave::createSquare(sampleRate)));
125 periodicWave = periodicWaveSquare; 125 periodicWave = periodicWaveSquare;
126 break; 126 break;
127 } 127 }
128 case SAWTOOTH: { 128 case SAWTOOTH: {
129 DEFINE_STATIC_REF(PeriodicWave, periodicWaveSawtooth, (PeriodicWave::cre ateSawtooth(sampleRate))); 129 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(PeriodicWave, periodicWaveSawtooth, (PeriodicWave::createSawtooth(sampleRate)));
130 periodicWave = periodicWaveSawtooth; 130 periodicWave = periodicWaveSawtooth;
131 break; 131 break;
132 } 132 }
133 case TRIANGLE: { 133 case TRIANGLE: {
134 DEFINE_STATIC_REF(PeriodicWave, periodicWaveTriangle, (PeriodicWave::cre ateTriangle(sampleRate))); 134 DEFINE_STATIC_REF_WILL_BE_PERSISTENT(PeriodicWave, periodicWaveTriangle, (PeriodicWave::createTriangle(sampleRate)));
135 periodicWave = periodicWaveTriangle; 135 periodicWave = periodicWaveTriangle;
136 break; 136 break;
137 } 137 }
138 case CUSTOM: 138 case CUSTOM:
139 default: 139 default:
140 // Return error for invalid types, including CUSTOM since setPeriodicWav e() method must be 140 // Return error for invalid types, including CUSTOM since setPeriodicWav e() method must be
141 // called explicitly. 141 // called explicitly.
142 return false; 142 return false;
143 } 143 }
144 144
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 MutexLocker processLocker(m_processLock); 334 MutexLocker processLocker(m_processLock);
335 m_periodicWave = periodicWave; 335 m_periodicWave = periodicWave;
336 m_type = CUSTOM; 336 m_type = CUSTOM;
337 } 337 }
338 338
339 bool OscillatorNode::propagatesSilence() const 339 bool OscillatorNode::propagatesSilence() const
340 { 340 {
341 return !isPlayingOrScheduled() || hasFinished() || !m_periodicWave.get(); 341 return !isPlayingOrScheduled() || hasFinished() || !m_periodicWave.get();
342 } 342 }
343 343
344 void OscillatorNode::trace(Visitor* visitor)
345 {
346 visitor->trace(m_frequency);
347 visitor->trace(m_detune);
348 visitor->trace(m_periodicWave);
349 AudioScheduledSourceNode::trace(visitor);
350 }
351
344 } // namespace WebCore 352 } // namespace WebCore
345 353
346 #endif // ENABLE(WEB_AUDIO) 354 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/modules/webaudio/OscillatorNode.h ('k') | Source/modules/webaudio/PannerNode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698