summaryrefslogtreecommitdiff
path: root/src/lib/util.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-10-20 18:39:15 +0100
committerCarl Hetherington <cth@carlh.net>2012-10-20 20:05:26 +0100
commite9ca66f0d8897739cdef22f5011e0866f5a3f741 (patch)
treefacd02deef05a75094efec59b7d04f26786d1599 /src/lib/util.cc
parent068f8fe319aad390788bdea24ad21ef758d6dd03 (diff)
Clean up audio passing round a bit.
Diffstat (limited to 'src/lib/util.cc')
-rw-r--r--src/lib/util.cc36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/lib/util.cc b/src/lib/util.cc
index 3f5200ead..52a75474b 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -693,3 +693,39 @@ get_optional_int (multimap<string, string> const & kv, string k)
return lexical_cast<int> (i->second);
}
+
+AudioBuffers::AudioBuffers (int channels, int frames)
+ : _channels (channels)
+ , _frames (frames)
+{
+ _data = new float*[_channels];
+ for (int i = 0; i < _channels; ++i) {
+ _data[i] = new float[frames];
+ }
+}
+
+AudioBuffers::~AudioBuffers ()
+{
+ for (int i = 0; i < _channels; ++i) {
+ delete[] _data[i];
+ }
+
+ delete[] _data;
+}
+
+float*
+AudioBuffers::data (int c) const
+{
+ assert (c >= 0 && c < _channels);
+ return _data[c];
+}
+
+void
+AudioBuffers::set_frames (int f)
+{
+ assert (f <= _frames);
+ _frames = f;
+}
+
+
+