| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 | 59 |
| 60 // Helper methods for converting an AudioBus from and to interleaved integer | 60 // Helper methods for converting an AudioBus from and to interleaved integer |
| 61 // data. Expects interleaving to be [ch0, ch1, ..., chN, ch0, ch1, ...] with | 61 // data. Expects interleaving to be [ch0, ch1, ..., chN, ch0, ch1, ...] with |
| 62 // |bytes_per_sample| per value. Values are scaled and bias corrected during | 62 // |bytes_per_sample| per value. Values are scaled and bias corrected during |
| 63 // conversion. ToInterleaved() will also clip values to format range. | 63 // conversion. ToInterleaved() will also clip values to format range. |
| 64 // Handles uint8_t, int16_t, and int32_t currently. FromInterleaved() will | 64 // Handles uint8_t, int16_t, and int32_t currently. FromInterleaved() will |
| 65 // zero out | 65 // zero out |
| 66 // any unfilled frames when |frames| is less than frames(). | 66 // any unfilled frames when |frames| is less than frames(). |
| 67 void FromInterleaved(const void* source, int frames, int bytes_per_sample); | 67 void FromInterleaved(const void* source, int frames, int bytes_per_sample); |
| 68 void ToInterleaved(int frames, int bytes_per_sample, void* dest) const; | 68 void ToInterleaved(int frames, int bytes_per_sample, void* dest) const; |
| 69 void ToInterleavedFloat(int source_offset, |
| 70 int destination_offset, |
| 71 int num_channels, |
| 72 float* buffer) const; |
| 69 void ToInterleavedPartial(int start_frame, int frames, int bytes_per_sample, | 73 void ToInterleavedPartial(int start_frame, int frames, int bytes_per_sample, |
| 70 void* dest) const; | 74 void* dest) const; |
| 71 | 75 |
| 72 // Similar to FromInterleaved() above, but meant for streaming sources. Does | 76 // Similar to FromInterleaved() above, but meant for streaming sources. Does |
| 73 // not zero out remaining frames, the caller is responsible for doing so using | 77 // not zero out remaining frames, the caller is responsible for doing so using |
| 74 // ZeroFramesPartial(). Frames are deinterleaved from the start of |source| | 78 // ZeroFramesPartial(). Frames are deinterleaved from the start of |source| |
| 75 // to channel(x)[start_frame]. | 79 // to channel(x)[start_frame]. |
| 76 void FromInterleavedPartial(const void* source, int start_frame, int frames, | 80 void FromInterleavedPartial(const void* source, int start_frame, int frames, |
| 77 int bytes_per_sample); | 81 int bytes_per_sample); |
| 78 | 82 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 | 159 |
| 156 AudioBusRefCounted(int channels, int frames); | 160 AudioBusRefCounted(int channels, int frames); |
| 157 ~AudioBusRefCounted() override; | 161 ~AudioBusRefCounted() override; |
| 158 | 162 |
| 159 DISALLOW_COPY_AND_ASSIGN(AudioBusRefCounted); | 163 DISALLOW_COPY_AND_ASSIGN(AudioBusRefCounted); |
| 160 }; | 164 }; |
| 161 | 165 |
| 162 } // namespace media | 166 } // namespace media |
| 163 | 167 |
| 164 #endif // MEDIA_BASE_AUDIO_BUS_H_ | 168 #endif // MEDIA_BASE_AUDIO_BUS_H_ |
| OLD | NEW |