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...) Expand all 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/OwnPtr.h" | 33 #include "wtf/OwnPtr.h" |
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 | 37 |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
40 class AudioContext; | 40 class AbstractAudioContext; |
41 | 41 |
42 // AudioBufferSourceNode is an AudioNode representing an audio source from an in
-memory audio asset represented by an AudioBuffer. | 42 // 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). | 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 | 44 |
45 class AudioBufferSourceHandler final : public AudioScheduledSourceHandler { | 45 class AudioBufferSourceHandler final : public AudioScheduledSourceHandler { |
46 public: | 46 public: |
47 static PassRefPtr<AudioBufferSourceHandler> create(AudioNode&, float sampleR
ate, AudioParamHandler& playbackRate, AudioParamHandler& detune); | 47 static PassRefPtr<AudioBufferSourceHandler> create(AudioNode&, float sampleR
ate, AudioParamHandler& playbackRate, AudioParamHandler& detune); |
48 ~AudioBufferSourceHandler() override; | 48 ~AudioBufferSourceHandler() override; |
49 | 49 |
50 // AudioHandler | 50 // AudioHandler |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 mutable Mutex m_processLock; | 149 mutable Mutex m_processLock; |
150 | 150 |
151 // The minimum playbackRate value ever used for this source. This includes
any adjustments | 151 // The minimum playbackRate value ever used for this source. This includes
any adjustments |
152 // caused by doppler too. | 152 // caused by doppler too. |
153 double m_minPlaybackRate; | 153 double m_minPlaybackRate; |
154 }; | 154 }; |
155 | 155 |
156 class AudioBufferSourceNode final : public AudioScheduledSourceNode { | 156 class AudioBufferSourceNode final : public AudioScheduledSourceNode { |
157 DEFINE_WRAPPERTYPEINFO(); | 157 DEFINE_WRAPPERTYPEINFO(); |
158 public: | 158 public: |
159 static AudioBufferSourceNode* create(AudioContext&, float sampleRate); | 159 static AudioBufferSourceNode* create(AbstractAudioContext&, float sampleRate
); |
160 DECLARE_VIRTUAL_TRACE(); | 160 DECLARE_VIRTUAL_TRACE(); |
161 AudioBufferSourceHandler& audioBufferSourceHandler() const; | 161 AudioBufferSourceHandler& audioBufferSourceHandler() const; |
162 | 162 |
163 AudioBuffer* buffer() const; | 163 AudioBuffer* buffer() const; |
164 void setBuffer(AudioBuffer*, ExceptionState&); | 164 void setBuffer(AudioBuffer*, ExceptionState&); |
165 AudioParam* playbackRate() const; | 165 AudioParam* playbackRate() const; |
166 AudioParam* detune() const; | 166 AudioParam* detune() const; |
167 bool loop() const; | 167 bool loop() const; |
168 void setLoop(bool); | 168 void setLoop(bool); |
169 double loopStart() const; | 169 double loopStart() const; |
170 void setLoopStart(double); | 170 void setLoopStart(double); |
171 double loopEnd() const; | 171 double loopEnd() const; |
172 void setLoopEnd(double); | 172 void setLoopEnd(double); |
173 | 173 |
174 void start(ExceptionState&); | 174 void start(ExceptionState&); |
175 void start(double when, ExceptionState&); | 175 void start(double when, ExceptionState&); |
176 void start(double when, double grainOffset, ExceptionState&); | 176 void start(double when, double grainOffset, ExceptionState&); |
177 void start(double when, double grainOffset, double grainDuration, ExceptionS
tate&); | 177 void start(double when, double grainOffset, double grainDuration, ExceptionS
tate&); |
178 | 178 |
179 private: | 179 private: |
180 AudioBufferSourceNode(AudioContext&, float sampleRate); | 180 AudioBufferSourceNode(AbstractAudioContext&, float sampleRate); |
181 | 181 |
182 Member<AudioParam> m_playbackRate; | 182 Member<AudioParam> m_playbackRate; |
183 Member<AudioParam> m_detune; | 183 Member<AudioParam> m_detune; |
184 }; | 184 }; |
185 | 185 |
186 } // namespace blink | 186 } // namespace blink |
187 | 187 |
188 #endif // AudioBufferSourceNode_h | 188 #endif // AudioBufferSourceNode_h |
OLD | NEW |