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

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

Issue 2389253002: reflow comments in modules/{webaudio,vr} (Closed)
Patch Set: . Created 4 years, 2 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 23 matching lines...) Expand all
34 #include "wtf/PassRefPtr.h" 34 #include "wtf/PassRefPtr.h"
35 #include "wtf/RefPtr.h" 35 #include "wtf/RefPtr.h"
36 #include "wtf/Threading.h" 36 #include "wtf/Threading.h"
37 #include <memory> 37 #include <memory>
38 38
39 namespace blink { 39 namespace blink {
40 40
41 class AudioBufferSourceOptions; 41 class AudioBufferSourceOptions;
42 class BaseAudioContext; 42 class BaseAudioContext;
43 43
44 // AudioBufferSourceNode is an AudioNode representing an audio source from an in -memory audio asset represented by an AudioBuffer. 44 // AudioBufferSourceNode is an AudioNode representing an audio source from an
45 // It generally will be used for short sounds which require a high degree of sch eduling flexibility (can playback in rhythmically perfect ways). 45 // in-memory audio asset represented by an AudioBuffer. It generally will be
46 // used for short sounds which require a high degree of scheduling flexibility
47 // (can playback in rhythmically perfect ways).
46 48
47 class AudioBufferSourceHandler final : public AudioScheduledSourceHandler { 49 class AudioBufferSourceHandler final : public AudioScheduledSourceHandler {
48 public: 50 public:
49 static PassRefPtr<AudioBufferSourceHandler> create( 51 static PassRefPtr<AudioBufferSourceHandler> create(
50 AudioNode&, 52 AudioNode&,
51 float sampleRate, 53 float sampleRate,
52 AudioParamHandler& playbackRate, 54 AudioParamHandler& playbackRate,
53 AudioParamHandler& detune); 55 AudioParamHandler& detune);
54 ~AudioBufferSourceHandler() override; 56 ~AudioBufferSourceHandler() override;
55 57
56 // AudioHandler 58 // AudioHandler
57 void process(size_t framesToProcess) override; 59 void process(size_t framesToProcess) override;
58 60
59 // setBuffer() is called on the main thread. This is the buffer we use for pla yback. 61 // setBuffer() is called on the main thread. This is the buffer we use for
62 // playback.
60 void setBuffer(AudioBuffer*, ExceptionState&); 63 void setBuffer(AudioBuffer*, ExceptionState&);
61 AudioBuffer* buffer() { return m_buffer.get(); } 64 AudioBuffer* buffer() { return m_buffer.get(); }
62 65
63 // numberOfChannels() returns the number of output channels. This value equal s the number of channels from the buffer. 66 // numberOfChannels() returns the number of output channels. This value
64 // If a new buffer is set with a different number of channels, then this value will dynamically change. 67 // equals the number of channels from the buffer. If a new buffer is set with
68 // a different number of channels, then this value will dynamically change.
65 unsigned numberOfChannels(); 69 unsigned numberOfChannels();
66 70
67 // Play-state 71 // Play-state
68 void start(double when, ExceptionState&); 72 void start(double when, ExceptionState&);
69 void start(double when, double grainOffset, ExceptionState&); 73 void start(double when, double grainOffset, ExceptionState&);
70 void start(double when, 74 void start(double when,
71 double grainOffset, 75 double grainOffset,
72 double grainDuration, 76 double grainDuration,
73 ExceptionState&); 77 ExceptionState&);
74 78
75 // Note: the attribute was originally exposed as .looping, but to be more cons istent in naming with <audio> 79 // Note: the attribute was originally exposed as |.looping|, but to be more
76 // and with how it's described in the specification, the proper attribute name is .loop 80 // consistent in naming with <audio> and with how it's described in the
77 // The old attribute is kept for backwards compatibility. 81 // specification, the proper attribute name is |.loop|. The old attribute is
82 // kept for backwards compatibility.
78 bool loop() const { return m_isLooping; } 83 bool loop() const { return m_isLooping; }
79 void setLoop(bool looping) { 84 void setLoop(bool looping) {
80 m_isLooping = looping; 85 m_isLooping = looping;
81 m_didSetLooping = m_didSetLooping || looping; 86 m_didSetLooping = m_didSetLooping || looping;
82 } 87 }
83 88
84 // Loop times in seconds. 89 // Loop times in seconds.
85 double loopStart() const { return m_loopStart; } 90 double loopStart() const { return m_loopStart; }
86 double loopEnd() const { return m_loopEnd; } 91 double loopEnd() const { return m_loopEnd; }
87 void setLoopStart(double loopStart) { m_loopStart = loopStart; } 92 void setLoopStart(double loopStart) { m_loopStart = loopStart; }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 // AudioBufferSourceNode. 126 // AudioBufferSourceNode.
122 Persistent<AudioBuffer> m_buffer; 127 Persistent<AudioBuffer> m_buffer;
123 128
124 // Pointers for the buffer and destination. 129 // Pointers for the buffer and destination.
125 std::unique_ptr<const float* []> m_sourceChannels; 130 std::unique_ptr<const float* []> m_sourceChannels;
126 std::unique_ptr<float* []> m_destinationChannels; 131 std::unique_ptr<float* []> m_destinationChannels;
127 132
128 RefPtr<AudioParamHandler> m_playbackRate; 133 RefPtr<AudioParamHandler> m_playbackRate;
129 RefPtr<AudioParamHandler> m_detune; 134 RefPtr<AudioParamHandler> m_detune;
130 135
131 // If m_isLooping is false, then this node will be done playing and become ina ctive after it reaches the end of the sample data in the buffer. 136 // If m_isLooping is false, then this node will be done playing and become
132 // If true, it will wrap around to the start of the buffer each time it reache s the end. 137 // inactive after it reaches the end of the sample data in the buffer. If
138 // true, it will wrap around to the start of the buffer each time it reaches
139 // the end.
133 bool m_isLooping; 140 bool m_isLooping;
134 141
135 // True if the source .loop attribute was ever set. 142 // True if the source .loop attribute was ever set.
136 bool m_didSetLooping; 143 bool m_didSetLooping;
137 144
138 double m_loopStart; 145 double m_loopStart;
139 double m_loopEnd; 146 double m_loopEnd;
140 147
141 // m_virtualReadIndex is a sample-frame index into our buffer representing the current playback position. 148 // m_virtualReadIndex is a sample-frame index into our buffer representing the
142 // Since it's floating-point, it has sub-sample accuracy. 149 // current playback position. Since it's floating-point, it has sub-sample
150 // accuracy.
143 double m_virtualReadIndex; 151 double m_virtualReadIndex;
144 152
145 // Granular playback 153 // Granular playback
146 bool m_isGrain; 154 bool m_isGrain;
147 double m_grainOffset; // in seconds 155 double m_grainOffset; // in seconds
148 double m_grainDuration; // in seconds 156 double m_grainDuration; // in seconds
149 // True if grainDuration is given explicitly (via 3 arg start method). 157 // True if grainDuration is given explicitly (via 3 arg start method).
150 bool m_isDurationGiven; 158 bool m_isDurationGiven;
151 159
152 // Compute playback rate (k-rate) by incorporating the sample rate 160 // Compute playback rate (k-rate) by incorporating the sample rate
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 private: 198 private:
191 AudioBufferSourceNode(BaseAudioContext&); 199 AudioBufferSourceNode(BaseAudioContext&);
192 200
193 Member<AudioParam> m_playbackRate; 201 Member<AudioParam> m_playbackRate;
194 Member<AudioParam> m_detune; 202 Member<AudioParam> m_detune;
195 }; 203 };
196 204
197 } // namespace blink 205 } // namespace blink
198 206
199 #endif // AudioBufferSourceNode_h 207 #endif // AudioBufferSourceNode_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698