Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_AUDIO_AUDIO_UTIL_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_UTIL_H_ |
| 6 #define MEDIA_AUDIO_AUDIO_UTIL_H_ | 6 #define MEDIA_AUDIO_AUDIO_UTIL_H_ |
| 7 | 7 |
| 8 #include <vector> | |
| 9 | |
| 8 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 9 | 11 |
| 10 namespace media { | 12 namespace media { |
| 11 | 13 |
| 12 // For all audio functions 3 audio formats are supported: | 14 // For all audio functions 3 audio formats are supported: |
| 13 // 8 bits unsigned 0 to 255. | 15 // 8 bits unsigned 0 to 255. |
| 14 // 16 bit signed (little endian). | 16 // 16 bit signed (little endian). |
| 15 // 32 bit signed (little endian) | 17 // 32 bit signed (little endian) |
| 16 | 18 |
| 17 // AdjustVolume() does a software volume adjustment of a sample buffer. | 19 // AdjustVolume() does a software volume adjustment of a sample buffer. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 // puts it in the floating point |destination|. | 57 // puts it in the floating point |destination|. |
| 56 // It returns |true| on success, or |false| if the |sample_fmt| is | 58 // It returns |true| on success, or |false| if the |sample_fmt| is |
| 57 // not recognized. | 59 // not recognized. |
| 58 bool DeinterleaveAudioChannel(void* source, | 60 bool DeinterleaveAudioChannel(void* source, |
| 59 float* destination, | 61 float* destination, |
| 60 int channels, | 62 int channels, |
| 61 int channel_index, | 63 int channel_index, |
| 62 int bytes_per_sample, | 64 int bytes_per_sample, |
| 63 size_t number_of_frames); | 65 size_t number_of_frames); |
| 64 | 66 |
| 67 // InterleaveFloatToInt16 scales, clips, and interleaves the planar | |
| 68 // floating-point audio contained in |source| to the int16 |destination|. | |
| 69 // The floating-point data is in a canonical range of -1.0 -> +1.0. | |
| 70 // The size of the |source| vector determines the number of channels. | |
| 71 // The |destination| buffer is assumed to be large enough to hold the | |
| 72 // result. Thus it must be at least size: number_of_frames * source.size() | |
| 73 void InterleaveFloatToInt16(std::vector<float*> source, | |
|
scherkus (not reviewing)
2011/01/12 03:11:43
can source be const ref?
const std::vector<float*>
Chris Rogers
2011/01/12 21:26:10
Yes, of course! --- FIXED
On 2011/01/12 03:11:43,
| |
| 74 int16* destination, | |
| 75 size_t number_of_frames); | |
| 76 | |
| 65 } // namespace media | 77 } // namespace media |
| 66 | 78 |
| 67 #endif // MEDIA_AUDIO_AUDIO_UTIL_H_ | 79 #endif // MEDIA_AUDIO_AUDIO_UTIL_H_ |
| OLD | NEW |