| 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 RefPtr<AudioBus> m_internalInputBus; | 87 RefPtr<AudioBus> m_internalInputBus; |
| 88 // Synchronize process() with fireProcessEvent(). | 88 // Synchronize process() with fireProcessEvent(). |
| 89 mutable Mutex m_processEventLock; | 89 mutable Mutex m_processEventLock; |
| 90 | 90 |
| 91 FRIEND_TEST_ALL_PREFIXES(ScriptProcessorNodeTest, BufferLifetime); | 91 FRIEND_TEST_ALL_PREFIXES(ScriptProcessorNodeTest, BufferLifetime); |
| 92 }; | 92 }; |
| 93 | 93 |
| 94 class ScriptProcessorNode final : public AudioNode, public ActiveScriptWrappable
{ | 94 class ScriptProcessorNode final : public AudioNode, public ActiveScriptWrappable
{ |
| 95 DEFINE_WRAPPERTYPEINFO(); | 95 DEFINE_WRAPPERTYPEINFO(); |
| 96 USING_GARBAGE_COLLECTED_MIXIN(ScriptProcessorNode); |
| 96 public: | 97 public: |
| 97 // bufferSize must be one of the following values: 256, 512, 1024, 2048, | 98 // bufferSize must be one of the following values: 256, 512, 1024, 2048, |
| 98 // 4096, 8192, 16384. | 99 // 4096, 8192, 16384. |
| 99 // This value controls how frequently the onaudioprocess event handler is | 100 // This value controls how frequently the onaudioprocess event handler is |
| 100 // called and how many sample-frames need to be processed each call. | 101 // called and how many sample-frames need to be processed each call. |
| 101 // Lower numbers for bufferSize will result in a lower (better) | 102 // Lower numbers for bufferSize will result in a lower (better) |
| 102 // latency. Higher numbers will be necessary to avoid audio breakup and | 103 // latency. Higher numbers will be necessary to avoid audio breakup and |
| 103 // glitches. | 104 // glitches. |
| 104 // The value chosen must carefully balance between latency and audio quality
. | 105 // The value chosen must carefully balance between latency and audio quality
. |
| 105 static ScriptProcessorNode* create(AbstractAudioContext&, float sampleRate,
size_t bufferSize, unsigned numberOfInputChannels, unsigned numberOfOutputChanne
ls); | 106 static ScriptProcessorNode* create(AbstractAudioContext&, float sampleRate,
size_t bufferSize, unsigned numberOfInputChannels, unsigned numberOfOutputChanne
ls); |
| 106 | 107 |
| 107 DEFINE_ATTRIBUTE_EVENT_LISTENER(audioprocess); | 108 DEFINE_ATTRIBUTE_EVENT_LISTENER(audioprocess); |
| 108 size_t bufferSize() const; | 109 size_t bufferSize() const; |
| 109 | 110 |
| 110 // ActiveScriptWrappable | 111 // ActiveScriptWrappable |
| 111 bool hasPendingActivity() const final; | 112 bool hasPendingActivity() const final; |
| 112 | 113 |
| 114 DEFINE_INLINE_VIRTUAL_TRACE() { AudioNode::trace(visitor); } |
| 115 |
| 113 private: | 116 private: |
| 114 ScriptProcessorNode(AbstractAudioContext&, float sampleRate, size_t bufferSi
ze, unsigned numberOfInputChannels, unsigned numberOfOutputChannels); | 117 ScriptProcessorNode(AbstractAudioContext&, float sampleRate, size_t bufferSi
ze, unsigned numberOfInputChannels, unsigned numberOfOutputChannels); |
| 115 }; | 118 }; |
| 116 | 119 |
| 117 } // namespace blink | 120 } // namespace blink |
| 118 | 121 |
| 119 #endif // ScriptProcessorNode_h | 122 #endif // ScriptProcessorNode_h |
| OLD | NEW |