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

Side by Side Diff: media/base/audio_bus.h

Issue 2469023002: Support floating-point audio output for Linux (Closed)
Patch Set: Implement correctly Created 4 years, 1 month 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_BASE_AUDIO_BUS_H_ 5 #ifndef MEDIA_BASE_AUDIO_BUS_H_
6 #define MEDIA_BASE_AUDIO_BUS_H_ 6 #define MEDIA_BASE_AUDIO_BUS_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 144
145 // Helper method to copy frames from one AudioBus to another. Both AudioBus 145 // Helper method to copy frames from one AudioBus to another. Both AudioBus
146 // objects must have the same number of channels(). |source_start_frame| is 146 // objects must have the same number of channels(). |source_start_frame| is
147 // the starting offset. |dest_start_frame| is the starting offset in |dest|. 147 // the starting offset. |dest_start_frame| is the starting offset in |dest|.
148 // |frame_count| is the number of frames to copy. 148 // |frame_count| is the number of frames to copy.
149 void CopyPartialFramesTo(int source_start_frame, 149 void CopyPartialFramesTo(int source_start_frame,
150 int frame_count, 150 int frame_count,
151 int dest_start_frame, 151 int dest_start_frame,
152 AudioBus* dest) const; 152 AudioBus* dest) const;
153 153
154 // Clamp the data in the bus to the range [-1, 1]. NaN is mapped to
155 // 0 (arbitrarily).
156 void Clamp();
157
154 // Returns a raw pointer to the requested channel. Pointer is guaranteed to 158 // Returns a raw pointer to the requested channel. Pointer is guaranteed to
155 // have a 16-byte alignment. Warning: Do not rely on having sane (i.e. not 159 // have a 16-byte alignment. Warning: Do not rely on having sane (i.e. not
156 // inf, nan, or between [-1.0, 1.0]) values in the channel data. 160 // inf, nan, or between [-1.0, 1.0]) values in the channel data.
157 float* channel(int channel) { return channel_data_[channel]; } 161 float* channel(int channel) { return channel_data_[channel]; }
158 const float* channel(int channel) const { return channel_data_[channel]; } 162 const float* channel(int channel) const { return channel_data_[channel]; }
159 163
160 // Returns the number of channels. 164 // Returns the number of channels.
161 int channels() const { return static_cast<int>(channel_data_.size()); } 165 int channels() const { return static_cast<int>(channel_data_.size()); }
162 // Returns the number of frames. 166 // Returns the number of frames.
163 int frames() const { return frames_; } 167 int frames() const { return frames_; }
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 324
321 AudioBusRefCounted(int channels, int frames); 325 AudioBusRefCounted(int channels, int frames);
322 ~AudioBusRefCounted() override; 326 ~AudioBusRefCounted() override;
323 327
324 DISALLOW_COPY_AND_ASSIGN(AudioBusRefCounted); 328 DISALLOW_COPY_AND_ASSIGN(AudioBusRefCounted);
325 }; 329 };
326 330
327 } // namespace media 331 } // namespace media
328 332
329 #endif // MEDIA_BASE_AUDIO_BUS_H_ 333 #endif // MEDIA_BASE_AUDIO_BUS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698