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

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

Issue 1214463003: Split "Online" and "Offline" AudioContext processing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Bring to ToT Created 5 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/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 11 matching lines...) Expand all
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 */ 23 */
24 24
25 #include "config.h" 25 #include "config.h"
26 #if ENABLE(WEB_AUDIO) 26 #if ENABLE(WEB_AUDIO)
27 #include "modules/webaudio/OscillatorNode.h" 27 #include "modules/webaudio/OscillatorNode.h"
28 28
29 #include "bindings/core/v8/ExceptionMessages.h" 29 #include "bindings/core/v8/ExceptionMessages.h"
30 #include "bindings/core/v8/ExceptionState.h" 30 #include "bindings/core/v8/ExceptionState.h"
31 #include "core/dom/ExceptionCode.h" 31 #include "core/dom/ExceptionCode.h"
32 #include "modules/webaudio/AudioContext.h"
33 #include "modules/webaudio/AudioNodeOutput.h" 32 #include "modules/webaudio/AudioNodeOutput.h"
34 #include "modules/webaudio/PeriodicWave.h" 33 #include "modules/webaudio/PeriodicWave.h"
35 #include "platform/audio/AudioUtilities.h" 34 #include "platform/audio/AudioUtilities.h"
36 #include "platform/audio/VectorMath.h" 35 #include "platform/audio/VectorMath.h"
37 #include "wtf/MathExtras.h" 36 #include "wtf/MathExtras.h"
38 #include "wtf/StdLibExtras.h" 37 #include "wtf/StdLibExtras.h"
39 #include <algorithm> 38 #include <algorithm>
40 39
41 namespace blink { 40 namespace blink {
42 41
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 m_type = CUSTOM; 334 m_type = CUSTOM;
336 } 335 }
337 336
338 bool OscillatorHandler::propagatesSilence() const 337 bool OscillatorHandler::propagatesSilence() const
339 { 338 {
340 return !isPlayingOrScheduled() || hasFinished() || !m_periodicWave.get(); 339 return !isPlayingOrScheduled() || hasFinished() || !m_periodicWave.get();
341 } 340 }
342 341
343 // ---------------------------------------------------------------- 342 // ----------------------------------------------------------------
344 343
345 OscillatorNode::OscillatorNode(AudioContext& context, float sampleRate) 344 OscillatorNode::OscillatorNode(AbstractAudioContext& context, float sampleRate)
346 : AudioScheduledSourceNode(context) 345 : AudioScheduledSourceNode(context)
347 // Use musical pitch standard A440 as a default. 346 // Use musical pitch standard A440 as a default.
348 , m_frequency(AudioParam::create(context, 440)) 347 , m_frequency(AudioParam::create(context, 440))
349 // Default to no detuning. 348 // Default to no detuning.
350 , m_detune(AudioParam::create(context, 0)) 349 , m_detune(AudioParam::create(context, 0))
351 { 350 {
352 setHandler(OscillatorHandler::create(*this, sampleRate, m_frequency->handler (), m_detune->handler())); 351 setHandler(OscillatorHandler::create(*this, sampleRate, m_frequency->handler (), m_detune->handler()));
353 } 352 }
354 353
355 OscillatorNode* OscillatorNode::create(AudioContext& context, float sampleRate) 354 OscillatorNode* OscillatorNode::create(AbstractAudioContext& context, float samp leRate)
356 { 355 {
357 return new OscillatorNode(context, sampleRate); 356 return new OscillatorNode(context, sampleRate);
358 } 357 }
359 358
360 DEFINE_TRACE(OscillatorNode) 359 DEFINE_TRACE(OscillatorNode)
361 { 360 {
362 visitor->trace(m_frequency); 361 visitor->trace(m_frequency);
363 visitor->trace(m_detune); 362 visitor->trace(m_detune);
364 AudioScheduledSourceNode::trace(visitor); 363 AudioScheduledSourceNode::trace(visitor);
365 } 364 }
(...skipping 24 matching lines...) Expand all
390 } 389 }
391 390
392 void OscillatorNode::setPeriodicWave(PeriodicWave* wave) 391 void OscillatorNode::setPeriodicWave(PeriodicWave* wave)
393 { 392 {
394 oscillatorHandler().setPeriodicWave(wave); 393 oscillatorHandler().setPeriodicWave(wave);
395 } 394 }
396 395
397 } // namespace blink 396 } // namespace blink
398 397
399 #endif // ENABLE(WEB_AUDIO) 398 #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