ardour
buffer.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2006 Paul Davis
3 
4  This program is free software; you can redistribute it and/or modify it
5  under the terms of the GNU General Public License as published by the Free
6  Software Foundation; either version 2 of the License, or (at your option)
7  any later version.
8 
9  This program is distributed in the hope that it will be useful, but WITHOUT
10  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12  for more details.
13 
14  You should have received a copy of the GNU General Public License along
15  with this program; if not, write to the Free Software Foundation, Inc.,
16  675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18 
19 #ifndef __ardour_buffer_h__
20 #define __ardour_buffer_h__
21 
22 #include <stddef.h>
23 
24 #include <boost/utility.hpp>
25 
27 #include "ardour/types.h"
28 #include "ardour/data_type.h"
29 
30 namespace ARDOUR {
31 
32 
42 class LIBARDOUR_API Buffer : public boost::noncopyable
43 {
44 public:
45  virtual ~Buffer() {}
46 
48  static Buffer* create(DataType type, size_t capacity);
49 
51  size_t capacity() const { return _capacity; }
52 
55  DataType type() const { return _type; }
56 
57  bool silent() const { return _silent; }
58 
64  virtual void resize (size_t) = 0;
65 
67  virtual void silence (framecnt_t len, framecnt_t offset = 0) = 0;
68 
70  virtual void clear() { silence(_capacity, 0); }
71 
72  virtual void read_from (const Buffer& src, framecnt_t len, framecnt_t dst_offset = 0, framecnt_t src_offset = 0) = 0;
73  virtual void merge_from (const Buffer& src, framecnt_t len, framecnt_t dst_offset = 0, framecnt_t src_offset = 0) = 0;
74 
75  protected:
77  : _type(type), _capacity(0), _silent (true)
78  {}
79 
82  bool _silent;
83 };
84 
85 
86 } // namespace ARDOUR
87 
88 #endif // __ardour_buffer_h__
DataType type() const
Definition: buffer.h:55
bool silent() const
Definition: buffer.h:57
pframes_t _capacity
Definition: buffer.h:81
uint32_t pframes_t
Definition: types.h:61
Buffer(DataType type)
Definition: buffer.h:76
DataType _type
Definition: buffer.h:80
int64_t framecnt_t
Definition: types.h:76
virtual ~Buffer()
Definition: buffer.h:45
Definition: amp.h:29
#define LIBARDOUR_API
size_t capacity() const
Definition: buffer.h:51
virtual void clear()
Definition: buffer.h:70
bool _silent
Definition: buffer.h:82