Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(135)

Side by Side Diff: media/audio/audio_util.h

Issue 13726011: Add vector_math::FMUL. Replace audio_util::AdjustVolume. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix volume == 1 case. Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/audio/android/opensles_output.cc ('k') | media/audio/audio_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "build/build_config.h"
12 #include "media/base/media_export.h" 10 #include "media/base/media_export.h"
13 11
14 namespace base {
15 class SharedMemory;
16 }
17
18 namespace media { 12 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 13
42 // Returns user buffer size as specified on the command line or 0 if no buffer 14 // Returns user buffer size as specified on the command line or 0 if no buffer
43 // size has been specified. 15 // size has been specified.
44 MEDIA_EXPORT int GetUserBufferSize(); 16 MEDIA_EXPORT int GetUserBufferSize();
45 17
46 // Computes a buffer size based on the given |sample_rate|. Must be used in 18 // Computes a buffer size based on the given |sample_rate|. Must be used in
47 // conjunction with AUDIO_PCM_LINEAR. 19 // conjunction with AUDIO_PCM_LINEAR.
48 MEDIA_EXPORT size_t GetHighLatencyOutputBufferSize(int sample_rate); 20 MEDIA_EXPORT size_t GetHighLatencyOutputBufferSize(int sample_rate);
49 21
50 #if defined(OS_WIN) 22 #if defined(OS_WIN)
51 23
52 // Returns number of buffers to be used by wave out. 24 // Returns number of buffers to be used by wave out.
53 MEDIA_EXPORT int NumberOfWaveOutBuffers(); 25 MEDIA_EXPORT int NumberOfWaveOutBuffers();
54 26
55 #endif // defined(OS_WIN) 27 #endif // defined(OS_WIN)
56 28
57 } // namespace media 29 } // namespace media
58 30
59 #endif // MEDIA_AUDIO_AUDIO_UTIL_H_ 31 #endif // MEDIA_AUDIO_AUDIO_UTIL_H_
OLDNEW
« no previous file with comments | « media/audio/android/opensles_output.cc ('k') | media/audio/audio_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698