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

Side by Side Diff: Source/modules/webaudio/ChannelMergerNode.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
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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 16 matching lines...) Expand all
27 */ 27 */
28 28
29 #include "config.h" 29 #include "config.h"
30 #if ENABLE(WEB_AUDIO) 30 #if ENABLE(WEB_AUDIO)
31 #include "modules/webaudio/ChannelMergerNode.h" 31 #include "modules/webaudio/ChannelMergerNode.h"
32 32
33 #include "bindings/core/v8/ExceptionMessages.h" 33 #include "bindings/core/v8/ExceptionMessages.h"
34 #include "bindings/core/v8/ExceptionState.h" 34 #include "bindings/core/v8/ExceptionState.h"
35 #include "core/dom/ExceptionCode.h" 35 #include "core/dom/ExceptionCode.h"
36 #include "core/dom/ExecutionContext.h" 36 #include "core/dom/ExecutionContext.h"
37 #include "modules/webaudio/AudioContext.h" 37 #include "modules/webaudio/AbstractAudioContext.h"
38 #include "modules/webaudio/AudioNodeInput.h" 38 #include "modules/webaudio/AudioNodeInput.h"
39 #include "modules/webaudio/AudioNodeOutput.h" 39 #include "modules/webaudio/AudioNodeOutput.h"
40 40
41 41
42 namespace blink { 42 namespace blink {
43 43
44 ChannelMergerHandler::ChannelMergerHandler(AudioNode& node, float sampleRate, un signed numberOfInputs) 44 ChannelMergerHandler::ChannelMergerHandler(AudioNode& node, float sampleRate, un signed numberOfInputs)
45 : AudioHandler(NodeTypeChannelMerger, node, sampleRate) 45 : AudioHandler(NodeTypeChannelMerger, node, sampleRate)
46 { 46 {
47 // These properties are fixed for the node and cannot be changed by user. 47 // These properties are fixed for the node and cannot be changed by user.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 } else { 90 } else {
91 // If input is unconnected, fill zeros in the channel. 91 // If input is unconnected, fill zeros in the channel.
92 outputChannel->zero(); 92 outputChannel->zero();
93 } 93 }
94 } 94 }
95 } 95 }
96 96
97 void ChannelMergerHandler::setChannelCount(unsigned long channelCount, Exception State& exceptionState) 97 void ChannelMergerHandler::setChannelCount(unsigned long channelCount, Exception State& exceptionState)
98 { 98 {
99 ASSERT(isMainThread()); 99 ASSERT(isMainThread());
100 AudioContext::AutoLocker locker(context()); 100 AbstractAudioContext::AutoLocker locker(context());
101 101
102 // channelCount must be 1. 102 // channelCount must be 1.
103 if (channelCount != 1) { 103 if (channelCount != 1) {
104 exceptionState.throwDOMException( 104 exceptionState.throwDOMException(
105 InvalidStateError, 105 InvalidStateError,
106 "ChannelMerger: channelCount cannot be changed from 1"); 106 "ChannelMerger: channelCount cannot be changed from 1");
107 } 107 }
108 } 108 }
109 109
110 void ChannelMergerHandler::setChannelCountMode(const String& mode, ExceptionStat e& exceptionState) 110 void ChannelMergerHandler::setChannelCountMode(const String& mode, ExceptionStat e& exceptionState)
111 { 111 {
112 ASSERT(isMainThread()); 112 ASSERT(isMainThread());
113 AudioContext::AutoLocker locker(context()); 113 AbstractAudioContext::AutoLocker locker(context());
114 114
115 // channcelCountMode must be 'explicit'. 115 // channcelCountMode must be 'explicit'.
116 if (mode != "explicit") { 116 if (mode != "explicit") {
117 exceptionState.throwDOMException( 117 exceptionState.throwDOMException(
118 InvalidStateError, 118 InvalidStateError,
119 "ChannelMerger: channelCountMode cannot be changed from 'explicit'") ; 119 "ChannelMerger: channelCountMode cannot be changed from 'explicit'") ;
120 } 120 }
121 } 121 }
122 122
123 // ---------------------------------------------------------------- 123 // ----------------------------------------------------------------
124 124
125 ChannelMergerNode::ChannelMergerNode(AudioContext& context, float sampleRate, un signed numberOfInputs) 125 ChannelMergerNode::ChannelMergerNode(AbstractAudioContext& context, float sample Rate, unsigned numberOfInputs)
126 : AudioNode(context) 126 : AudioNode(context)
127 { 127 {
128 setHandler(ChannelMergerHandler::create(*this, sampleRate, numberOfInputs)); 128 setHandler(ChannelMergerHandler::create(*this, sampleRate, numberOfInputs));
129 } 129 }
130 130
131 ChannelMergerNode* ChannelMergerNode::create(AudioContext& context, float sample Rate, unsigned numberOfInputs) 131 ChannelMergerNode* ChannelMergerNode::create(AbstractAudioContext& context, floa t sampleRate, unsigned numberOfInputs)
132 { 132 {
133 if (!numberOfInputs || numberOfInputs > AudioContext::maxNumberOfChannels()) 133 if (!numberOfInputs || numberOfInputs > AbstractAudioContext::maxNumberOfCha nnels())
134 return nullptr; 134 return nullptr;
135 return new ChannelMergerNode(context, sampleRate, numberOfInputs); 135 return new ChannelMergerNode(context, sampleRate, numberOfInputs);
136 } 136 }
137 137
138 } // namespace blink 138 } // namespace blink
139 139
140 #endif // ENABLE(WEB_AUDIO) 140 #endif // ENABLE(WEB_AUDIO)
OLDNEW
« no previous file with comments | « Source/modules/webaudio/ChannelMergerNode.h ('k') | Source/modules/webaudio/ChannelSplitterNode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698