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

Side by Side Diff: Source/modules/webaudio/WaveShaperNode.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/WaveShaperNode.h ('k') | Source/platform/audio/ReverbConvolver.cpp » ('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) 2011, Google Inc. All rights reserved. 2 * Copyright (C) 2011, 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/WaveShaperNode.h" 27 #include "modules/webaudio/WaveShaperNode.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/AbstractAudioContext.h"
32 #include "modules/webaudio/AudioBasicProcessorHandler.h" 33 #include "modules/webaudio/AudioBasicProcessorHandler.h"
33 #include "modules/webaudio/AudioContext.h"
34 #include "wtf/MainThread.h" 34 #include "wtf/MainThread.h"
35 35
36 namespace blink { 36 namespace blink {
37 37
38 WaveShaperNode::WaveShaperNode(AudioContext& context) 38 WaveShaperNode::WaveShaperNode(AbstractAudioContext& context)
39 : AudioNode(context) 39 : AudioNode(context)
40 { 40 {
41 setHandler(AudioBasicProcessorHandler::create(AudioHandler::NodeTypeWaveShap er, *this, context.sampleRate(), adoptPtr(new WaveShaperProcessor(context.sample Rate(), 1)))); 41 setHandler(AudioBasicProcessorHandler::create(AudioHandler::NodeTypeWaveShap er, *this, context.sampleRate(), adoptPtr(new WaveShaperProcessor(context.sample Rate(), 1))));
42 42
43 handler().initialize(); 43 handler().initialize();
44 } 44 }
45 45
46 WaveShaperProcessor* WaveShaperNode::waveShaperProcessor() const 46 WaveShaperProcessor* WaveShaperNode::waveShaperProcessor() const
47 { 47 {
48 return static_cast<WaveShaperProcessor*>(static_cast<AudioBasicProcessorHand ler&>(handler()).processor()); 48 return static_cast<WaveShaperProcessor*>(static_cast<AudioBasicProcessorHand ler&>(handler()).processor());
(...skipping 21 matching lines...) Expand all
70 return waveShaperProcessor()->curve(); 70 return waveShaperProcessor()->curve();
71 } 71 }
72 72
73 void WaveShaperNode::setOversample(const String& type) 73 void WaveShaperNode::setOversample(const String& type)
74 { 74 {
75 ASSERT(isMainThread()); 75 ASSERT(isMainThread());
76 76
77 // This is to synchronize with the changes made in 77 // This is to synchronize with the changes made in
78 // AudioBasicProcessorNode::checkNumberOfChannelsForInput() where we can 78 // AudioBasicProcessorNode::checkNumberOfChannelsForInput() where we can
79 // initialize() and uninitialize(). 79 // initialize() and uninitialize().
80 AudioContext::AutoLocker contextLocker(context()); 80 AbstractAudioContext::AutoLocker contextLocker(context());
81 81
82 if (type == "none") { 82 if (type == "none") {
83 waveShaperProcessor()->setOversample(WaveShaperProcessor::OverSampleNone ); 83 waveShaperProcessor()->setOversample(WaveShaperProcessor::OverSampleNone );
84 } else if (type == "2x") { 84 } else if (type == "2x") {
85 waveShaperProcessor()->setOversample(WaveShaperProcessor::OverSample2x); 85 waveShaperProcessor()->setOversample(WaveShaperProcessor::OverSample2x);
86 } else if (type == "4x") { 86 } else if (type == "4x") {
87 waveShaperProcessor()->setOversample(WaveShaperProcessor::OverSample4x); 87 waveShaperProcessor()->setOversample(WaveShaperProcessor::OverSample4x);
88 } else { 88 } else {
89 ASSERT_NOT_REACHED(); 89 ASSERT_NOT_REACHED();
90 } 90 }
(...skipping 10 matching lines...) Expand all
101 return "4x"; 101 return "4x";
102 default: 102 default:
103 ASSERT_NOT_REACHED(); 103 ASSERT_NOT_REACHED();
104 return "none"; 104 return "none";
105 } 105 }
106 } 106 }
107 107
108 } // namespace blink 108 } // namespace blink
109 109
110 #endif // ENABLE(WEB_AUDIO) 110 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/modules/webaudio/WaveShaperNode.h ('k') | Source/platform/audio/ReverbConvolver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698