| 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_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 <string> | 8 #include <string> |
| 9 #include <vector> | |
| 10 | 9 |
| 11 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 12 #include "media/base/channel_layout.h" | 11 #include "media/base/channel_layout.h" |
| 13 #include "media/base/media_export.h" | 12 #include "media/base/media_export.h" |
| 14 | 13 |
| 15 namespace base { | 14 namespace base { |
| 16 class SharedMemory; | 15 class SharedMemory; |
| 17 } | 16 } |
| 18 | 17 |
| 19 namespace media { | 18 namespace media { |
| 19 class AudioBus; |
| 20 | 20 |
| 21 // For all audio functions 3 audio formats are supported: | 21 // For all audio functions 3 audio formats are supported: |
| 22 // 8 bits unsigned 0 to 255. | 22 // 8 bits unsigned 0 to 255. |
| 23 // 16 bit signed (little endian). | 23 // 16 bit signed (little endian). |
| 24 // 32 bit signed (little endian) | 24 // 32 bit signed (little endian) |
| 25 | 25 |
| 26 // AdjustVolume() does a software volume adjustment of a sample buffer. | 26 // AdjustVolume() does a software volume adjustment of a sample buffer. |
| 27 // The samples are multiplied by the volume, which should range from | 27 // The samples are multiplied by the volume, which should range from |
| 28 // 0.0 (mute) to 1.0 (full volume). | 28 // 0.0 (mute) to 1.0 (full volume). |
| 29 // Using software allows each audio and video to have its own volume without | 29 // Using software allows each audio and video to have its own volume without |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 int channel_index, | 79 int channel_index, |
| 80 int bytes_per_sample, | 80 int bytes_per_sample, |
| 81 size_t number_of_frames); | 81 size_t number_of_frames); |
| 82 | 82 |
| 83 // InterleaveFloatToInt scales, clips, and interleaves the planar | 83 // InterleaveFloatToInt scales, clips, and interleaves the planar |
| 84 // floating-point audio contained in |source| to the |destination|. | 84 // floating-point audio contained in |source| to the |destination|. |
| 85 // The floating-point data is in a canonical range of -1.0 -> +1.0. | 85 // The floating-point data is in a canonical range of -1.0 -> +1.0. |
| 86 // The size of the |source| vector determines the number of channels. | 86 // The size of the |source| vector determines the number of channels. |
| 87 // The |destination| buffer is assumed to be large enough to hold the | 87 // The |destination| buffer is assumed to be large enough to hold the |
| 88 // result. Thus it must be at least size: number_of_frames * source.size() | 88 // result. Thus it must be at least size: number_of_frames * source.size() |
| 89 MEDIA_EXPORT void InterleaveFloatToInt(const std::vector<float*>& source, | 89 MEDIA_EXPORT void InterleaveFloatToInt(const AudioBus* audio_bus, |
| 90 void* destination, | 90 void* destination, |
| 91 size_t number_of_frames, | 91 size_t number_of_frames, |
| 92 int bytes_per_sample); | 92 int bytes_per_sample); |
| 93 | 93 |
| 94 // Returns the default audio output hardware sample-rate. | 94 // Returns the default audio output hardware sample-rate. |
| 95 MEDIA_EXPORT int GetAudioHardwareSampleRate(); | 95 MEDIA_EXPORT int GetAudioHardwareSampleRate(); |
| 96 | 96 |
| 97 // Returns the audio input hardware sample-rate for the specified device. | 97 // Returns the audio input hardware sample-rate for the specified device. |
| 98 MEDIA_EXPORT int GetAudioInputHardwareSampleRate( | 98 MEDIA_EXPORT int GetAudioInputHardwareSampleRate( |
| 99 const std::string& device_id); | 99 const std::string& device_id); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 MEDIA_EXPORT bool IsWASAPISupported(); | 133 MEDIA_EXPORT bool IsWASAPISupported(); |
| 134 | 134 |
| 135 // Returns number of buffers to be used by wave out. | 135 // Returns number of buffers to be used by wave out. |
| 136 MEDIA_EXPORT int NumberOfWaveOutBuffers(); | 136 MEDIA_EXPORT int NumberOfWaveOutBuffers(); |
| 137 | 137 |
| 138 #endif // defined(OS_WIN) | 138 #endif // defined(OS_WIN) |
| 139 | 139 |
| 140 } // namespace media | 140 } // namespace media |
| 141 | 141 |
| 142 #endif // MEDIA_AUDIO_AUDIO_UTIL_H_ | 142 #endif // MEDIA_AUDIO_AUDIO_UTIL_H_ |
| OLD | NEW |