| 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 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // puts it in the floating point |destination|. | 73 // puts it in the floating point |destination|. |
| 74 // It returns |true| on success, or |false| if the |sample_fmt| is | 74 // It returns |true| on success, or |false| if the |sample_fmt| is |
| 75 // not recognized. | 75 // not recognized. |
| 76 MEDIA_EXPORT bool DeinterleaveAudioChannel(void* source, | 76 MEDIA_EXPORT bool DeinterleaveAudioChannel(void* source, |
| 77 float* destination, | 77 float* destination, |
| 78 int channels, | 78 int channels, |
| 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 | |
| 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. | |
| 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 | |
| 88 // result. Thus it must be at least size: number_of_frames * source.size() | |
| 89 MEDIA_EXPORT void InterleaveFloatToInt(const AudioBus* audio_bus, | |
| 90 void* destination, | |
| 91 size_t number_of_frames, | |
| 92 int bytes_per_sample); | |
| 93 | |
| 94 // Returns the default audio output hardware sample-rate. | 83 // Returns the default audio output hardware sample-rate. |
| 95 MEDIA_EXPORT int GetAudioHardwareSampleRate(); | 84 MEDIA_EXPORT int GetAudioHardwareSampleRate(); |
| 96 | 85 |
| 97 // Returns the audio input hardware sample-rate for the specified device. | 86 // Returns the audio input hardware sample-rate for the specified device. |
| 98 MEDIA_EXPORT int GetAudioInputHardwareSampleRate( | 87 MEDIA_EXPORT int GetAudioInputHardwareSampleRate( |
| 99 const std::string& device_id); | 88 const std::string& device_id); |
| 100 | 89 |
| 101 // Returns the optimal low-latency buffer size for the audio hardware. | 90 // Returns the optimal low-latency buffer size for the audio hardware. |
| 102 // This is the smallest buffer size the system can comfortably render | 91 // This is the smallest buffer size the system can comfortably render |
| 103 // at without glitches. The buffer size is in sample-frames. | 92 // at without glitches. The buffer size is in sample-frames. |
| (...skipping 29 matching lines...) Expand all Loading... |
| 133 MEDIA_EXPORT bool IsWASAPISupported(); | 122 MEDIA_EXPORT bool IsWASAPISupported(); |
| 134 | 123 |
| 135 // Returns number of buffers to be used by wave out. | 124 // Returns number of buffers to be used by wave out. |
| 136 MEDIA_EXPORT int NumberOfWaveOutBuffers(); | 125 MEDIA_EXPORT int NumberOfWaveOutBuffers(); |
| 137 | 126 |
| 138 #endif // defined(OS_WIN) | 127 #endif // defined(OS_WIN) |
| 139 | 128 |
| 140 } // namespace media | 129 } // namespace media |
| 141 | 130 |
| 142 #endif // MEDIA_AUDIO_AUDIO_UTIL_H_ | 131 #endif // MEDIA_AUDIO_AUDIO_UTIL_H_ |
| OLD | NEW |