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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 exceptionState.throwDOMException( | 231 exceptionState.throwDOMException( |
232 NotSupportedError, | 232 NotSupportedError, |
233 "channelCountMode cannot be changed from 'explicit' to '" + mode + "
'"); | 233 "channelCountMode cannot be changed from 'explicit' to '" + mode + "
'"); |
234 } | 234 } |
235 } | 235 } |
236 | 236 |
237 // ---------------------------------------------------------------- | 237 // ---------------------------------------------------------------- |
238 | 238 |
239 ScriptProcessorNode::ScriptProcessorNode(AbstractAudioContext& context, float sa
mpleRate, size_t bufferSize, unsigned numberOfInputChannels, unsigned numberOfOu
tputChannels) | 239 ScriptProcessorNode::ScriptProcessorNode(AbstractAudioContext& context, float sa
mpleRate, size_t bufferSize, unsigned numberOfInputChannels, unsigned numberOfOu
tputChannels) |
240 : AudioNode(context) | 240 : AudioNode(context) |
| 241 , ActiveScriptWrappable(this) |
241 { | 242 { |
242 setHandler(ScriptProcessorHandler::create(*this, sampleRate, bufferSize, num
berOfInputChannels, numberOfOutputChannels)); | 243 setHandler(ScriptProcessorHandler::create(*this, sampleRate, bufferSize, num
berOfInputChannels, numberOfOutputChannels)); |
243 } | 244 } |
244 | 245 |
245 static size_t chooseBufferSize() | 246 static size_t chooseBufferSize() |
246 { | 247 { |
247 // Choose a buffer size based on the audio hardware buffer size. Arbitarily
make it a power of | 248 // Choose a buffer size based on the audio hardware buffer size. Arbitarily
make it a power of |
248 // two that is 4 times greater than the hardware buffer size. | 249 // two that is 4 times greater than the hardware buffer size. |
249 // FIXME: What is the best way to choose this? | 250 // FIXME: What is the best way to choose this? |
250 size_t hardwareBufferSize = Platform::current()->audioHardwareBufferSize(); | 251 size_t hardwareBufferSize = Platform::current()->audioHardwareBufferSize(); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 // If |onaudioprocess| event handler is defined, the node should not be | 304 // If |onaudioprocess| event handler is defined, the node should not be |
304 // GCed even if it is out of scope. | 305 // GCed even if it is out of scope. |
305 if (hasEventListeners(EventTypeNames::audioprocess)) | 306 if (hasEventListeners(EventTypeNames::audioprocess)) |
306 return true; | 307 return true; |
307 | 308 |
308 return false; | 309 return false; |
309 } | 310 } |
310 | 311 |
311 } // namespace blink | 312 } // namespace blink |
312 | 313 |
OLD | NEW |