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

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

Issue 438293003: Enable Oilpan by default for webaudio/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
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 26 matching lines...) Expand all
37 37
38 namespace blink { 38 namespace blink {
39 39
40 class AudioContext; 40 class AudioContext;
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 AudioBufferSourceNode FINAL : public AudioScheduledSourceNode { 45 class AudioBufferSourceNode FINAL : public AudioScheduledSourceNode {
46 public: 46 public:
47 static PassRefPtrWillBeRawPtr<AudioBufferSourceNode> create(AudioContext*, f loat sampleRate); 47 static AudioBufferSourceNode* create(AudioContext*, float sampleRate);
48 48
49 virtual ~AudioBufferSourceNode(); 49 virtual ~AudioBufferSourceNode();
50 50
51 // AudioNode 51 // AudioNode
52 virtual void dispose() OVERRIDE; 52 virtual void dispose() OVERRIDE;
53 virtual void process(size_t framesToProcess) OVERRIDE; 53 virtual void process(size_t framesToProcess) OVERRIDE;
54 54
55 // setBuffer() is called on the main thread. This is the buffer we use for p layback. 55 // setBuffer() is called on the main thread. This is the buffer we use for p layback.
56 void setBuffer(AudioBuffer*, ExceptionState&); 56 void setBuffer(AudioBuffer*, ExceptionState&);
57 AudioBuffer* buffer() { return m_buffer.get(); } 57 AudioBuffer* buffer() { return m_buffer.get(); }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 private: 95 private:
96 AudioBufferSourceNode(AudioContext*, float sampleRate); 96 AudioBufferSourceNode(AudioContext*, float sampleRate);
97 97
98 // Returns true on success. 98 // Returns true on success.
99 bool renderFromBuffer(AudioBus*, unsigned destinationFrameOffset, size_t num berOfFrames); 99 bool renderFromBuffer(AudioBus*, unsigned destinationFrameOffset, size_t num berOfFrames);
100 100
101 // Render silence starting from "index" frame in AudioBus. 101 // Render silence starting from "index" frame in AudioBus.
102 inline bool renderSilenceAndFinishIfNotLooping(AudioBus*, unsigned index, si ze_t framesToProcess); 102 inline bool renderSilenceAndFinishIfNotLooping(AudioBus*, unsigned index, si ze_t framesToProcess);
103 103
104 // m_buffer holds the sample data which this node outputs. 104 // m_buffer holds the sample data which this node outputs.
105 RefPtrWillBeMember<AudioBuffer> m_buffer; 105 Member<AudioBuffer> m_buffer;
106 106
107 // Pointers for the buffer and destination. 107 // Pointers for the buffer and destination.
108 OwnPtr<const float*[]> m_sourceChannels; 108 OwnPtr<const float*[]> m_sourceChannels;
109 OwnPtr<float*[]> m_destinationChannels; 109 OwnPtr<float*[]> m_destinationChannels;
110 110
111 // Used for the "playbackRate" attributes. 111 // Used for the "playbackRate" attributes.
112 RefPtrWillBeMember<AudioParam> m_playbackRate; 112 Member<AudioParam> m_playbackRate;
113 113
114 // 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. 114 // 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.
115 // If true, it will wrap around to the start of the buffer each time it reac hes the end. 115 // If true, it will wrap around to the start of the buffer each time it reac hes the end.
116 bool m_isLooping; 116 bool m_isLooping;
117 117
118 double m_loopStart; 118 double m_loopStart;
119 double m_loopEnd; 119 double m_loopEnd;
120 120
121 // m_virtualReadIndex is a sample-frame index into our buffer representing t he current playback position. 121 // m_virtualReadIndex is a sample-frame index into our buffer representing t he current playback position.
122 // Since it's floating-point, it has sub-sample accuracy. 122 // Since it's floating-point, it has sub-sample accuracy.
123 double m_virtualReadIndex; 123 double m_virtualReadIndex;
124 124
125 // Granular playback 125 // Granular playback
126 bool m_isGrain; 126 bool m_isGrain;
127 double m_grainOffset; // in seconds 127 double m_grainOffset; // in seconds
128 double m_grainDuration; // in seconds 128 double m_grainDuration; // in seconds
129 129
130 // totalPitchRate() returns the instantaneous pitch rate (non-time preservin g). 130 // totalPitchRate() returns the instantaneous pitch rate (non-time preservin g).
131 // It incorporates the base pitch rate, any sample-rate conversion factor fr om the buffer, and any doppler shift from an associated panner node. 131 // It incorporates the base pitch rate, any sample-rate conversion factor fr om the buffer, and any doppler shift from an associated panner node.
132 double totalPitchRate(); 132 double totalPitchRate();
133 133
134 // We optionally keep track of a panner node which has a doppler shift that 134 // We optionally keep track of a panner node which has a doppler shift that
135 // is incorporated into the pitch rate. 135 // is incorporated into the pitch rate.
136 // This RefPtr is connection reference. We must call AudioNode:: 136 // This RefPtr is connection reference. We must call AudioNode::
137 // makeConnection() after ref(), and call AudioNode::breakConnection() 137 // makeConnection() after ref(), and call AudioNode::breakConnection()
138 // before deref(). 138 // before deref().
139 // Oilpan: This holds connection references. We must call 139 // Oilpan: This holds connection references. We must call
140 // AudioNode::makeConnection when we add an AudioNode to this, and must call 140 // AudioNode::makeConnection when we add an AudioNode to this, and must call
141 // AudioNode::breakConnection() when we remove an AudioNode from this. 141 // AudioNode::breakConnection() when we remove an AudioNode from this.
142 RefPtrWillBeMember<PannerNode> m_pannerNode; 142 Member<PannerNode> m_pannerNode;
143 143
144 // This synchronizes process() with setBuffer() which can cause dynamic chan nel count changes. 144 // This synchronizes process() with setBuffer() which can cause dynamic chan nel count changes.
145 mutable Mutex m_processLock; 145 mutable Mutex m_processLock;
146 }; 146 };
147 147
148 } // namespace blink 148 } // namespace blink
149 149
150 #endif // AudioBufferSourceNode_h 150 #endif // AudioBufferSourceNode_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698