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> | |
| 9 | |
| 10 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 11 #include "media/base/channel_layout.h" | 9 #include "base/time.h" |
| 10 #include "build/build_config.h" | |
|
Chris Rogers
2013/04/05 21:31:35
just curious why these new header files?
DaleCurtis
2013/04/05 23:52:30
The defined(OS_WIN) should have build_config.h ava
| |
| 12 #include "media/base/media_export.h" | 11 #include "media/base/media_export.h" |
| 13 | 12 |
| 14 namespace base { | |
| 15 class SharedMemory; | |
| 16 } | |
| 17 | |
| 18 namespace media { | 13 namespace media { |
| 19 class AudioBus; | |
| 20 | |
| 21 // For all audio functions 3 audio formats are supported: | |
| 22 // 8 bits unsigned 0 to 255. | |
| 23 // 16 bit signed (little endian). | |
| 24 // 32 bit signed (little endian) | |
| 25 | |
| 26 // AdjustVolume() does a software volume adjustment of a sample buffer. | |
| 27 // The samples are multiplied by the volume, which should range from | |
| 28 // 0.0 (mute) to 1.0 (full volume). | |
| 29 // Using software allows each audio and video to have its own volume without | |
| 30 // affecting the master volume. | |
| 31 // In the future the function may be used to adjust the sample format to | |
| 32 // simplify hardware requirements and to support a wider variety of input | |
| 33 // formats. | |
| 34 // The buffer is modified in-place to avoid memory management, as this | |
| 35 // function may be called in performance critical code. | |
| 36 MEDIA_EXPORT bool AdjustVolume(void* buf, | |
| 37 size_t buflen, | |
| 38 int channels, | |
| 39 int bytes_per_sample, | |
| 40 float volume); | |
| 41 | 14 |
| 42 // Returns user buffer size as specified on the command line or 0 if no buffer | 15 // Returns user buffer size as specified on the command line or 0 if no buffer |
| 43 // size has been specified. | 16 // size has been specified. |
| 44 MEDIA_EXPORT int GetUserBufferSize(); | 17 MEDIA_EXPORT int GetUserBufferSize(); |
| 45 | 18 |
| 46 // Computes a buffer size based on the given |sample_rate|. Must be used in | 19 // Computes a buffer size based on the given |sample_rate|. Must be used in |
| 47 // conjunction with AUDIO_PCM_LINEAR. | 20 // conjunction with AUDIO_PCM_LINEAR. |
| 48 MEDIA_EXPORT size_t GetHighLatencyOutputBufferSize(int sample_rate); | 21 MEDIA_EXPORT size_t GetHighLatencyOutputBufferSize(int sample_rate); |
| 49 | 22 |
| 50 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
| 51 | 24 |
| 52 // Returns number of buffers to be used by wave out. | 25 // Returns number of buffers to be used by wave out. |
| 53 MEDIA_EXPORT int NumberOfWaveOutBuffers(); | 26 MEDIA_EXPORT int NumberOfWaveOutBuffers(); |
| 54 | 27 |
| 55 #endif // defined(OS_WIN) | 28 #endif // defined(OS_WIN) |
| 56 | 29 |
| 57 } // namespace media | 30 } // namespace media |
| 58 | 31 |
| 59 #endif // MEDIA_AUDIO_AUDIO_UTIL_H_ | 32 #endif // MEDIA_AUDIO_AUDIO_UTIL_H_ |
| OLD | NEW |