summaryrefslogtreecommitdiffstats
path: root/media/audio/audio_util.h
diff options
context:
space:
mode:
authorfbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-25 03:16:21 +0000
committerfbarchard@chromium.org <fbarchard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-25 03:16:21 +0000
commit9787fec1d6a14f3ca72288d277d3049c2c65b85e (patch)
tree07c5beebcd00439d414831d179cec77d7dfe0c38 /media/audio/audio_util.h
parente435d6b7103f0d0c57133121454458bda6ccb69f (diff)
downloadchromium_src-9787fec1d6a14f3ca72288d277d3049c2c65b85e.zip
chromium_src-9787fec1d6a14f3ca72288d277d3049c2c65b85e.tar.gz
chromium_src-9787fec1d6a14f3ca72288d277d3049c2c65b85e.tar.bz2
Surround Sound handling by folding 5 channels down to stereo.
BUG=16026 TEST=play a movie trailer with 5.1 audio. It should sound roughly the same as quicktime. Review URL: http://codereview.chromium.org/155894 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21613 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio/audio_util.h')
-rw-r--r--media/audio/audio_util.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/media/audio/audio_util.h b/media/audio/audio_util.h
index 14fe169..edfe7ab 100644
--- a/media/audio/audio_util.h
+++ b/media/audio/audio_util.h
@@ -9,6 +9,11 @@
namespace media {
+// For all audio functions 3 audio formats are supported:
+// 8 bits unsigned 0 to 255.
+// 16 bit signed (little endian).
+// 32 bit signed (little endian)
+
// AdjustVolume() does a software volume adjustment of a sample buffer.
// The samples are multiplied by the volume, which should range from
// 0.0 (mute) to 1.0 (full volume).
@@ -25,6 +30,25 @@ bool AdjustVolume(void* buf,
int bytes_per_sample,
float volume);
+// FoldChannels() does a software multichannel folding down to stereo.
+// Channel order is assumed to be 5.1 Dolby standard which is
+// front left, front right, center, surround left, surround right.
+// The subwoofer is ignored.
+// 6.1 adds a rear center speaker, and 7.1 has 2 rear speakers. These
+// channels are rare and ignored.
+// After summing the channels, volume is adjusted and the samples are
+// clipped to the maximum value.
+// Volume should normally range from 0.0 (mute) to 1.0 (full volume), but
+// since clamping is performed a value of more than 1 is allowed to increase
+// volume.
+// The buffer is modified in-place to avoid memory management, as this
+// function may be called in performance critical code.
+bool FoldChannels(void* buf,
+ size_t buflen,
+ int channels,
+ int bytes_per_sample,
+ float volume);
+
} // namespace media
#endif // MEDIA_AUDIO_AUDIO_UTIL_H_