OLD | NEW |
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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/aligned_memory.h" | 10 #include "base/memory/aligned_memory.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // AudioBus object must have the same frames() and channels(). | 76 // AudioBus object must have the same frames() and channels(). |
77 void CopyTo(AudioBus* dest) const; | 77 void CopyTo(AudioBus* dest) const; |
78 | 78 |
79 // Returns a raw pointer to the requested channel. Pointer is guaranteed to | 79 // Returns a raw pointer to the requested channel. Pointer is guaranteed to |
80 // have a 16-byte alignment. Warning: Do not rely on having sane (i.e. not | 80 // have a 16-byte alignment. Warning: Do not rely on having sane (i.e. not |
81 // inf, nan, or between [-1.0, 1.0]) values in the channel data. | 81 // inf, nan, or between [-1.0, 1.0]) values in the channel data. |
82 float* channel(int channel) { return channel_data_[channel]; } | 82 float* channel(int channel) { return channel_data_[channel]; } |
83 const float* channel(int channel) const { return channel_data_[channel]; } | 83 const float* channel(int channel) const { return channel_data_[channel]; } |
84 void SetChannelData(int channel, float* data); | 84 void SetChannelData(int channel, float* data); |
85 | 85 |
86 int channels() const { return channel_data_.size(); } | 86 int channels() const { return static_cast<int>(channel_data_.size()); } |
87 int frames() const { return frames_; } | 87 int frames() const { return frames_; } |
88 void set_frames(int frames); | 88 void set_frames(int frames); |
89 | 89 |
90 // Helper method for zeroing out all channels of audio data. | 90 // Helper method for zeroing out all channels of audio data. |
91 void Zero(); | 91 void Zero(); |
92 void ZeroFrames(int frames); | 92 void ZeroFrames(int frames); |
93 void ZeroFramesPartial(int start_frame, int frames); | 93 void ZeroFramesPartial(int start_frame, int frames); |
94 | 94 |
95 private: | 95 private: |
96 friend struct base::DefaultDeleter<AudioBus>; | 96 friend struct base::DefaultDeleter<AudioBus>; |
(...skipping 16 matching lines...) Expand all Loading... |
113 | 113 |
114 // Protect SetChannelData() and set_frames() for use by CreateWrapper(). | 114 // Protect SetChannelData() and set_frames() for use by CreateWrapper(). |
115 bool can_set_channel_data_; | 115 bool can_set_channel_data_; |
116 | 116 |
117 DISALLOW_COPY_AND_ASSIGN(AudioBus); | 117 DISALLOW_COPY_AND_ASSIGN(AudioBus); |
118 }; | 118 }; |
119 | 119 |
120 } // namespace media | 120 } // namespace media |
121 | 121 |
122 #endif // MEDIA_BASE_AUDIO_BUS_H_ | 122 #endif // MEDIA_BASE_AUDIO_BUS_H_ |
OLD | NEW |