| 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> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // simplify hardware requirements and to support a wider variety of input | 33 // simplify hardware requirements and to support a wider variety of input |
| 34 // formats. | 34 // formats. |
| 35 // The buffer is modified in-place to avoid memory management, as this | 35 // The buffer is modified in-place to avoid memory management, as this |
| 36 // function may be called in performance critical code. | 36 // function may be called in performance critical code. |
| 37 MEDIA_EXPORT bool AdjustVolume(void* buf, | 37 MEDIA_EXPORT bool AdjustVolume(void* buf, |
| 38 size_t buflen, | 38 size_t buflen, |
| 39 int channels, | 39 int channels, |
| 40 int bytes_per_sample, | 40 int bytes_per_sample, |
| 41 float volume); | 41 float volume); |
| 42 | 42 |
| 43 // MixStreams() mixes 2 audio streams with same sample rate and number of |
| 44 // samples, adjusting volume on one of them. |
| 45 // Dst += Src * volume. |
| 46 MEDIA_EXPORT void MixStreams(void* dst, |
| 47 void* src, |
| 48 size_t buflen, |
| 49 int bytes_per_sample, |
| 50 float volume); |
| 51 |
| 43 // FoldChannels() does a software multichannel folding down to stereo. | 52 // FoldChannels() does a software multichannel folding down to stereo. |
| 44 // Channel order is assumed to be 5.1 Dolby standard which is | 53 // Channel order is assumed to be 5.1 Dolby standard which is |
| 45 // front left, front right, center, surround left, surround right. | 54 // front left, front right, center, surround left, surround right. |
| 46 // The subwoofer is ignored. | 55 // The subwoofer is ignored. |
| 47 // 6.1 adds a rear center speaker, and 7.1 has 2 rear speakers. These | 56 // 6.1 adds a rear center speaker, and 7.1 has 2 rear speakers. These |
| 48 // channels are rare and ignored. | 57 // channels are rare and ignored. |
| 49 // After summing the channels, volume is adjusted and the samples are | 58 // After summing the channels, volume is adjusted and the samples are |
| 50 // clipped to the maximum value. | 59 // clipped to the maximum value. |
| 51 // Volume should normally range from 0.0 (mute) to 1.0 (full volume), but | 60 // Volume should normally range from 0.0 (mute) to 1.0 (full volume), but |
| 52 // since clamping is performed a value of more than 1 is allowed to increase | 61 // since clamping is performed a value of more than 1 is allowed to increase |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 | 126 |
| 118 // Does Windows support WASAPI? We are checking in lot of places, and | 127 // Does Windows support WASAPI? We are checking in lot of places, and |
| 119 // sometimes check was written incorrectly, so move into separate function. | 128 // sometimes check was written incorrectly, so move into separate function. |
| 120 MEDIA_EXPORT bool IsWASAPISupported(); | 129 MEDIA_EXPORT bool IsWASAPISupported(); |
| 121 | 130 |
| 122 #endif // defined(OS_WIN) | 131 #endif // defined(OS_WIN) |
| 123 | 132 |
| 124 } // namespace media | 133 } // namespace media |
| 125 | 134 |
| 126 #endif // MEDIA_AUDIO_AUDIO_UTIL_H_ | 135 #endif // MEDIA_AUDIO_AUDIO_UTIL_H_ |
| OLD | NEW |