22 #ifndef __ardour_audio_buffer_h__
23 #define __ardour_audio_buffer_h__
56 assert (_capacity > 0);
57 assert (len <= _capacity);
58 copy_vector (_data + dst_offset, src + src_offset, len);
71 assert (&src !=
this);
72 assert (_capacity > 0);
74 assert (dst_offset + len <= _capacity);
83 if (dst_offset == 0 && src_offset == 0 && len == _capacity) {
86 _silent = _silent && src.
silent ();
96 accumulate_from (*ab, len, dst_offset, src_offset);
102 assert (_capacity > 0);
103 assert (len <= _capacity);
107 Sample*
const dst_raw = _data + dst_offset;
108 const Sample*
const src_raw = src.
data () + src_offset;
112 _silent = (src.
silent () && _silent);
121 assert (_capacity > 0);
122 assert (len <= _capacity);
124 Sample*
const dst_raw = _data + dst_offset;
125 const Sample*
const src_raw = src + src_offset;
138 assert (_capacity > 0);
139 assert (len <= _capacity);
141 if (src.
silent () || gain_coeff == 0) {
145 Sample*
const dst_raw = _data + dst_offset;
146 const Sample*
const src_raw = src.
data () + src_offset;
150 _silent = ((src.
silent () && _silent) || (_silent && gain_coeff == 0));
159 assert (_capacity > 0);
160 assert (len <= _capacity);
162 Sample*
const dst_raw = _data + dst_offset;
166 _silent = (_silent && gain_coeff == 0);
175 assert (_capacity > 0);
176 assert (len <= _capacity);
178 if (initial == 0 && target == 0) {
182 Sample* dst = _data + dst_offset;
183 gain_t gain_delta = (target - initial) / len;
186 *dst++ += (*src++ * initial);
187 initial += gain_delta;
190 _silent = (_silent && initial == 0 && target == 0);
203 if (len == _capacity) {
217 assert (!_owns_data);
232 assert (offset <= _capacity);
233 return _data + offset;
238 assert (offset <= _capacity);
240 return _data + offset;
Sample * _data
Actual buffer contents.
Sample * data(samplecnt_t offset=0)
bool check_silence(pframes_t nframes, pframes_t &n) const
void read_from(const Buffer &src, samplecnt_t len, sampleoffset_t dst_offset=0, sampleoffset_t src_offset=0)
AudioBuffer(size_t capacity)
void set_data(Sample *data, size_t size)
void apply_gain(gain_t gain, samplecnt_t len)
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 merge_from(const Buffer &src, samplecnt_t len, sampleoffset_t dst_offset=0, sampleoffset_t src_offset=0)
const Sample * data(samplecnt_t offset=0) const
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 Sample *src_raw, samplecnt_t len, gain_t gain_coeff, sampleoffset_t dst_offset=0)
void silence(samplecnt_t len, samplecnt_t offset=0)
void accumulate_from(const AudioBuffer &src, samplecnt_t len, sampleoffset_t dst_offset=0, sampleoffset_t src_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 read_from(const Sample *src, samplecnt_t len, sampleoffset_t dst_offset=0, sampleoffset_t src_offset=0)
void resize(size_t nframes)
void memset(float *data, const float val, const uint32_t n_samples)
PBD::PropertyDescriptor< gain_t > gain
Temporal::samplecnt_t samplecnt_t
apply_gain_to_buffer_t apply_gain_to_buffer
mix_buffers_with_gain_t mix_buffers_with_gain
Temporal::sampleoffset_t sampleoffset_t
mix_buffers_no_gain_t mix_buffers_no_gain
copy_vector_t copy_vector