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 48 matching lines...) Loading... |
59 // ZeroFramesPartial(). Frames are deinterleaved from the start of |source| | 59 // ZeroFramesPartial(). Frames are deinterleaved from the start of |source| |
60 // to channel(x)[start_frame]. | 60 // to channel(x)[start_frame]. |
61 void FromInterleavedPartial(const void* source, int start_frame, int frames, | 61 void FromInterleavedPartial(const void* source, int start_frame, int frames, |
62 int bytes_per_sample); | 62 int bytes_per_sample); |
63 | 63 |
64 // Helper method for copying channel data from one AudioBus to another. Both | 64 // Helper method for copying channel data from one AudioBus to another. Both |
65 // AudioBus object must have the same frames() and channels(). | 65 // AudioBus object must have the same frames() and channels(). |
66 void CopyTo(AudioBus* dest) const; | 66 void CopyTo(AudioBus* dest) const; |
67 | 67 |
68 // Returns a raw pointer to the requested channel. Pointer is guaranteed to | 68 // Returns a raw pointer to the requested channel. Pointer is guaranteed to |
69 // have a 16-byte alignment. | 69 // have a 16-byte alignment. Warning: Do not rely on having sane (i.e. not |
| 70 // inf, nan, or between [-1.0, 1.0]) values in the channel data. |
70 float* channel(int channel) { return channel_data_[channel]; } | 71 float* channel(int channel) { return channel_data_[channel]; } |
71 const float* channel(int channel) const { return channel_data_[channel]; } | 72 const float* channel(int channel) const { return channel_data_[channel]; } |
72 | 73 |
73 int channels() const { return channel_data_.size(); } | 74 int channels() const { return channel_data_.size(); } |
74 int frames() const { return frames_; } | 75 int frames() const { return frames_; } |
75 | 76 |
76 // Helper method for zeroing out all channels of audio data. | 77 // Helper method for zeroing out all channels of audio data. |
77 void Zero(); | 78 void Zero(); |
78 void ZeroFrames(int frames); | 79 void ZeroFrames(int frames); |
79 void ZeroFramesPartial(int start_frame, int frames); | 80 void ZeroFramesPartial(int start_frame, int frames); |
(...skipping 15 matching lines...) Loading... |
95 | 96 |
96 std::vector<float*> channel_data_; | 97 std::vector<float*> channel_data_; |
97 int frames_; | 98 int frames_; |
98 | 99 |
99 DISALLOW_COPY_AND_ASSIGN(AudioBus); | 100 DISALLOW_COPY_AND_ASSIGN(AudioBus); |
100 }; | 101 }; |
101 | 102 |
102 } // namespace media | 103 } // namespace media |
103 | 104 |
104 #endif // MEDIA_BASE_AUDIO_BUS_H_ | 105 #endif // MEDIA_BASE_AUDIO_BUS_H_ |
OLD | NEW |