19 #ifndef __ardour_audio_buffer_h__
20 #define __ardour_audio_buffer_h__
41 assert(_capacity > 0);
42 assert(len <= _capacity);
43 memcpy(_data + dst_offset, src + src_offset,
sizeof(
Sample) * len);
50 assert(_capacity > 0);
51 assert(len <= _capacity);
54 _data[dst_offset+n] = src[n] *
gain;
63 assert(_capacity > 0);
65 assert(dst_offset + len <= _capacity);
67 memcpy(_data + dst_offset, ((
const AudioBuffer&)src).data() + src_offset,
sizeof(
Sample) * len);
68 if (dst_offset == 0 && src_offset == 0 && len == _capacity) {
71 _silent = _silent && src.
silent();
80 accumulate_from (*ab, len, dst_offset, src_offset);
85 assert(_capacity > 0);
86 assert(len <= _capacity);
88 Sample*
const dst_raw = _data + dst_offset;
89 const Sample*
const src_raw = src.
data() + src_offset;
93 _silent = (src.
silent() && _silent);
99 assert(_capacity > 0);
100 assert(len <= _capacity);
102 Sample*
const dst_raw = _data + dst_offset;
103 const Sample*
const src_raw = src + src_offset;
115 assert(_capacity > 0);
116 assert(len <= _capacity);
122 Sample*
const dst_raw = _data + dst_offset;
123 const Sample*
const src_raw = src.
data() + src_offset;
127 _silent = ( (src.
silent() && _silent) || (_silent && gain_coeff == 0) );
135 assert(_capacity > 0);
136 assert(len <= _capacity);
138 Sample*
const dst_raw = _data + dst_offset;
142 _silent = (_silent && gain_coeff == 0);
150 assert(_capacity > 0);
151 assert(len <= _capacity);
153 Sample* dst = _data + dst_offset;
154 gain_t gain_delta = (target - initial)/len;
157 *dst++ += (*src++ * initial);
158 initial += gain_delta;
161 _silent = (_silent && initial == 0 && target == 0);
185 void resize (
size_t nframes);
188 assert(offset <= _capacity);
189 return _data + offset;
193 assert(offset <= _capacity);
195 return _data + offset;
200 void prepare () { _written =
false; _silent =
false; }
213 #endif // __ardour_audio_audio_buffer_h__
Sample * data(framecnt_t offset=0)
void apply_gain(gain_t gain, framecnt_t len)
void accumulate_from(const Sample *src, framecnt_t len, framecnt_t dst_offset=0, framecnt_t src_offset=0)
LIBARDOUR_API PBD::PropertyDescriptor< bool > gain
void read_from_with_gain(const Sample *src, framecnt_t len, gain_t gain, framecnt_t dst_offset=0, framecnt_t src_offset=0)
LIBARDOUR_API mix_buffers_with_gain_t mix_buffers_with_gain
void accumulate_with_ramped_gain_from(const Sample *src, framecnt_t len, gain_t initial, gain_t target, framecnt_t dst_offset=0)
void accumulate_with_gain_from(const AudioBuffer &src, framecnt_t len, gain_t gain_coeff, framecnt_t dst_offset=0, framecnt_t src_offset=0)
void accumulate_with_gain_from(const Sample *src_raw, framecnt_t len, gain_t gain_coeff, framecnt_t dst_offset=0)
Sample * _data
Actual buffer contents.
LIBARDOUR_API mix_buffers_no_gain_t mix_buffers_no_gain
void read_from(const Buffer &src, framecnt_t len, framecnt_t dst_offset=0, framecnt_t src_offset=0)
void set_data(Sample *data, size_t size)
void merge_from(const Buffer &src, framecnt_t len, framecnt_t dst_offset=0, framecnt_t src_offset=0)
const Sample * data(framecnt_t offset=0) const
void accumulate_from(const AudioBuffer &src, framecnt_t len, framecnt_t dst_offset=0, framecnt_t src_offset=0)
LIBARDOUR_API apply_gain_to_buffer_t apply_gain_to_buffer
void read_from(const Sample *src, framecnt_t len, framecnt_t dst_offset=0, framecnt_t src_offset=0)