OLD | NEW |
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 break; | 66 break; |
67 case 256: | 67 case 256: |
68 case 512: | 68 case 512: |
69 case 1024: | 69 case 1024: |
70 case 2048: | 70 case 2048: |
71 case 4096: | 71 case 4096: |
72 case 8192: | 72 case 8192: |
73 case 16384: | 73 case 16384: |
74 break; | 74 break; |
75 default: | 75 default: |
76 return 0; | 76 return nullptr; |
77 } | 77 } |
78 | 78 |
79 if (!numberOfInputChannels && !numberOfOutputChannels) | 79 if (!numberOfInputChannels && !numberOfOutputChannels) |
80 return 0; | 80 return nullptr; |
81 | 81 |
82 if (numberOfInputChannels > AudioContext::maxNumberOfChannels()) | 82 if (numberOfInputChannels > AudioContext::maxNumberOfChannels()) |
83 return 0; | 83 return nullptr; |
84 | 84 |
85 if (numberOfOutputChannels > AudioContext::maxNumberOfChannels()) | 85 if (numberOfOutputChannels > AudioContext::maxNumberOfChannels()) |
86 return 0; | 86 return nullptr; |
87 | 87 |
88 return new ScriptProcessorNode(context, sampleRate, bufferSize, numberOfInpu
tChannels, numberOfOutputChannels); | 88 return new ScriptProcessorNode(context, sampleRate, bufferSize, numberOfInpu
tChannels, numberOfOutputChannels); |
89 } | 89 } |
90 | 90 |
91 ScriptProcessorNode::ScriptProcessorNode(AudioContext* context, float sampleRate
, size_t bufferSize, unsigned numberOfInputChannels, unsigned numberOfOutputChan
nels) | 91 ScriptProcessorNode::ScriptProcessorNode(AudioContext* context, float sampleRate
, size_t bufferSize, unsigned numberOfInputChannels, unsigned numberOfOutputChan
nels) |
92 : AudioNode(NodeTypeJavaScript, context, sampleRate) | 92 : AudioNode(NodeTypeJavaScript, context, sampleRate) |
93 , m_doubleBufferIndex(0) | 93 , m_doubleBufferIndex(0) |
94 , m_doubleBufferIndexForEvent(0) | 94 , m_doubleBufferIndexForEvent(0) |
95 , m_bufferSize(bufferSize) | 95 , m_bufferSize(bufferSize) |
96 , m_bufferReadWriteIndex(0) | 96 , m_bufferReadWriteIndex(0) |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 DEFINE_TRACE(ScriptProcessorNode) | 302 DEFINE_TRACE(ScriptProcessorNode) |
303 { | 303 { |
304 visitor->trace(m_inputBuffers); | 304 visitor->trace(m_inputBuffers); |
305 visitor->trace(m_outputBuffers); | 305 visitor->trace(m_outputBuffers); |
306 AudioNode::trace(visitor); | 306 AudioNode::trace(visitor); |
307 } | 307 } |
308 | 308 |
309 } // namespace blink | 309 } // namespace blink |
310 | 310 |
311 #endif // ENABLE(WEB_AUDIO) | 311 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |