2 Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 #include <boost/shared_ptr.hpp>
22 /** @class AudioBuffers
23 * @brief A class to hold multi-channel audio data in float format.
28 AudioBuffers (int channels, int frames);
29 AudioBuffers (AudioBuffers const &);
30 AudioBuffers (boost::shared_ptr<const AudioBuffers>);
33 void ensure_size (int);
35 float** data () const {
39 float* data (int) const;
41 int channels () const {
49 void set_frames (int f);
52 void make_silent (int c);
53 void make_silent (int from, int frames);
55 void copy_from (AudioBuffers const * from, int frames_to_copy, int read_offset, int write_offset);
56 void move (int from, int to, int frames);
57 void accumulate_channel (AudioBuffers const *, int, int);
58 void accumulate_frames (AudioBuffers const *, int read_offset, int write_offset, int frames);
61 /** Number of channels */
63 /** Number of frames (where a frame is one sample across all channels) */
65 /** Number of frames that _data can hold */
66 int _allocated_frames;
67 /** Audio data (so that, e.g. _data[2][6] is channel 2, sample 6) */