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 19 matching lines...) Loading... |
30 #include "modules/webaudio/AudioScheduledSourceNode.h" | 30 #include "modules/webaudio/AudioScheduledSourceNode.h" |
31 #include "modules/webaudio/PannerNode.h" | 31 #include "modules/webaudio/PannerNode.h" |
32 #include "platform/audio/AudioBus.h" | 32 #include "platform/audio/AudioBus.h" |
33 #include "wtf/PassRefPtr.h" | 33 #include "wtf/PassRefPtr.h" |
34 #include "wtf/RefPtr.h" | 34 #include "wtf/RefPtr.h" |
35 #include "wtf/Threading.h" | 35 #include "wtf/Threading.h" |
36 #include <memory> | 36 #include <memory> |
37 | 37 |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
| 40 class AudioBufferSourceOptions; |
40 class BaseAudioContext; | 41 class BaseAudioContext; |
41 | 42 |
42 // AudioBufferSourceNode is an AudioNode representing an audio source from an in
-memory audio asset represented by an AudioBuffer. | 43 // AudioBufferSourceNode is an AudioNode representing an audio source from an in
-memory audio asset represented by an AudioBuffer. |
43 // It generally will be used for short sounds which require a high degree of sch
eduling flexibility (can playback in rhythmically perfect ways). | 44 // It generally will be used for short sounds which require a high degree of sch
eduling flexibility (can playback in rhythmically perfect ways). |
44 | 45 |
45 class AudioBufferSourceHandler final : public AudioScheduledSourceHandler { | 46 class AudioBufferSourceHandler final : public AudioScheduledSourceHandler { |
46 public: | 47 public: |
47 static PassRefPtr<AudioBufferSourceHandler> create(AudioNode&, float sampleR
ate, AudioParamHandler& playbackRate, AudioParamHandler& detune); | 48 static PassRefPtr<AudioBufferSourceHandler> create(AudioNode&, float sampleR
ate, AudioParamHandler& playbackRate, AudioParamHandler& detune); |
48 ~AudioBufferSourceHandler() override; | 49 ~AudioBufferSourceHandler() override; |
49 | 50 |
(...skipping 85 matching lines...) Loading... |
135 double computePlaybackRate(); | 136 double computePlaybackRate(); |
136 | 137 |
137 // The minimum playbackRate value ever used for this source. | 138 // The minimum playbackRate value ever used for this source. |
138 double m_minPlaybackRate; | 139 double m_minPlaybackRate; |
139 }; | 140 }; |
140 | 141 |
141 class AudioBufferSourceNode final : public AudioScheduledSourceNode { | 142 class AudioBufferSourceNode final : public AudioScheduledSourceNode { |
142 DEFINE_WRAPPERTYPEINFO(); | 143 DEFINE_WRAPPERTYPEINFO(); |
143 public: | 144 public: |
144 static AudioBufferSourceNode* create(BaseAudioContext&, ExceptionState&); | 145 static AudioBufferSourceNode* create(BaseAudioContext&, ExceptionState&); |
| 146 static AudioBufferSourceNode* create(BaseAudioContext*, AudioBufferSourceOpt
ions&, ExceptionState&); |
145 DECLARE_VIRTUAL_TRACE(); | 147 DECLARE_VIRTUAL_TRACE(); |
146 AudioBufferSourceHandler& audioBufferSourceHandler() const; | 148 AudioBufferSourceHandler& audioBufferSourceHandler() const; |
147 | 149 |
148 AudioBuffer* buffer() const; | 150 AudioBuffer* buffer() const; |
149 void setBuffer(AudioBuffer*, ExceptionState&); | 151 void setBuffer(AudioBuffer*, ExceptionState&); |
150 AudioParam* playbackRate() const; | 152 AudioParam* playbackRate() const; |
151 AudioParam* detune() const; | 153 AudioParam* detune() const; |
152 bool loop() const; | 154 bool loop() const; |
153 void setLoop(bool); | 155 void setLoop(bool); |
154 double loopStart() const; | 156 double loopStart() const; |
155 void setLoopStart(double); | 157 void setLoopStart(double); |
156 double loopEnd() const; | 158 double loopEnd() const; |
157 void setLoopEnd(double); | 159 void setLoopEnd(double); |
158 | 160 |
159 void start(ExceptionState&); | 161 void start(ExceptionState&); |
160 void start(double when, ExceptionState&); | 162 void start(double when, ExceptionState&); |
161 void start(double when, double grainOffset, ExceptionState&); | 163 void start(double when, double grainOffset, ExceptionState&); |
162 void start(double when, double grainOffset, double grainDuration, ExceptionS
tate&); | 164 void start(double when, double grainOffset, double grainDuration, ExceptionS
tate&); |
163 | 165 |
164 private: | 166 private: |
165 AudioBufferSourceNode(BaseAudioContext&); | 167 AudioBufferSourceNode(BaseAudioContext&); |
166 | 168 |
167 Member<AudioParam> m_playbackRate; | 169 Member<AudioParam> m_playbackRate; |
168 Member<AudioParam> m_detune; | 170 Member<AudioParam> m_detune; |
169 }; | 171 }; |
170 | 172 |
171 } // namespace blink | 173 } // namespace blink |
172 | 174 |
173 #endif // AudioBufferSourceNode_h | 175 #endif // AudioBufferSourceNode_h |
OLD | NEW |