audio_util.h revision 50b2efef6ecb51a9d5818345c58533c5d236ec29
1/*
2 *  Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
3 *
4 *  Use of this source code is governed by a BSD-style license
5 *  that can be found in the LICENSE file in the root of the source
6 *  tree. An additional intellectual property rights grant can be found
7 *  in the file PATENTS.  All contributing project authors may
8 *  be found in the AUTHORS file in the root of the source tree.
9 */
10
11#ifndef WEBRTC_COMMON_AUDIO_INCLUDE_AUDIO_UTIL_H_
12#define WEBRTC_COMMON_AUDIO_INCLUDE_AUDIO_UTIL_H_
13
14#include "webrtc/typedefs.h"
15
16namespace webrtc {
17
18// Deinterleave audio from |interleaved| to the channel buffers pointed to
19// by |deinterleaved|. There must be sufficient space allocated in the
20// |deinterleaved| buffers (|num_channel| buffers with |samples_per_channel|
21// per buffer).
22void Deinterleave(const int16_t* interleaved, int samples_per_channel,
23                  int num_channels, int16_t** deinterleaved);
24
25// Interleave audio from the channel buffers pointed to by |deinterleaved| to
26// |interleaved|. There must be sufficient space allocated in |interleaved|
27// (|samples_per_channel| * |num_channels|).
28void Interleave(const int16_t* const* deinterleaved, int samples_per_channel,
29                int num_channels, int16_t* interleaved);
30
31}  // namespace webrtc
32
33#endif  // WEBRTC_COMMON_AUDIO_INCLUDE_AUDIO_UTIL_H_
34