| 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 AbstractAudioContext; | 40 class BaseAudioContext; |
| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // conversion factor, and the value of playbackRate and detune AudioParams. | 134 // conversion factor, and the value of playbackRate and detune AudioParams. |
| 135 double computePlaybackRate(); | 135 double computePlaybackRate(); |
| 136 | 136 |
| 137 // The minimum playbackRate value ever used for this source. | 137 // The minimum playbackRate value ever used for this source. |
| 138 double m_minPlaybackRate; | 138 double m_minPlaybackRate; |
| 139 }; | 139 }; |
| 140 | 140 |
| 141 class AudioBufferSourceNode final : public AudioScheduledSourceNode { | 141 class AudioBufferSourceNode final : public AudioScheduledSourceNode { |
| 142 DEFINE_WRAPPERTYPEINFO(); | 142 DEFINE_WRAPPERTYPEINFO(); |
| 143 public: | 143 public: |
| 144 static AudioBufferSourceNode* create(AbstractAudioContext&, float sampleRate
); | 144 static AudioBufferSourceNode* create(BaseAudioContext&, float sampleRate); |
| 145 DECLARE_VIRTUAL_TRACE(); | 145 DECLARE_VIRTUAL_TRACE(); |
| 146 AudioBufferSourceHandler& audioBufferSourceHandler() const; | 146 AudioBufferSourceHandler& audioBufferSourceHandler() const; |
| 147 | 147 |
| 148 AudioBuffer* buffer() const; | 148 AudioBuffer* buffer() const; |
| 149 void setBuffer(AudioBuffer*, ExceptionState&); | 149 void setBuffer(AudioBuffer*, ExceptionState&); |
| 150 AudioParam* playbackRate() const; | 150 AudioParam* playbackRate() const; |
| 151 AudioParam* detune() const; | 151 AudioParam* detune() const; |
| 152 bool loop() const; | 152 bool loop() const; |
| 153 void setLoop(bool); | 153 void setLoop(bool); |
| 154 double loopStart() const; | 154 double loopStart() const; |
| 155 void setLoopStart(double); | 155 void setLoopStart(double); |
| 156 double loopEnd() const; | 156 double loopEnd() const; |
| 157 void setLoopEnd(double); | 157 void setLoopEnd(double); |
| 158 | 158 |
| 159 void start(ExceptionState&); | 159 void start(ExceptionState&); |
| 160 void start(double when, ExceptionState&); | 160 void start(double when, ExceptionState&); |
| 161 void start(double when, double grainOffset, ExceptionState&); | 161 void start(double when, double grainOffset, ExceptionState&); |
| 162 void start(double when, double grainOffset, double grainDuration, ExceptionS
tate&); | 162 void start(double when, double grainOffset, double grainDuration, ExceptionS
tate&); |
| 163 | 163 |
| 164 private: | 164 private: |
| 165 AudioBufferSourceNode(AbstractAudioContext&, float sampleRate); | 165 AudioBufferSourceNode(BaseAudioContext&, float sampleRate); |
| 166 | 166 |
| 167 Member<AudioParam> m_playbackRate; | 167 Member<AudioParam> m_playbackRate; |
| 168 Member<AudioParam> m_detune; | 168 Member<AudioParam> m_detune; |
| 169 }; | 169 }; |
| 170 | 170 |
| 171 } // namespace blink | 171 } // namespace blink |
| 172 | 172 |
| 173 #endif // AudioBufferSourceNode_h | 173 #endif // AudioBufferSourceNode_h |
| OLD | NEW |