Chromium Code Reviews| 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, adjusting volume on one of them. | |
| 44 // Dst += Src * volume. | |
|
vrk (LEFT CHROMIUM)
2012/03/12 18:40:24
This function assumes |dst| and |src| have the sam
enal1
2012/03/12 21:20:53
Done.
| |
| 45 MEDIA_EXPORT void MixStreams(void* dst, | |
| 46 void* src, | |
| 47 size_t buflen, | |
| 48 int bytes_per_sample, | |
| 49 float volume); | |
| 50 | |
| 43 // FoldChannels() does a software multichannel folding down to stereo. | 51 // FoldChannels() does a software multichannel folding down to stereo. |
| 44 // Channel order is assumed to be 5.1 Dolby standard which is | 52 // Channel order is assumed to be 5.1 Dolby standard which is |
| 45 // front left, front right, center, surround left, surround right. | 53 // front left, front right, center, surround left, surround right. |
| 46 // The subwoofer is ignored. | 54 // The subwoofer is ignored. |
| 47 // 6.1 adds a rear center speaker, and 7.1 has 2 rear speakers. These | 55 // 6.1 adds a rear center speaker, and 7.1 has 2 rear speakers. These |
| 48 // channels are rare and ignored. | 56 // channels are rare and ignored. |
| 49 // After summing the channels, volume is adjusted and the samples are | 57 // After summing the channels, volume is adjusted and the samples are |
| 50 // clipped to the maximum value. | 58 // clipped to the maximum value. |
| 51 // Volume should normally range from 0.0 (mute) to 1.0 (full volume), but | 59 // 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 | 60 // 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 | 125 |
| 118 // Does Windows support WASAPI? We are checking in lot of places, and | 126 // Does Windows support WASAPI? We are checking in lot of places, and |
| 119 // sometimes check was written incorrectly, so move into separate function. | 127 // sometimes check was written incorrectly, so move into separate function. |
| 120 MEDIA_EXPORT bool IsWASAPISupported(); | 128 MEDIA_EXPORT bool IsWASAPISupported(); |
| 121 | 129 |
| 122 #endif // defined(OS_WIN) | 130 #endif // defined(OS_WIN) |
| 123 | 131 |
| 124 } // namespace media | 132 } // namespace media |
| 125 | 133 |
| 126 #endif // MEDIA_AUDIO_AUDIO_UTIL_H_ | 134 #endif // MEDIA_AUDIO_AUDIO_UTIL_H_ |
| OLD | NEW |