ardour
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ARDOUR::Buffer Class Referenceabstract

#include <buffer.h>

Inheritance diagram for ARDOUR::Buffer:
ARDOUR::AudioBuffer ARDOUR::MidiBuffer

Public Member Functions

virtual ~Buffer ()
 
size_t capacity () const
 
DataType type () const
 
bool silent () const
 
virtual void resize (size_t)=0
 
virtual void silence (framecnt_t len, framecnt_t offset=0)=0
 
virtual void clear ()
 
virtual void read_from (const Buffer &src, framecnt_t len, framecnt_t dst_offset=0, framecnt_t src_offset=0)=0
 
virtual void merge_from (const Buffer &src, framecnt_t len, framecnt_t dst_offset=0, framecnt_t src_offset=0)=0
 

Static Public Member Functions

static Buffercreate (DataType type, size_t capacity)
 

Protected Member Functions

 Buffer (DataType type)
 

Protected Attributes

DataType _type
 
pframes_t _capacity
 
bool _silent
 

Detailed Description

A buffer of recordable/playable data.

This is a datatype-agnostic base class for all buffers (there are no methods to actually access the data). This provides a way for code that doesn't care about the data type to still deal with buffers (which is why the base class can't be a template).

To actually read/write buffer contents, use the appropriate derived class.

Definition at line 42 of file buffer.h.

Constructor & Destructor Documentation

virtual ARDOUR::Buffer::~Buffer ( )
inlinevirtual

Definition at line 45 of file buffer.h.

ARDOUR::Buffer::Buffer ( DataType  type)
inlineprotected

Definition at line 76 of file buffer.h.

Member Function Documentation

size_t ARDOUR::Buffer::capacity ( ) const
inline

Maximum capacity of buffer.

Definition at line 51 of file buffer.h.

virtual void ARDOUR::Buffer::clear ( )
inlinevirtual

Clear the entire buffer

Definition at line 70 of file buffer.h.

Buffer * ARDOUR::Buffer::create ( DataType  type,
size_t  capacity 
)
static

Factory function

Definition at line 27 of file buffer.cc.

virtual void ARDOUR::Buffer::merge_from ( const Buffer src,
framecnt_t  len,
framecnt_t  dst_offset = 0,
framecnt_t  src_offset = 0 
)
pure virtual
virtual void ARDOUR::Buffer::read_from ( const Buffer src,
framecnt_t  len,
framecnt_t  dst_offset = 0,
framecnt_t  src_offset = 0 
)
pure virtual
virtual void ARDOUR::Buffer::resize ( size_t  )
pure virtual

Reallocate the buffer used internally to handle at least size_t units of data.

The buffer is not silent after this operation. the capacity argument passed to the constructor must have been non-zero.

Implemented in ARDOUR::AudioBuffer, and ARDOUR::MidiBuffer.

virtual void ARDOUR::Buffer::silence ( framecnt_t  len,
framecnt_t  offset = 0 
)
pure virtual

Clear (eg zero, or empty) buffer

Implemented in ARDOUR::MidiBuffer, and ARDOUR::AudioBuffer.

bool ARDOUR::Buffer::silent ( ) const
inline

Definition at line 57 of file buffer.h.

DataType ARDOUR::Buffer::type ( ) const
inline

Type of this buffer. Based on this you can static cast a Buffer* to the desired type.

Definition at line 55 of file buffer.h.

Member Data Documentation

pframes_t ARDOUR::Buffer::_capacity
protected

Definition at line 81 of file buffer.h.

bool ARDOUR::Buffer::_silent
protected

Definition at line 82 of file buffer.h.

DataType ARDOUR::Buffer::_type
protected

Definition at line 80 of file buffer.h.


The documentation for this class was generated from the following files: