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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 } | 329 } |
330 } | 330 } |
331 | 331 |
332 // ---------------------------------------------------------------- | 332 // ---------------------------------------------------------------- |
333 | 333 |
334 ScriptProcessorNode::ScriptProcessorNode(BaseAudioContext& context, | 334 ScriptProcessorNode::ScriptProcessorNode(BaseAudioContext& context, |
335 float sampleRate, | 335 float sampleRate, |
336 size_t bufferSize, | 336 size_t bufferSize, |
337 unsigned numberOfInputChannels, | 337 unsigned numberOfInputChannels, |
338 unsigned numberOfOutputChannels) | 338 unsigned numberOfOutputChannels) |
339 : AudioNode(context), ActiveScriptWrappable(this) { | 339 : AudioNode(context), ActiveScriptWrappable<ScriptProcessorNode>(this) { |
340 setHandler(ScriptProcessorHandler::create(*this, sampleRate, bufferSize, | 340 setHandler(ScriptProcessorHandler::create(*this, sampleRate, bufferSize, |
341 numberOfInputChannels, | 341 numberOfInputChannels, |
342 numberOfOutputChannels)); | 342 numberOfOutputChannels)); |
343 } | 343 } |
344 | 344 |
345 static size_t chooseBufferSize() { | 345 static size_t chooseBufferSize() { |
346 // Choose a buffer size based on the audio hardware buffer size. Arbitarily | 346 // Choose a buffer size based on the audio hardware buffer size. Arbitarily |
347 // make it a power of two that is 4 times greater than the hardware buffer | 347 // make it a power of two that is 4 times greater than the hardware buffer |
348 // size. | 348 // size. |
349 // FIXME: What is the best way to choose this? | 349 // FIXME: What is the best way to choose this? |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 | 473 |
474 // If |onaudioprocess| event handler is defined, the node should not be | 474 // If |onaudioprocess| event handler is defined, the node should not be |
475 // GCed even if it is out of scope. | 475 // GCed even if it is out of scope. |
476 if (hasEventListeners(EventTypeNames::audioprocess)) | 476 if (hasEventListeners(EventTypeNames::audioprocess)) |
477 return true; | 477 return true; |
478 | 478 |
479 return false; | 479 return false; |
480 } | 480 } |
481 | 481 |
482 } // namespace blink | 482 } // namespace blink |
OLD | NEW |