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

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

Issue 1214463003: Split "Online" and "Offline" AudioContext processing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Bring to ToT Created 5 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « Source/modules/webaudio/PannerNode.cpp ('k') | Source/modules/webaudio/ScriptProcessorNode.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 16 matching lines...) Expand all
27 27
28 #include "modules/webaudio/AudioNode.h" 28 #include "modules/webaudio/AudioNode.h"
29 #include "platform/audio/AudioBus.h" 29 #include "platform/audio/AudioBus.h"
30 #include "wtf/Forward.h" 30 #include "wtf/Forward.h"
31 #include "wtf/PassRefPtr.h" 31 #include "wtf/PassRefPtr.h"
32 #include "wtf/RefPtr.h" 32 #include "wtf/RefPtr.h"
33 #include "wtf/Vector.h" 33 #include "wtf/Vector.h"
34 34
35 namespace blink { 35 namespace blink {
36 36
37 class AbstractAudioContext;
37 class AudioBuffer; 38 class AudioBuffer;
38 class AudioContext;
39 39
40 // ScriptProcessorNode is an AudioNode which allows for arbitrary synthesis or p rocessing directly using JavaScript. 40 // ScriptProcessorNode is an AudioNode which allows for arbitrary synthesis or p rocessing directly using JavaScript.
41 // The API allows for a variable number of inputs and outputs, although it must have at least one input or output. 41 // The API allows for a variable number of inputs and outputs, although it must have at least one input or output.
42 // This basic implementation supports no more than one input and output. 42 // This basic implementation supports no more than one input and output.
43 // The "onaudioprocess" attribute is an event listener which will get called per iodically with an AudioProcessingEvent which has 43 // The "onaudioprocess" attribute is an event listener which will get called per iodically with an AudioProcessingEvent which has
44 // AudioBuffers for each input and output. 44 // AudioBuffers for each input and output.
45 45
46 class ScriptProcessorHandler final : public AudioHandler { 46 class ScriptProcessorHandler final : public AudioHandler {
47 public: 47 public:
48 static PassRefPtr<ScriptProcessorHandler> create(AudioNode&, float sampleRat e, size_t bufferSize, unsigned numberOfInputChannels, unsigned numberOfOutputCha nnels); 48 static PassRefPtr<ScriptProcessorHandler> create(AudioNode&, float sampleRat e, size_t bufferSize, unsigned numberOfInputChannels, unsigned numberOfOutputCha nnels);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 DEFINE_WRAPPERTYPEINFO(); 94 DEFINE_WRAPPERTYPEINFO();
95 public: 95 public:
96 // bufferSize must be one of the following values: 256, 512, 1024, 2048, 96 // bufferSize must be one of the following values: 256, 512, 1024, 2048,
97 // 4096, 8192, 16384. 97 // 4096, 8192, 16384.
98 // This value controls how frequently the onaudioprocess event handler is 98 // This value controls how frequently the onaudioprocess event handler is
99 // called and how many sample-frames need to be processed each call. 99 // called and how many sample-frames need to be processed each call.
100 // Lower numbers for bufferSize will result in a lower (better) 100 // Lower numbers for bufferSize will result in a lower (better)
101 // latency. Higher numbers will be necessary to avoid audio breakup and 101 // latency. Higher numbers will be necessary to avoid audio breakup and
102 // glitches. 102 // glitches.
103 // The value chosen must carefully balance between latency and audio quality . 103 // The value chosen must carefully balance between latency and audio quality .
104 static ScriptProcessorNode* create(AudioContext&, float sampleRate, size_t b ufferSize, unsigned numberOfInputChannels, unsigned numberOfOutputChannels); 104 static ScriptProcessorNode* create(AbstractAudioContext&, float sampleRate, size_t bufferSize, unsigned numberOfInputChannels, unsigned numberOfOutputChanne ls);
105 105
106 DEFINE_ATTRIBUTE_EVENT_LISTENER(audioprocess); 106 DEFINE_ATTRIBUTE_EVENT_LISTENER(audioprocess);
107 size_t bufferSize() const; 107 size_t bufferSize() const;
108 108
109 private: 109 private:
110 ScriptProcessorNode(AudioContext&, float sampleRate, size_t bufferSize, unsi gned numberOfInputChannels, unsigned numberOfOutputChannels); 110 ScriptProcessorNode(AbstractAudioContext&, float sampleRate, size_t bufferSi ze, unsigned numberOfInputChannels, unsigned numberOfOutputChannels);
111 }; 111 };
112 112
113 } // namespace blink 113 } // namespace blink
114 114
115 #endif // ScriptProcessorNode_h 115 #endif // ScriptProcessorNode_h
OLDNEW
« no previous file with comments | « Source/modules/webaudio/PannerNode.cpp ('k') | Source/modules/webaudio/ScriptProcessorNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698