AudioBuffer(size_t capacity);
~AudioBuffer();
- void silence (framecnt_t len, framecnt_t offset = 0) {
- if (!_silent) {
- assert(_capacity > 0);
- assert(offset + len <= _capacity);
- memset(_data + offset, 0, sizeof (Sample) * len);
- if (len == _capacity) {
- _silent = true;
- }
- }
- _written = true;
- }
+ void silence (framecnt_t len, framecnt_t offset = 0);
/** Read @a len frames @a src starting at @a src_offset into self starting at @ dst_offset*/
void read_from (const Sample* src, framecnt_t len, framecnt_t dst_offset = 0, framecnt_t src_offset = 0) {
Sample* data (framecnt_t offset = 0) {
assert(offset <= _capacity);
+ _silent = false;
return _data + offset;
}
- bool check_silence (pframes_t, pframes_t&) const;
+ bool check_silence (pframes_t, bool, pframes_t&) const;
void prepare () { _written = false; _silent = false; }
bool written() const { return _written; }
}
bool
-AudioBuffer::check_silence (pframes_t nframes, pframes_t& n) const
+AudioBuffer::check_silence (pframes_t nframes, bool wholebuffer, pframes_t& n) const
{
- for (n = 0; n < _size && n < nframes; ++n) {
+ for (n = 0; (wholebuffer || n < _size) && n < nframes; ++n) {
if (_data[n] != Sample (0)) {
return false;
}
}
return true;
}
+
+void
+AudioBuffer::silence (framecnt_t len, framecnt_t offset) {
+ pframes_t n = 0;
+ if (!_silent) {
+ assert(_capacity > 0);
+ assert(offset + len <= _capacity);
+ memset(_data + offset, 0, sizeof (Sample) * len);
+ if (len == _capacity) {
+ _silent = true;
+ }
+ }
+ _written = true;
+}
* all buffers appropriately.
*/
- bufs.set_is_silent (false);
}
void
_mtdm->process (nframes, in, out);
- outbuf.set_is_silent (false);
outbuf.set_written (true);
}
framepos_t start_frame, framepos_t end_frame, pframes_t nframes,
int declick, bool gain_automation_ok)
{
- bufs.set_is_silent (false);
-
/* figure out if we're going to use gain automation */
if (gain_automation_ok) {
_amp->set_gain_automation_buffer (_session.gain_automation_buffer ());