| 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 12 matching lines...) Expand all Loading... |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 #ifndef AudioBufferSourceNode_h | 25 #ifndef AudioBufferSourceNode_h |
| 26 #define AudioBufferSourceNode_h | 26 #define AudioBufferSourceNode_h |
| 27 | 27 |
| 28 #include "modules/webaudio/AudioBuffer.h" | 28 #include "modules/webaudio/AudioBuffer.h" |
| 29 #include "modules/webaudio/AudioParam.h" | 29 #include "modules/webaudio/AudioParam.h" |
| 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" | |
| 34 #include "wtf/PassRefPtr.h" | 33 #include "wtf/PassRefPtr.h" |
| 35 #include "wtf/RefPtr.h" | 34 #include "wtf/RefPtr.h" |
| 36 #include "wtf/Threading.h" | 35 #include "wtf/Threading.h" |
| 36 #include <memory> |
| 37 | 37 |
| 38 namespace blink { | 38 namespace blink { |
| 39 | 39 |
| 40 class AbstractAudioContext; | 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: |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 | 96 |
| 97 // Clamps grain parameters to the duration of the given AudioBuffer. | 97 // Clamps grain parameters to the duration of the given AudioBuffer. |
| 98 void clampGrainParameters(const AudioBuffer*); | 98 void clampGrainParameters(const AudioBuffer*); |
| 99 | 99 |
| 100 // m_buffer holds the sample data which this node outputs. | 100 // m_buffer holds the sample data which this node outputs. |
| 101 // This Persistent doesn't make a reference cycle including | 101 // This Persistent doesn't make a reference cycle including |
| 102 // AudioBufferSourceNode. | 102 // AudioBufferSourceNode. |
| 103 Persistent<AudioBuffer> m_buffer; | 103 Persistent<AudioBuffer> m_buffer; |
| 104 | 104 |
| 105 // Pointers for the buffer and destination. | 105 // Pointers for the buffer and destination. |
| 106 OwnPtr<const float*[]> m_sourceChannels; | 106 std::unique_ptr<const float*[]> m_sourceChannels; |
| 107 OwnPtr<float*[]> m_destinationChannels; | 107 std::unique_ptr<float*[]> m_destinationChannels; |
| 108 | 108 |
| 109 RefPtr<AudioParamHandler> m_playbackRate; | 109 RefPtr<AudioParamHandler> m_playbackRate; |
| 110 RefPtr<AudioParamHandler> m_detune; | 110 RefPtr<AudioParamHandler> m_detune; |
| 111 | 111 |
| 112 // If m_isLooping is false, then this node will be done playing and become i
nactive after it reaches the end of the sample data in the buffer. | 112 // If m_isLooping is false, then this node will be done playing and become i
nactive after it reaches the end of the sample data in the buffer. |
| 113 // If true, it will wrap around to the start of the buffer each time it reac
hes the end. | 113 // If true, it will wrap around to the start of the buffer each time it reac
hes the end. |
| 114 bool m_isLooping; | 114 bool m_isLooping; |
| 115 | 115 |
| 116 // True if the source .loop attribute was ever set. | 116 // True if the source .loop attribute was ever set. |
| 117 bool m_didSetLooping; | 117 bool m_didSetLooping; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 private: | 164 private: |
| 165 AudioBufferSourceNode(AbstractAudioContext&); | 165 AudioBufferSourceNode(AbstractAudioContext&); |
| 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 |