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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/ScriptProcessorNode.h

Issue 1865583002: Implement BaseAudioContext (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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 * 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 18 matching lines...) Expand all
29 #include "bindings/core/v8/ActiveScriptWrappable.h" 29 #include "bindings/core/v8/ActiveScriptWrappable.h"
30 #include "modules/webaudio/AudioNode.h" 30 #include "modules/webaudio/AudioNode.h"
31 #include "platform/audio/AudioBus.h" 31 #include "platform/audio/AudioBus.h"
32 #include "wtf/Forward.h" 32 #include "wtf/Forward.h"
33 #include "wtf/PassRefPtr.h" 33 #include "wtf/PassRefPtr.h"
34 #include "wtf/RefPtr.h" 34 #include "wtf/RefPtr.h"
35 #include "wtf/Vector.h" 35 #include "wtf/Vector.h"
36 36
37 namespace blink { 37 namespace blink {
38 38
39 class AbstractAudioContext; 39 class BaseAudioContext;
40 class AudioBuffer; 40 class AudioBuffer;
41 41
42 // ScriptProcessorNode is an AudioNode which allows for arbitrary synthesis or p rocessing directly using JavaScript. 42 // ScriptProcessorNode is an AudioNode which allows for arbitrary synthesis or p rocessing directly using JavaScript.
43 // The API allows for a variable number of inputs and outputs, although it must have at least one input or output. 43 // The API allows for a variable number of inputs and outputs, although it must have at least one input or output.
44 // This basic implementation supports no more than one input and output. 44 // This basic implementation supports no more than one input and output.
45 // The "onaudioprocess" attribute is an event listener which will get called per iodically with an AudioProcessingEvent which has 45 // The "onaudioprocess" attribute is an event listener which will get called per iodically with an AudioProcessingEvent which has
46 // AudioBuffers for each input and output. 46 // AudioBuffers for each input and output.
47 47
48 class ScriptProcessorHandler final : public AudioHandler { 48 class ScriptProcessorHandler final : public AudioHandler {
49 public: 49 public:
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 DEFINE_WRAPPERTYPEINFO(); 95 DEFINE_WRAPPERTYPEINFO();
96 public: 96 public:
97 // bufferSize must be one of the following values: 256, 512, 1024, 2048, 97 // bufferSize must be one of the following values: 256, 512, 1024, 2048,
98 // 4096, 8192, 16384. 98 // 4096, 8192, 16384.
99 // This value controls how frequently the onaudioprocess event handler is 99 // This value controls how frequently the onaudioprocess event handler is
100 // called and how many sample-frames need to be processed each call. 100 // called and how many sample-frames need to be processed each call.
101 // Lower numbers for bufferSize will result in a lower (better) 101 // Lower numbers for bufferSize will result in a lower (better)
102 // latency. Higher numbers will be necessary to avoid audio breakup and 102 // latency. Higher numbers will be necessary to avoid audio breakup and
103 // glitches. 103 // glitches.
104 // The value chosen must carefully balance between latency and audio quality . 104 // 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); 105 static ScriptProcessorNode* create(BaseAudioContext&, float sampleRate, size _t bufferSize, unsigned numberOfInputChannels, unsigned numberOfOutputChannels);
106 106
107 DEFINE_ATTRIBUTE_EVENT_LISTENER(audioprocess); 107 DEFINE_ATTRIBUTE_EVENT_LISTENER(audioprocess);
108 size_t bufferSize() const; 108 size_t bufferSize() const;
109 109
110 // ActiveScriptWrappable 110 // ActiveScriptWrappable
111 bool hasPendingActivity() const final; 111 bool hasPendingActivity() const final;
112 112
113 private: 113 private:
114 ScriptProcessorNode(AbstractAudioContext&, float sampleRate, size_t bufferSi ze, unsigned numberOfInputChannels, unsigned numberOfOutputChannels); 114 ScriptProcessorNode(BaseAudioContext&, float sampleRate, size_t bufferSize, unsigned numberOfInputChannels, unsigned numberOfOutputChannels);
115 }; 115 };
116 116
117 } // namespace blink 117 } // namespace blink
118 118
119 #endif // ScriptProcessorNode_h 119 #endif // ScriptProcessorNode_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698