Ardour  9.0-pre0-350-gf17a656217
ARDOUR::AudioBuffer Class Reference

#include <audio_buffer.h>

Inheritance diagram for ARDOUR::AudioBuffer:
[legend]

Public Member Functions

 AudioBuffer (size_t capacity)
 
 ~AudioBuffer ()
 
void silence (samplecnt_t len, samplecnt_t offset=0)
 
bool silent_data () const
 
void read_from (const Sample *src, samplecnt_t len, sampleoffset_t dst_offset=0, sampleoffset_t src_offset=0)
 
void read_from (const Buffer &src, samplecnt_t len, sampleoffset_t dst_offset=0, sampleoffset_t src_offset=0)
 
void merge_from (const Buffer &src, samplecnt_t len, sampleoffset_t dst_offset=0, sampleoffset_t src_offset=0)
 
void accumulate_from (const AudioBuffer &src, samplecnt_t len, sampleoffset_t dst_offset=0, sampleoffset_t src_offset=0)
 
void accumulate_from (const Sample *src, samplecnt_t len, sampleoffset_t dst_offset=0, sampleoffset_t src_offset=0)
 
void accumulate_with_gain_from (const AudioBuffer &src, samplecnt_t len, gain_t gain_coeff, sampleoffset_t dst_offset=0, sampleoffset_t src_offset=0)
 
void accumulate_with_gain_from (const Sample *src_raw, samplecnt_t len, gain_t gain_coeff, sampleoffset_t dst_offset=0)
 
void accumulate_with_ramped_gain_from (const Sample *src, samplecnt_t len, gain_t initial, gain_t target, sampleoffset_t dst_offset=0)
 
void apply_gain (gain_t gain, samplecnt_t len)
 
void set_data (Sample *data, size_t size)
 
void resize (size_t nframes)
 
const Sampledata (samplecnt_t offset=0) const
 
Sampledata (samplecnt_t offset=0)
 
bool check_silence (pframes_t nframes, pframes_t &n) const
 
void prepare ()
 
bool written () const
 
void set_written (bool w)
 
- Public Member Functions inherited from ARDOUR::Buffer
 Buffer (const Buffer &)=delete
 
Bufferoperator= (const Buffer &)=delete
 
virtual ~Buffer ()
 
size_t capacity () const
 
DataType type () const
 
bool silent () const
 
virtual void clear ()
 

Private Attributes

bool _owns_data
 
bool _written
 
Sample_data
 Actual buffer contents. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from ARDOUR::Buffer
static Buffercreate (DataType type, size_t capacity)
 
- Protected Member Functions inherited from ARDOUR::Buffer
 Buffer (DataType type)
 
- Protected Attributes inherited from ARDOUR::Buffer
DataType _type
 
pframes_t _capacity
 
bool _silent
 

Detailed Description

Buffer containing audio data.

Definition at line 32 of file audio_buffer.h.

Constructor & Destructor Documentation

◆ AudioBuffer()

ARDOUR::AudioBuffer::AudioBuffer ( size_t  capacity)

◆ ~AudioBuffer()

ARDOUR::AudioBuffer::~AudioBuffer ( )

Member Function Documentation

◆ accumulate_from() [1/2]

void ARDOUR::AudioBuffer::accumulate_from ( const AudioBuffer src,
samplecnt_t  len,
sampleoffset_t  dst_offset = 0,
sampleoffset_t  src_offset = 0 
)
inline

Accumulate (add) len samples from src starting at src_offset into self starting at dst_offset

Definition at line 99 of file audio_buffer.h.

◆ accumulate_from() [2/2]

void ARDOUR::AudioBuffer::accumulate_from ( const Sample src,
samplecnt_t  len,
sampleoffset_t  dst_offset = 0,
sampleoffset_t  src_offset = 0 
)
inline

Accumulate (add) len samples of src starting at src_offset into self starting at dst_offset

Definition at line 118 of file audio_buffer.h.

◆ accumulate_with_gain_from() [1/2]

void ARDOUR::AudioBuffer::accumulate_with_gain_from ( const AudioBuffer src,
samplecnt_t  len,
gain_t  gain_coeff,
sampleoffset_t  dst_offset = 0,
sampleoffset_t  src_offset = 0 
)
inline

Accumulate (add) len samples if src starting at src_offset into self starting at dst_offset scaling by gain_coeff

Definition at line 135 of file audio_buffer.h.

◆ accumulate_with_gain_from() [2/2]

void ARDOUR::AudioBuffer::accumulate_with_gain_from ( const Sample src_raw,
samplecnt_t  len,
gain_t  gain_coeff,
sampleoffset_t  dst_offset = 0 
)
inline

Accumulate (add) len samples from the start of src_raw into self at dst_offset scaling by gain_coeff

Definition at line 156 of file audio_buffer.h.

◆ accumulate_with_ramped_gain_from()

void ARDOUR::AudioBuffer::accumulate_with_ramped_gain_from ( const Sample src,
samplecnt_t  len,
gain_t  initial,
gain_t  target,
sampleoffset_t  dst_offset = 0 
)
inline

Accumulate (add) len samples from the start of src into self at dst_offset using a linear gain ramp from initial to target .

Definition at line 172 of file audio_buffer.h.

◆ apply_gain()

void ARDOUR::AudioBuffer::apply_gain ( gain_t  gain,
samplecnt_t  len 
)
inline

Apply a fixed gain factor to the audio buffer

Parameters
gaingain factor
lennumber of samples to amplify

Definition at line 198 of file audio_buffer.h.

◆ check_silence()

bool ARDOUR::AudioBuffer::check_silence ( pframes_t  nframes,
pframes_t n 
) const

Check buffer for silence

Parameters
nframesnumber of samples to check
nfirst non zero sample (if any)
Returns
true if all samples are zero

◆ data() [1/2]

Sample* ARDOUR::AudioBuffer::data ( samplecnt_t  offset = 0)
inline

Definition at line 235 of file audio_buffer.h.

◆ data() [2/2]

const Sample* ARDOUR::AudioBuffer::data ( samplecnt_t  offset = 0) const
inline

Definition at line 229 of file audio_buffer.h.

◆ merge_from()

void ARDOUR::AudioBuffer::merge_from ( const Buffer src,
samplecnt_t  len,
sampleoffset_t  dst_offset = 0,
sampleoffset_t  src_offset = 0 
)
inlinevirtual

Accumulate (add) len samples from src starting at src_offset into self starting at dst_offset

Implements ARDOUR::Buffer.

Definition at line 91 of file audio_buffer.h.

◆ prepare()

void ARDOUR::AudioBuffer::prepare ( )
inline

Definition at line 250 of file audio_buffer.h.

◆ read_from() [1/2]

void ARDOUR::AudioBuffer::read_from ( const Buffer src,
samplecnt_t  len,
sampleoffset_t  dst_offset = 0,
sampleoffset_t  src_offset = 0 
)
inlinevirtual

Copy samples from src buffer starting at src_offset into self starting at dst_offset

Parameters
srcbuffer to read from
lennumber of samples to copy
dst_offsetoffset in destination buffer
src_offsetstart offset in src buffer

Implements ARDOUR::Buffer.

Definition at line 68 of file audio_buffer.h.

◆ read_from() [2/2]

void ARDOUR::AudioBuffer::read_from ( const Sample src,
samplecnt_t  len,
sampleoffset_t  dst_offset = 0,
sampleoffset_t  src_offset = 0 
)
inline

Copy samples from src array starting at src_offset into self starting at dst_offset

Parameters
srcarray to read from
lennumber of samples to copy
dst_offsetoffset in destination buffer
src_offsetstart offset in src buffer

Definition at line 52 of file audio_buffer.h.

◆ resize()

void ARDOUR::AudioBuffer::resize ( size_t  nframes)
virtual

Reallocate the buffer used internally to handle at least nframes of data

Constructor MUST have been passed capacity!=0 or this will die (to prevent mem leaks).

Implements ARDOUR::Buffer.

◆ set_data()

void ARDOUR::AudioBuffer::set_data ( Sample data,
size_t  size 
)
inline

Set the data contained by this buffer manually (for setting directly to jack buffer).

Constructor MUST have been passed capacity=0 or this will die (to prevent mem leaks).

Definition at line 214 of file audio_buffer.h.

◆ set_written()

void ARDOUR::AudioBuffer::set_written ( bool  w)
inline

Definition at line 260 of file audio_buffer.h.

◆ silence()

void ARDOUR::AudioBuffer::silence ( samplecnt_t  len,
samplecnt_t  offset = 0 
)
virtual

silence buffer

Parameters
lennumber of samples to clear
offsetstart offset

Implements ARDOUR::Buffer.

◆ silent_data()

bool ARDOUR::AudioBuffer::silent_data ( ) const
virtual

Implements ARDOUR::Buffer.

◆ written()

bool ARDOUR::AudioBuffer::written ( ) const
inline

Definition at line 259 of file audio_buffer.h.

Member Data Documentation

◆ _data

Sample* ARDOUR::AudioBuffer::_data
private

Actual buffer contents.

Definition at line 265 of file audio_buffer.h.

◆ _owns_data

bool ARDOUR::AudioBuffer::_owns_data
private

Definition at line 263 of file audio_buffer.h.

◆ _written

bool ARDOUR::AudioBuffer::_written
private

Definition at line 264 of file audio_buffer.h.


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