ardour
Classes | Public Types | Public Member Functions | Private Types | Private Attributes | List of all members
ARDOUR::BufferSet Class Reference

#include <buffer_set.h>

Classes

class  iterator_base
 

Public Types

typedef iterator_base
< BufferSet, Buffer
iterator
 
typedef iterator_base< const
BufferSet, const Buffer
const_iterator
 
typedef iterator_base
< BufferSet, AudioBuffer
audio_iterator
 
typedef iterator_base
< BufferSet, MidiBuffer
midi_iterator
 

Public Member Functions

 BufferSet ()
 
 ~BufferSet ()
 
void clear ()
 
void attach_buffers (PortSet &ports)
 
void get_backend_port_addresses (PortSet &, framecnt_t)
 
void ensure_buffers (DataType type, size_t num_buffers, size_t buffer_capacity)
 
void ensure_buffers (const ChanCount &chns, size_t buffer_capacity)
 
const ChanCountavailable () const
 
ChanCountavailable ()
 
const ChanCountcount () const
 
ChanCountcount ()
 
void silence (framecnt_t nframes, framecnt_t offset)
 
bool is_mirror () const
 
void set_count (const ChanCount &count)
 
size_t buffer_capacity (DataType type) const
 
Bufferget (DataType type, size_t i)
 
const Bufferget (DataType type, size_t i) const
 
AudioBufferget_audio (size_t i)
 
const AudioBufferget_audio (size_t i) const
 
MidiBufferget_midi (size_t i)
 
const MidiBufferget_midi (size_t i) const
 
void read_from (const BufferSet &in, framecnt_t nframes)
 
void read_from (const BufferSet &in, framecnt_t nframes, DataType)
 
void merge_from (const BufferSet &in, framecnt_t nframes)
 
iterator begin (DataType type)
 
iterator end (DataType type)
 
const_iterator begin (DataType type) const
 
const_iterator end (DataType type) const
 
audio_iterator audio_begin ()
 
audio_iterator audio_end ()
 
midi_iterator midi_begin ()
 
midi_iterator midi_end ()
 

Private Types

typedef std::vector< Buffer * > BufferVec
 

Private Attributes

std::vector< BufferVec_buffers
 Vector of vectors, indexed by DataType. More...
 
ChanCount _count
 Use counts (there may be more actual buffers than this) More...
 
ChanCount _available
 Available counts (number of buffers actually allocated) More...
 
bool _is_mirror
 False if we 'own' the contained buffers, if true we mirror a PortSet) More...
 

Detailed Description

A set of buffers of various types.

These are mainly accessed from Session and passed around as scratch buffers (eg as parameters to run() methods) to do in-place signal processing.

There are two types of counts associated with a BufferSet - available, and the 'use count'. Available is the actual number of allocated buffers (and so is the maximum acceptable value for the use counts).

The use counts are how things determine the form of their input and inform others the form of their output (eg what they did to the BufferSet). Setting the use counts is realtime safe.

Definition at line 65 of file buffer_set.h.

Member Typedef Documentation

Definition at line 172 of file buffer_set.h.

typedef std::vector<Buffer*> ARDOUR::BufferSet::BufferVec
private

Definition at line 181 of file buffer_set.h.

Definition at line 168 of file buffer_set.h.

Definition at line 164 of file buffer_set.h.

Definition at line 176 of file buffer_set.h.

Constructor & Destructor Documentation

ARDOUR::BufferSet::BufferSet ( )

Create a new, empty BufferSet

Definition at line 49 of file buffer_set.cc.

ARDOUR::BufferSet::~BufferSet ( )

Definition at line 60 of file buffer_set.cc.

Member Function Documentation

void ARDOUR::BufferSet::attach_buffers ( PortSet ports)

Set up this BufferSet so that its data structures mirror a PortSet's buffers. This is quite expensive and not RT-safe, so it should not be called in a process context; get_backend_port_addresses() will fill in a structure set up by this method.

XXX: this is called in a process context; I'm not sure quite what `should not' means above.

Definition at line 99 of file buffer_set.cc.

audio_iterator ARDOUR::BufferSet::audio_begin ( )
inline

Definition at line 173 of file buffer_set.h.

audio_iterator ARDOUR::BufferSet::audio_end ( )
inline

Definition at line 174 of file buffer_set.h.

const ChanCount& ARDOUR::BufferSet::available ( ) const
inline

Definition at line 84 of file buffer_set.h.

ChanCount& ARDOUR::BufferSet::available ( )
inline

Definition at line 85 of file buffer_set.h.

iterator ARDOUR::BufferSet::begin ( DataType  type)
inline

Definition at line 165 of file buffer_set.h.

const_iterator ARDOUR::BufferSet::begin ( DataType  type) const
inline

Definition at line 169 of file buffer_set.h.

size_t ARDOUR::BufferSet::buffer_capacity ( DataType  type) const

Get the capacity (size) of the available buffers of the given type.

All buffers of a certain type always have the same capacity.

Definition at line 234 of file buffer_set.cc.

void ARDOUR::BufferSet::clear ( )

Destroy all contained buffers.

Definition at line 68 of file buffer_set.cc.

const ChanCount& ARDOUR::BufferSet::count ( ) const
inline

Definition at line 87 of file buffer_set.h.

ChanCount& ARDOUR::BufferSet::count ( )
inline

Definition at line 88 of file buffer_set.h.

iterator ARDOUR::BufferSet::end ( DataType  type)
inline

Definition at line 166 of file buffer_set.h.

const_iterator ARDOUR::BufferSet::end ( DataType  type) const
inline

Definition at line 170 of file buffer_set.h.

void ARDOUR::BufferSet::ensure_buffers ( DataType  type,
size_t  num_buffers,
size_t  buffer_capacity 
)

Ensure that there are num_buffers buffers of type type available, each of size at least buffer_size

Definition at line 149 of file buffer_set.cc.

void ARDOUR::BufferSet::ensure_buffers ( const ChanCount chns,
size_t  buffer_capacity 
)

Ensure that the number of buffers of each type type matches chns and each buffer is of size at least buffer_capacity

Definition at line 222 of file buffer_set.cc.

Buffer & ARDOUR::BufferSet::get ( DataType  type,
size_t  i 
)

Definition at line 241 of file buffer_set.cc.

const Buffer & ARDOUR::BufferSet::get ( DataType  type,
size_t  i 
) const

Definition at line 248 of file buffer_set.cc.

AudioBuffer& ARDOUR::BufferSet::get_audio ( size_t  i)
inline

Definition at line 100 of file buffer_set.h.

const AudioBuffer& ARDOUR::BufferSet::get_audio ( size_t  i) const
inline

Definition at line 103 of file buffer_set.h.

void ARDOUR::BufferSet::get_backend_port_addresses ( PortSet ports,
framecnt_t  nframes 
)

Write the backend port addresses from a PortSet into our data structures. This call assumes that attach_buffers() has already been called for the same PortSet. Does not allocate, so RT-safe BUT you can only call Port::get_buffer() from the process() callback tree anyway, so this has to be called in RT context.

Definition at line 124 of file buffer_set.cc.

MidiBuffer& ARDOUR::BufferSet::get_midi ( size_t  i)
inline

Definition at line 107 of file buffer_set.h.

const MidiBuffer& ARDOUR::BufferSet::get_midi ( size_t  i) const
inline

Definition at line 110 of file buffer_set.h.

bool ARDOUR::BufferSet::is_mirror ( ) const
inline

Definition at line 91 of file buffer_set.h.

void ARDOUR::BufferSet::merge_from ( const BufferSet in,
framecnt_t  nframes 
)

Definition at line 445 of file buffer_set.cc.

midi_iterator ARDOUR::BufferSet::midi_begin ( )
inline

Definition at line 177 of file buffer_set.h.

midi_iterator ARDOUR::BufferSet::midi_end ( )
inline

Definition at line 178 of file buffer_set.h.

void ARDOUR::BufferSet::read_from ( const BufferSet in,
framecnt_t  nframes 
)

Copy buffers of all types from `in' to this BufferSet

Definition at line 434 of file buffer_set.cc.

void ARDOUR::BufferSet::read_from ( const BufferSet in,
framecnt_t  nframes,
DataType  type 
)

Copy buffers of one type from `in' to this BufferSet

Definition at line 420 of file buffer_set.cc.

void ARDOUR::BufferSet::set_count ( const ChanCount count)
inline

Definition at line 93 of file buffer_set.h.

void ARDOUR::BufferSet::silence ( framecnt_t  nframes,
framecnt_t  offset 
)

Definition at line 463 of file buffer_set.cc.

Member Data Documentation

ChanCount ARDOUR::BufferSet::_available
private

Available counts (number of buffers actually allocated)

Definition at line 221 of file buffer_set.h.

std::vector<BufferVec> ARDOUR::BufferSet::_buffers
private

Vector of vectors, indexed by DataType.

Definition at line 184 of file buffer_set.h.

ChanCount ARDOUR::BufferSet::_count
private

Use counts (there may be more actual buffers than this)

Definition at line 218 of file buffer_set.h.

bool ARDOUR::BufferSet::_is_mirror
private

False if we 'own' the contained buffers, if true we mirror a PortSet)

Definition at line 224 of file buffer_set.h.


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