| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 void ZeroFramesPartial(int start_frame, int frames); | 101 void ZeroFramesPartial(int start_frame, int frames); |
| 102 | 102 |
| 103 // Scale internal channel values by |volume| >= 0. If an invalid value | 103 // Scale internal channel values by |volume| >= 0. If an invalid value |
| 104 // is provided, no adjustment is done. | 104 // is provided, no adjustment is done. |
| 105 void Scale(float volume); | 105 void Scale(float volume); |
| 106 | 106 |
| 107 // Swaps channels identified by |a| and |b|. The caller needs to make sure | 107 // Swaps channels identified by |a| and |b|. The caller needs to make sure |
| 108 // the channels are valid. | 108 // the channels are valid. |
| 109 void SwapChannels(int a, int b); | 109 void SwapChannels(int a, int b); |
| 110 | 110 |
| 111 virtual ~AudioBus(); |
| 112 |
| 111 private: | 113 private: |
| 112 friend struct base::DefaultDeleter<AudioBus>; | |
| 113 ~AudioBus(); | |
| 114 | |
| 115 AudioBus(int channels, int frames); | 114 AudioBus(int channels, int frames); |
| 116 AudioBus(int channels, int frames, float* data); | 115 AudioBus(int channels, int frames, float* data); |
| 117 AudioBus(int frames, const std::vector<float*>& channel_data); | 116 AudioBus(int frames, const std::vector<float*>& channel_data); |
| 118 explicit AudioBus(int channels); | 117 explicit AudioBus(int channels); |
| 119 | 118 |
| 120 // Helper method for building |channel_data_| from a block of memory. |data| | 119 // Helper method for building |channel_data_| from a block of memory. |data| |
| 121 // must be at least BlockSize() bytes in size. | 120 // must be at least BlockSize() bytes in size. |
| 122 void BuildChannelData(int channels, int aligned_frame, float* data); | 121 void BuildChannelData(int channels, int aligned_frame, float* data); |
| 123 | 122 |
| 124 // Contiguous block of channel memory. | 123 // Contiguous block of channel memory. |
| 125 scoped_ptr<float, base::AlignedFreeDeleter> data_; | 124 scoped_ptr<float, base::AlignedFreeDeleter> data_; |
| 126 | 125 |
| 127 std::vector<float*> channel_data_; | 126 std::vector<float*> channel_data_; |
| 128 int frames_; | 127 int frames_; |
| 129 | 128 |
| 130 // Protect SetChannelData() and set_frames() for use by CreateWrapper(). | 129 // Protect SetChannelData() and set_frames() for use by CreateWrapper(). |
| 131 bool can_set_channel_data_; | 130 bool can_set_channel_data_; |
| 132 | 131 |
| 133 DISALLOW_COPY_AND_ASSIGN(AudioBus); | 132 DISALLOW_COPY_AND_ASSIGN(AudioBus); |
| 134 }; | 133 }; |
| 135 | 134 |
| 136 } // namespace media | 135 } // namespace media |
| 137 | 136 |
| 138 #endif // MEDIA_BASE_AUDIO_BUS_H_ | 137 #endif // MEDIA_BASE_AUDIO_BUS_H_ |
| OLD | NEW |